|q⟩ Bad Qubits

advanced · Physics · Quantum Error-Correction Theory

The Repetition Code Revisited

We met the three-qubit repetition code informally as a first example of protecting a bit. Now we recast it in the stabilizer formalism, which exposes exactly what it does and does not protect and sets the template for every code that follows.

The bit-flip code as a stabilizer code

The bit-flip repetition code encodes

0L=000,1L=111,|0\rangle_L = |000\rangle, \qquad |1\rangle_L = |111\rangle,

so a general logical state α0L+β1L=α000+β111\alpha|0\rangle_L + \beta|1\rangle_L = \alpha|000\rangle + \beta|111\rangle. This two-dimensional codespace is the simultaneous +1+1 eigenspace of the two commuting stabilizer generators

g1=Z1Z2,g2=Z2Z3.g_1 = Z_1 Z_2, \qquad g_2 = Z_2 Z_3 .

Each gig_i checks the parity of a pair of qubits without measuring their individual values: Z1Z2Z_1 Z_2 returns +1+1 when qubits 1 and 2 agree and 1-1 when they differ. Both codewords 000|000\rangle and 111|111\rangle have all pairs agreeing, so both are +1+1 eigenstates — measuring g1,g2g_1, g_2 never disturbs the logical superposition.

Syndrome decoding

A single bit-flip XiX_i anticommutes with whichever generators touch qubit ii, flipping those syndrome bits:

| Error | g1=Z1Z2g_1=Z_1Z_2 | g2=Z2Z3g_2=Z_2Z_3 | |---|---|---| | none | +1+1 | +1+1 | | X1X_1 | 1-1 | +1+1 | | X2X_2 | 1-1 | 1-1 | | X3X_3 | +1+1 | 1-1 |

The three single-qubit flips give three distinct syndromes, so each is identified and undone. This is a [[3,1,1]][[3,1,1]] code with respect to bit-flips: n=3n=3, k=1k=1, and a logical operator Xˉ=X1X2X3\bar X = X_1X_2X_3 of weight 3 while Zˉ=Z1\bar Z = Z_1 has weight 1 — so its distance to phase errors is just 1.

What it cannot do

The repetition code is blind to phase errors. A single ZiZ_i commutes with both ZZ-type stabilizers, produces no syndrome, and acts as Zˉ\bar Z up to a stabilizer — an undetectable logical phase flip.

Try it

Build the encoded +L|+\rangle_L of the bit-flip code, the GHZ state (000+111)/2(|000\rangle + |111\rangle)/\sqrt{2}, using a Hadamard and two CNOTs. The grader derives the target state vector from the reference circuit and checks yours against it.

Run your code to see the quantum state.

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