ψQuantum Computing 2026

CHAPTER 17

Stabilizers and quantum error correction

Learning goals. Encode an unknown state without cloning it, extract parity syndromes, understand code distance, and derive stabilizer commutation and recovery conditions.

17.1 Protect amplitudes without learning them

An encoding maps one logical qubit into a larger physical space:

α|0+β|1α|0L+β|1L.\alpha|0\rangle+\beta|1\rangle \longmapsto \alpha|0_L\rangle+\beta|1_L\rangle.

It does not produce three copies (α|0+β|1)3(\alpha|0\rangle+\beta|1\rangle)^{\otimes3}. The logical amplitudes are distributed through a code subspace. Error checks must reveal information about errors while preserving the encoded information.

The three-qubit bit-flip code uses |0L=|000|0_L\rangle=|000\rangle, |1L=|111|1_L\rangle=|111\rangle. CNOTs from the input to two zero ancillas encode it. A flip on the middle qubit produces α|010+β|101\alpha|010\rangle+\beta|101\rangle. Measuring every physical bit would reveal the logical value and destroy a general superposition. Instead measure parity.

17.2 Syndrome extraction

The checks are Z0Z1Z_0Z_1 and Z1Z2Z_1Z_2. Every valid code state has eigenvalue +1 for both. A bit flip changes the signs of checks touching its location:

Error Z0Z1Z_0Z_1 Z1Z2Z_1Z_2 Syndrome bits
I +1 +1 00
X0X_0 −1 +1 10
X1X_1 −1 −1 11
X2X_2 +1 −1 01

The bit convention is 0 for eigenvalue +1 and 1 for −1. A fresh ancilla initialized to zero receives CNOTs from the two data qubits; measuring it in Z reveals their parity. The two components of the encoded superposition share the same syndrome, so the syndrome does not reveal α or β.

After syndrome 11, apply X1X_1: X1(α|010+β|101)=α|000+β|111X_1(\alpha|010\rangle+\beta|101\rangle) =\alpha|000\rangle+\beta|111\rangle. The same correction acts on both amplitudes.

Two flips can mimic one. X0X1X_0X_1 has the same syndrome as X2X_2. Correcting as though X2X_2 occurred leaves X0X1X2X_0X_1X_2, a logical X. Thus under independent flips and perfect checks the failure probability is 3p22p33p^2-2p^3. This code does not correct arbitrary phase errors.

Laboratory L23 — Repetition-code memory. Inject a specific bit-flip pattern, inspect neighboring parity checks and the chosen recovery, and compare exact odd-distance failure probabilities. Measurements and recovery are ideal in this model.

Encode an arbitrary input in the three-qubit repetition code, then extract the two Z-parity checks into separate ancillas. This ideal circuit explains the syndrome; it is not a fault-tolerant extraction schedule.
Repetition-code failure under independent X errors and perfect recovery. The improvement concerns one error type.

17.3 Why correcting Pauli errors is enough in principle

Any one-qubit operator can be expanded as aI+bX+cY+dZaI+bX+cY+dZ. If a code corrects an appropriate error set, it also corrects coherent combinations in the span under the quantum error-correction conditions. Syndrome extraction separates error sectors without reading the logical amplitudes.

This does not mean hardware errors literally select a Pauli every time. It is a statement about a linear operator basis and recoverability. Coherent noise, correlated multi-qubit errors, leakage, and faulty syndrome circuits still require careful modeling.

A phase-flip repetition code uses |+++,||+++\rangle,|---\rangle and X-type checks. Combining protection against bit and phase errors leads to codes such as Shor’s nine-qubit code [34]. Its logical states can be written

|0L=(|000+|1112)3,|1L=(|000|1112)3.|0_L\rangle=\left(\frac{|000\rangle+|111\rangle}{\sqrt2}\right)^{\otimes3}, \quad |1_L\rangle=\left(\frac{|000\rangle-|111\rangle}{\sqrt2}\right)^{\otimes3}.

The construction protects against any single physical-qubit error, not just a classical bit flip.

17.4 Stabilizer groups and logical operators

A Pauli string is a tensor product of I,X,Y,Z with a phase. Two strings commute if the number of positions where they have different nonidentity Paulis is even. For example, XX and ZZ commute: each position contributes one minus sign, so the total sign is positive.

An abelian stabilizer group S not containing −I defines the common +1 eigenspace of its generators. With r independent generators on n qubits, the code-space dimension is 2nr2^{n-r}, encoding k=n−r logical qubits. Independence matters: a product of existing generators imposes no new constraint [33].

A logical Pauli commutes with all stabilizers but is not itself a stabilizer. For the repetition code, X¯=X0X1X2\overline X=X_0X_1X_2 and Z¯=Z0\overline Z=Z_0 are logical operators. Multiplying a logical operator by a stabilizer changes its physical representative but not its action within the code space.

An [[n,k,d]][[n,k,d]] quantum code has distance d equal to the smallest weight of a nontrivial logical Pauli, for a stabilizer code. It can correct arbitrary errors on up to (d1)/2\lfloor(d-1)/2\rfloor unknown locations. Known erasures can be corrected on up to d−1 locations under the code’s assumptions. The bit-flip repetition code has distance one as a full quantum code because a single Z is an undetectable logical phase operation.

17.5 The Knill–Laflamme condition

Let P project onto the code space and {Ea}\{E_a\} be a set of errors. A recovery correcting their span exists exactly when

PEaEbP=cabP.PE_a^\dagger E_bP=c_{ab}P.

The constants may depend on the error labels but not on the encoded logical state. Intuitively, the environment must not learn which logical state was present while distinguishing correctable error processes [36].

For distinct logical basis states, the condition implies iL|EaEb|jL=0\langle i_L|E_a^\dagger E_b|j_L\rangle=0 when i≠j and equal diagonal values for all i. Error images must preserve logical distinguishability while revealing no logical information through their error-label overlaps.

17.6 CSS codes and a next example

A CSS code uses X-only and Z-only checks specified by binary matrices HX,HZH_X,H_Z. Commutation requires

HXHZT=0(mod2).H_XH_Z^T=0\pmod2.

Z-type checks detect X components of errors, and X-type checks detect Z components. A Y has both components. The seven-qubit Steane code is an [[7,1,3]][[7,1,3]] CSS code built from the classical Hamming structure [35]. Unlike the three-qubit bit-flip code, it corrects arbitrary single-qubit Pauli errors.

17.7 Exercises

17.1. Give the syndrome of X0X2X_0X_2 in the repetition code and the result of single-error recovery.

Show solution / guidance

Both checks flip, giving 11. Recovery applies X1X_1, leaving X0X1X2X_0X_1X_2, a logical X failure.

17.2. Do XZI and ZXI commute? What about XII and ZII?

Show solution / guidance

The first pair has two local anticommutations and commutes. The second has one and anticommutes.

17.3. Ten physical qubits have seven independent stabilizer generators. How many logical qubits are encoded?

Show solution / guidance

k=10−7=3, so the code space has dimension eight.

17.4. What arbitrary unknown-location errors can a distance-five code correct?

Show solution / guidance

Up to two physical-qubit errors. Under an erasure model with known locations, it can correct up to four erasures.

17.5. Why is measuring a parity safer than separately measuring both bits for an encoded superposition?

Show solution / guidance

Parity can be identical in both logical components, preserving their coherence within the parity subspace. Separate measurements can distinguish the logical components and reveal encoded information.