|q⟩ Bad Qubits

advanced · Physics · Quantum Error-Correction Theory

The Nine-Qubit Shor Code (Theory)

Shor's nine-qubit code was the first demonstration that arbitrary single-qubit errors can be corrected. Its design idea is beautifully simple: concatenate the phase-flip and bit-flip repetition codes so that one protects against ZZ and the other against XX, and (because Y=iXZY = iXZ) the combination handles everything.

The construction

Encode in two layers. First the phase-flip code maps a qubit to three:

0+++,1.|0\rangle \mapsto |{+}{+}{+}\rangle, \qquad |1\rangle \mapsto |{-}{-}{-}\rangle .

Then each of those three qubits is itself protected by the bit-flip code, +=(0+1)/2(000+111)/2|+\rangle = (|0\rangle+|1\rangle)/\sqrt2 \mapsto (|000\rangle+|111\rangle)/\sqrt2 and (000111)/2|-\rangle \mapsto (|000\rangle-|111\rangle)/\sqrt2. The logical codewords on nine qubits are

0L=122(000+111)3,1L=122(000111)3.|0\rangle_L = \frac{1}{2\sqrt2}\,(|000\rangle + |111\rangle)^{\otimes 3}, \qquad |1\rangle_L = \frac{1}{2\sqrt2}\,(|000\rangle - |111\rangle)^{\otimes 3}.

This is a [[9,1,3]][[9,1,3]] code: nine physical qubits, one logical qubit, distance three.

The stabilizer generators

There are nk=91=8n - k = 9 - 1 = 8 independent generators. Six are ZZ-type, checking bit parities within each block of three:

Z1Z2,  Z2Z3,Z4Z5,  Z5Z6,Z7Z8,  Z8Z9.Z_1Z_2,\; Z_2Z_3,\quad Z_4Z_5,\; Z_5Z_6,\quad Z_7Z_8,\; Z_8Z_9 .

Two are XX-type, checking phase parities between the three blocks:

X1X2X3X4X5X6,X4X5X6X7X8X9.X_1X_2X_3X_4X_5X_6, \qquad X_4X_5X_6X_7X_8X_9 .

All eight commute (each ZZ-pair overlaps each weight-six XX-operator on an even number of qubits, so they commute), and together they fix the two-dimensional codespace.

How it catches every single-qubit error

Bit flips (XiX_i): anticommute with the ZZ-type generators inside their block, exactly like the ordinary repetition code — the ZjZkZ_jZ_k syndromes localise and correct the flip.

Phase flips (ZiZ_i): a ZZ on any qubit of a block flips the sign of that block's (000±111)(|000\rangle \pm |111\rangle) state, i.e. it acts as a phase flip on the block-level qubit. The two XX-type generators compare the phase parity across blocks and pin down which block flipped.

Yi=iXiZiY_i = iX_iZ_i: detected and corrected by both mechanisms at once.

Degeneracy

The Shor code is degenerate: distinct phase errors can act identically on the codespace. For instance Z1Z_1, Z2Z_2, and Z3Z_3 all flip the sign of the first block's (000+111)(|000\rangle+|111\rangle) factor in the same way, so Z1Z2Z_1 Z_2 is a stabilizer that acts trivially. The code corrects all weight-one phase errors even though it does not assign them distinct syndromes — a hallmark of degeneracy, our next topic.

The takeaway

Shor's [[9,1,3]][[9,1,3]] code nests a bit-flip code inside a phase-flip code; its six ZZ-type and two XX-type stabilizers detect bit flips within blocks and phase flips between blocks. Because YY is a product of XX and ZZ, the code corrects any single-qubit error — the first proof that fully quantum error correction is possible.

Sign in on the full site to ask questions and join the discussion.