Stabilizer Formalism, Shor's 9-Qubit Code and the Steane Code
You'll be able to:
You can describe a code by its stabilizer generators instead of its codewords, read off what errors it detects from commutation, explain how Shor's code concatenates two repetition codes to catch both bit and phase flips, and write the six generators of the [[7,1,3]] Steane code.
Describing a code by what leaves it alone
Writing out codewords like |000⟩ and |111⟩ stops scaling almost immediately. A surface code patch of distance 7 lives in a 2⁹⁷-dimensional space; nobody writes those vectors down. The stabilizer formalism, developed in Daniel Gottesman's thesis, replaces "here are the codewords" with "here are the operators that leave the codewords unchanged", and it turns out that almost every code in practical use can be described that way.
Stabilizers, syndromes and distance
Take n qubits and a set of Pauli operators (tensor products of I, X, Y, Z) that all commute with one another. The code space is the set of states that are +1 eigenstates of every one of them. If you choose n − k independent generators, the code space has dimension 2ᵏ: it stores k logical qubits. For the bit-flip code, n = 3, the generators are Z1Z2 and Z2Z3, and k = 1.
An error E is detected if it anticommutes with at least one generator, because then it flips that generator's eigenvalue from +1 to −1. The pattern of flipped generators is the syndrome. An error that commutes with every generator is invisible; if it is itself a product of generators it is harmless (it did nothing to the code space), but if it is not, it is a logical operator — it changes the encoded information without being noticed. The distance d is the smallest number of qubits such an undetectable, non-trivial error has to touch. A distance-d code corrects any error on fewer than d/2 qubits. The notation [[n, k, d]] summarises all of this: the bit-flip code is [[3, 1, 1]] as a quantum code, since a single Z is already an undetectable logical error.
Shor's 9-qubit code: concatenate two repetition codes
Shor's 1995 insight was to nest the two one-sided codes. First encode against phase flips: |0⟩ → |+++⟩, |1⟩ → |−−−⟩. Then protect each of those three qubits against bit flips by encoding it into three more: |+⟩ → (|000⟩ + |111⟩)/√2. You get nine qubits. The generators are the six Z-type pairs inside each block (Z1Z2, Z2Z3, Z4Z5, Z5Z6, Z7Z8, Z8Z9), which catch bit flips, plus two weight-6 X-type operators (X1…X6 and X4…X9) that compare the phases of neighbouring blocks. Any single-qubit X, Y or Z error gives a distinct syndrome, so the code is [[9, 1, 3]]. It is also the first example of a degenerate code: Z1 and Z2 produce the same syndrome and the same effect on the code space, so the decoder does not need to tell them apart.
The Steane code: borrowing a classical code twice
The [[7, 1, 3]] Steane code is the cleanest example of the CSS construction, which builds a quantum code from classical codes. Start with the classical [7, 4, 3] Hamming code, whose parity-check matrix has three rows:
0 0 0 1 1 1 1
0 1 1 0 0 1 1
1 0 1 0 1 0 1
Turn each row into a Z-type stabilizer (Z on every qubit where the row has a 1) and, separately, into an X-type stabilizer. Six generators on seven qubits leave one logical qubit. The Z-type generators detect X errors and the X-type generators detect Z errors, so the two halves of the syndrome are two independent Hamming decodings.
Worked procedure: decoding a single error on the Steane code
- Suppose an X error hits qubit 3. It anticommutes with every Z-type generator that has a 1 in column 3: rows 2 and 3. The Z-syndrome is (0, 1, 1).
- Read that as a binary number with row 1 as the most significant bit: 011 = 3. The Hamming code is arranged so the syndrome is the qubit index. Apply X to qubit 3.
- A Z error on qubit 5 anticommutes with X-type generators whose rows have a 1 in column 5: rows 1 and 3. X-syndrome (1, 0, 1) = 5. Apply Z to qubit 5.
- A Y error on qubit 1 is X and Z together on the same qubit: Z-syndrome (0, 0, 1) and X-syndrome (0, 0, 1). Both halves point at qubit 1, and you apply Y.
All 21 single-qubit Pauli errors (7 positions × 3 types) give distinct non-zero six-bit syndromes, which is what distance 3 means in practice.
Why engineers care about the formalism
Two consequences of the stabilizer picture shape everything downstream. First, the Gottesman–Knill theorem: circuits built from Clifford gates (H, S, CNOT), Pauli errors and Pauli measurements can be simulated efficiently on a classical computer by tracking the stabilizers rather than the state vector. That is the only reason tools like Stim can simulate a distance-11 surface code with millions of shots — the capstone depends on it. Second, the formalism makes "which errors does this code catch" a commutation calculation you can hand to a script, which is how codes are searched for, compared and verified.
The Steane code also previews a theme from module 6: because its X and Z generators have the same shape, applying a Hadamard to all seven qubits swaps the two sets and maps the code onto itself. That gives a logical Hadamard "for free" — a transversal gate (and likewise transversal S, applied as S† on every qubit, and CNOT — the whole Clifford group). The surface code is not so lucky.
What to remember
- A stabilizer code is defined by commuting Pauli generators; the code space is their joint +1 eigenspace; n − k generators store k qubits.
- Syndrome = which generators anticommute with the error. Undetectable non-trivial errors are logical operators; the lightest one sets the distance.
- Shor's [[9, 1, 3]] code concatenates a phase-flip code with a bit-flip code and corrects any single-qubit error.
- The [[7, 1, 3]] Steane code uses the Hamming parity-check rows as both X- and Z-type generators; the syndrome spells out the error's position.
- Gottesman–Knill is why QEC circuits can be simulated at all — the whole tooling stack rests on it.
Curated Materials
2.1hThe deep work happens here — the lesson is your briefing.
Live on aiqbench
This lesson's subject on the rest of the site, today.
In the news, last 30 days
- Classiq and Diraq Collaborate to Advance Fault-Tolerant Quantum Computing on SiliconHPCwire ·
- NVIDIA Strengthens US Quantum Leadership With Groq 3 LPX Breakthrough in Quantum Error CorrectionNVIDIA ·
- Q-CTRL Expands Fire Opal into Fault-Tolerant Quantum ComputingQ-CTRL ·
Test your knowledge
5 questions in 100 seconds, on a page of its own. Read everything above first.
Test your knowledge →Module Mission
35–45 minWrite the six stabilizer generators of the Steane code from the rows of the [7,4,3] Hamming parity-check matrix (three X-type, three Z-type). For each single-qubit error X3, Z5 and Y1, compute which generators anticommute with it and write the resulting 6-bit syndrome. Show that all 21 single-qubit Pauli errors give distinct, non-zero syndromes — that is what makes the code distance 3.
Loading your work…