Shor nine-qubit code
The Shor code encodes one logical qubit in nine physical qubits and corrects an arbitrary error on any one physical qubit under ideal recovery.
On this page
Explanation and significance
The construction combines protection against bit flips within three-qubit blocks with protection against phase flips across blocks. It illustrates why quantum error correction must handle two complementary error types. A general single-qubit error is a linear combination of I, X, Y and Z; correction of the relevant Pauli error sectors therefore handles arbitrary single-qubit noise on the encoded state, subject to the exact recovery assumptions.
Mechanism and mathematical structure
Use |0_L>=(|000>+|111>)^tensor3/sqrt(8) and |1_L>=(|000>-|111>)^tensor3/sqrt(8). A stabilizer generating set is Z0Z1, Z1Z2, Z3Z4, Z4Z5, Z6Z7, Z7Z8, X0X1X2X3X4X5 and X3X4X5X6X7X8. These eight independent commuting generators leave a two-dimensional subspace. The six Z checks locate a bit flip within a block; the two X-type checks identify which block has a phase flip. Different Z errors inside one block can have equivalent effects, demonstrating code degeneracy.
Fully worked reference example
Apply X4 to the code. It anticommutes with Z3Z4 and Z4Z5, but commutes with the other six generators. The syndrome therefore singles out the middle qubit of the middle block, and recovery X4 cancels it. Apply instead Z4: it commutes with all Z checks and anticommutes with both six-qubit X checks, identifying the middle block. A Z on any qubit in that block reverses its GHZ sign; selecting Z3 as recovery gives Z3Z4, which is a stabilizer and hence acts as identity on the code. For Y4, which is proportional to X4Z4, both sets of signs change. A compatible recovery restores the logical state up to a physically irrelevant overall phase.
Limits and misconceptions
The nine-qubit code is not nine independent copies of a qubit. Its long X-type checks also illustrate a practical challenge: a single ancilla interacting carelessly with many data qubits can spread errors. A static correction proof assumes ideal checks; a usable implementation requires verified ancillas, flag circuits or another fault-tolerant extraction method. The historical construction demonstrates possibility, not a claim that it is the lowest-overhead modern architecture.
Scientific relationships
Combines repetition encodings in complementary bases. Is an example of a degenerate [[9,1,3]] stabilizer code. Historically precedes many later topological and LDPC constructions.
Complete logical-operator conventions for the Shor code
With the stated Shor codewords, a logical Z can be represented by X0X1X2: it gives +1 on the first GHZ-plus block of |0_L> and -1 on the corresponding GHZ-minus block of |1_L>. A logical X can be represented by Z0Z3Z6, because one Z in each block exchanges GHZ-plus and GHZ-minus simultaneously. These representatives each have weight three and anticommute through their one-site overlap at q0. This convention is easy to confuse with the physical bit-flip repetition code, where X^tensor3 is logical X. The logical labels depend on the full encoding map, not on how the operator looks locally.
Check that X0X1X2 commutes with the six Z parity generators: within its own block it overlaps each ZZ check twice, and outside it has no overlap. It also commutes with the X-type checks. It is not a stabilizer because it distinguishes the two logical codewords. Similarly, Z0Z3Z6 overlaps each six-body X check in two positions, so it commutes with stabilizers while exchanging logical states. Explicit operator verification prevents inconsistent code diagrams and recovery tables.
The code is degenerate because some different single-qubit phase errors have the same effect. Z0 and Z1 differ by Z0Z1, a stabilizer. A recovery that identifies the affected block but chooses a different qubit within it can still be correct. This is a physical example of logical-class decoding: the goal is restoration up to the stabilizer group, not forensic identification of the exact microscopic fault.
Error propagation and a practical extraction warning
The six-body X checks illustrate why static coding proofs are not sufficient for an implementation. Prepare an ancilla in|+> and use it as control for CNOTs onto the six data positions in an X-type check, followed by X measurement of the ancilla. In an ideal circuit this measures the intended product. But an X fault on the ancilla can propagate to multiple later targets. If it occurs before all interactions, it can produce the full check operator, which is harmless on the code; if it occurs partway through, it can produce a harmful partial string. The timing of the same Pauli fault changes its logical significance.
For example, a check acting on q0 through q5 with that order can propagate X3X4X5 from a fault after the first three interactions. In the stated encoding, X3X4X5 is another representative of logical Z, since it measures the sign of the middle GHZ block. One physical ancilla fault has therefore produced a logical error in this naive circuit. This explicit counterexample motivates verified multi-ancilla extraction or flag methods rather than a generic claim that nine data qubits automatically make a fault-tolerant memory.
Degeneracy reduces the number of distinct single-error sectors
The nine-qubit Shor code has twenty-seven nonidentity single-qubit Pauli errors, but they do not all require different syndrome sectors. The nine X errors have distinct internal block-parity patterns. The nine Y errors also include those location-dependent bit syndromes, together with a block phase syndrome. The nine Z errors collapse into three equivalence classes because all three positions within a block have the same action on the encoded information. Including no error gives twenty-two distinguishable classes for this restricted error set.
The count does not say that only twenty-two of the 256 possible syndromes can ever occur. Multi-qubit faults and extraction faults can populate additional syndromes. It says that distinct microscopic members of a correctable set need not consume distinct orthogonal error spaces. For example, Z0 and Z2 differ by Z0Z2, the product of the first two ZZ checks. Their error states coincide on the code, so insisting on distinguishing those two fault locations would demand information that the code deliberately does not retain.
A recovery convention can choose one representative per affected block. If the actual error is Z2 but recovery applies Z0, the residual operation is the stabilizer Z0Z2. If the actual error is Z2 and recovery applies Z3, the residual operation acts on two different blocks and has a different syndrome. Code degeneracy permits particular substitutions, not arbitrary ones. A correct decoder must respect the stabilizer equivalence relation rather than merely selecting any physical operation with the same weight.
Exact channel reduction for independent phase flips
Assume perfect recovery and independent Z errors with probability q on every physical qubit. Within one three-qubit block, an odd number of phase flips reverses the GHZ sign. The probability of this block sign error is r=3q(1-q)^2+q^3=3q-6q²+4q³. Even numbers act trivially on that block's GHZ sign. The three blocks therefore form an outer phase-repetition problem with independent error probability r.
The block-majority recovery fails when at least two block signs flip. Its logical X probability, in the codeword convention of this entry, is 3r²-2r³. At small q, r is approximately 3q, so the leading logical probability is 27q². At q=0.01, r=0.029404 and the exact logical probability is approximately 0.00254294. The coefficient is larger than the simple three-qubit repetition coefficient because each block has three physical opportunities to acquire its phase-sign error.
This result includes all numbers of independent Z faults within the interval, rather than retaining only the single-error guarantee. It also makes clear why the basis convention matters: the operator Z0Z3Z6 exchanges the stated |0_L> and |1_L>, so a failure of outer phase-sign correction is labelled logical X. The physical name phase flip and the logical name X refer to different encoded bases and are not contradictory.
Exact channel reduction for independent bit flips
Now suppose only independent physical X errors occur with probability p. Each three-qubit block is corrected by its two ZZ checks. The inner decoder fails with probability s=3p²-2p³, leaving a full-block X operation. In the stated Shor convention, a full-block X is logical Z. A residual full-block X on two different blocks is a product of the six-body stabilizers and acts trivially. Consequently the total logical Z probability is the odd-parity expression 3s-6s²+4s³.
At small p this begins as 9p². The bit and phase coefficients differ even though the code corrects every single-qubit Pauli error. The asymmetry follows from its concatenated structure and the chosen recovery, and it is not visible in the compact [[9,1,3]] label. Under a realistic depolarizing channel, physical X and Z components of Y events are correlated; combining the two one-channel calculations by simple multiplication would lose those correlations. A joint enumeration or properly coupled decoder is then needed.
Extracting a long check through a verified ancilla state
One route to preventing a single ancilla from spreading across six data positions is to distribute the interaction over a multi-qubit ancilla state. Each ancilla component interacts with only one data qubit. This limits propagation after preparation, but the ancilla preparation circuit can itself create correlated errors. Verification measurements are intended to reject or flag dangerous prepared faults before the ancilla touches the data. The verification acceptance probability and its own fault paths are part of the protocol.
The engineering tradeoff is therefore not one ancilla versus six magically perfect ancillas. It is a choice among circuit depth, ancilla count, repeated checks, rejected preparations, and residual correlated fault mechanisms. A complete fault-tolerance argument must enumerate which faults survive verification and what data support they can reach. The Shor code supplies a particularly transparent example because a partial three-target X propagation is already a logical operator in the naive six-body extraction circuit.
Sources
Verification scope
Stabilizer Codes and Quantum Error Correction
Daniel Gottesman · · Thesis · Preprint recorded · arXivCitation identity checked ·
Stabilizer algebra and fault-tolerance foundations; no current experimental ranking.
Verification scope
Citation identity checked ·
Architecture and surface-code tutorial; numerical thresholds remain model-specific.