The Shor Nine-Qubit Code
The first quantum code, written down by Peter Shor in 1995, protects one logical qubit using nine physical qubits. It is a beautiful example of concatenation: a code built by nesting one code inside another. The Shor code corrects an arbitrary single-qubit error — any , , or on any one of the nine qubits.
Two layers of redundancy
Recall the two basic three-qubit codes:
- The bit-flip code , catches an error by majority vote, but is blind to .
- The phase-flip code , catches a error, but is blind to .
Shor's trick is to compose them. Take the phase-flip code as the outer code, then encode each of its three qubits with the inner bit-flip code. The result protects against both, and therefore — because — against as well.
The logical states
Working out the concatenation gives the two logical codewords:
Each codeword is a product of three blocks, qubits , , and . Inside a block the sign between and stores the logical phase information; the three blocks together store the logical bit redundantly across the pattern. There are equally weighted product terms, so every nonzero amplitude is .
Building the encoder
The encoder for runs the two layers in order, starting from :
- Outer (phase) layer. Copy qubit 0 onto the two other block leaders with
cx(0,3)andcx(0,6), then apply a Hadamard to each leader (qubits 0, 3, 6). On the all-zero input this places each leader in . - Inner (bit) layer. Inside each block, copy the leader to its two partners:
cx(0,1), cx(0,2)for the first block, and likewisecx(3,4), cx(3,5)andcx(6,7), cx(6,8). Each leader fans out into .
Distance and what it corrects
The Shor code has distance 3: the smallest weight of a logical (undetectable) error is three single-qubit Paulis. A distance- code corrects up to errors, so the Shor code corrects any single-qubit error. The inner blocks catch a bit flip on any one qubit; the outer phase-flip structure catches a on any block; and a trips both at once.
Try it
Encode the Shor logical on nine qubits. The grader checks the full statevector, so all eight product terms must appear with amplitude and every other amplitude must vanish.
After running, open the statevector panel: exactly eight basis states are populated, each with amplitude , corresponding to the eight ways of choosing or independently in the three blocks.
Sign in on the full site to ask questions and join the discussion.