In short

The 5-qubit perfect code is the [[5, 1, 3]] stabilizer code. Five physical qubits encode one logical qubit at distance 3, which is enough to correct any single-qubit Pauli error — X, Y, or Z on any of the 5 physical qubits, a total of 15 distinct single-qubit error operators. The code is defined by four commuting stabilizer generators, each a weight-4 Pauli string of the form X Z Z X I cyclically permuted across the 5 qubits:

S_1 = X_1 Z_2 Z_3 X_4 I_5, \; S_2 = I_1 X_2 Z_3 Z_4 X_5, \; S_3 = X_1 I_2 X_3 Z_4 Z_5, \; S_4 = Z_1 X_2 I_3 X_4 Z_5.

The 4 stabilizer bits give 2^4 = 16 syndrome outcomes. Exactly 15 of them correspond to the 15 non-trivial single-qubit errors, and the 16th is "no error". Not a single syndrome is wasted — this is why the code is called perfect. The code saturates the quantum Singleton bound n - k \geq 2(d-1): for n = 5, k = 1, d = 3, the bound reads 4 \geq 4, tight. The logical operators are X_L = X_1 X_2 X_3 X_4 X_5 and Z_L = Z_1 Z_2 Z_3 Z_4 Z_5, both weight 5. The code was discovered twice independently in 1996: once by Bennett, DiVincenzo, Smolin, and Wootters, and once by Laflamme, Miquel, Paz, and Zurek. Unlike Shor's and Steane's codes, the 5-qubit code is not a CSS code — its stabilizers mix X and Z on each individual qubit, which is why it achieves Singleton saturation but loses the CSS-friendly classical-code construction.

You now know how to read a stabilizer code's parameters [[n, k, d]]. Shor's 9-qubit code is [[9, 1, 3]] — it takes nine physical qubits to protect one logical qubit against any single-qubit Pauli error. Steane's 7-qubit code is [[7, 1, 3]] — two qubits fewer, same protection. The obvious question: how far can this go? Is there a [[6, 1, 3]] code? A [[5, 1, 3]]? Could a single-error-correcting code exist with fewer than 5 qubits?

The quantum Singleton bound from the previous chapter, n - k \geq 2(d-1), says no. For k = 1, d = 3, the bound gives n \geq 5. Any single-error-correcting code on one logical qubit must spend at least 5 physical qubits. No [[4, 1, 3]] code exists, and the 5-qubit bound is sharp.

The remarkable fact is that the bound is actually achieved. A [[5, 1, 3]] code exists, and it is unique up to local Clifford equivalence. It is called the 5-qubit perfect code, and it is the smallest stabilizer code that corrects any single-qubit Pauli error on a one-logical-qubit encoding. It was discovered independently by two groups in 1996 — Bennett, DiVincenzo, Smolin, and Wootters in one paper, Laflamme, Miquel, Paz, and Zurek in another — each publishing within weeks of the other. The code has been a benchmark ever since: the most compact single-error-correcting stabilizer code, and the go-to example in the theoretical literature when someone needs "a code that does the minimum efficient thing".

This chapter builds the code from first principles. You will see the four stabilizer generators (each a cyclic rotation of a single weight-4 Pauli pattern), verify they commute, identify the logical operators, and work through how a single bit-flip on any qubit produces a unique syndrome that the decoder can read and correct. You will also see why the code is perfect — every one of the 16 possible syndrome outcomes maps to exactly one correctable event, with no syndrome wasted.

The four stabilizer generators

The [[5, 1, 3]] code is defined by four Pauli stabilizer generators on 5 qubits. They are obtained by taking the single weight-4 pattern X Z Z X I and cycling it across the 5 qubits:

\boxed{\begin{aligned} S_1 &\;=\; X_1 \, Z_2 \, Z_3 \, X_4 \, I_5 \\ S_2 &\;=\; I_1 \, X_2 \, Z_3 \, Z_4 \, X_5 \\ S_3 &\;=\; X_1 \, I_2 \, X_3 \, Z_4 \, Z_5 \\ S_4 &\;=\; Z_1 \, X_2 \, I_3 \, X_4 \, Z_5 \end{aligned}}

Each stabilizer has weight 4 — it acts non-trivially on 4 of the 5 qubits and as identity on the fifth. The "identity position" rotates: S_1 is trivial on qubit 5, S_2 on qubit 1, S_3 on qubit 2, S_4 on qubit 3. Notice there is no S_5 with the identity on qubit 4 — the list of four generators suffices to define the code, and adding a fifth would make one of them redundant (expressible as a product of the other four up to sign). You can check that the fifth cyclic shift X_1 Z_2 I_3 X_4 Z_5 \cdot \text{something} lies in the group generated by S_1, S_2, S_3, S_4.

The four stabilizer generators of the 5-qubit perfect codeFour rows, five columns each, showing which Pauli operator (X, Z, or I) acts on each of the five qubits for each of the four stabilizer generators S1 to S4. The cyclic X Z Z X I pattern rotates by one position per row.Four stabilizer generators, each a cyclic shift of XZZXIq1q2q3q4q5S₁XZZXIS₂IXZZXS₃XIXZZS₄ZXIXZEach row cycles the XZZXI pattern one position to the right. The "I" slot rotates from q5 to q1 to q2 to q3.weight of each generator = 4 (four non-identity entries)
The four stabilizer generators of the 5-qubit perfect code, laid out as rows. Each row is the single pattern $X Z Z X I$ rotated cyclically one position to the right. The generators are weight-4; each has exactly one $I$ and that $I$ rotates around the 5 qubits. You can compose any product of generators from these four rows; the resulting stabilizer group has $2^4 = 16$ elements.

Verifying that the generators commute

Before this list is a valid stabilizer, all four generators must pairwise commute. Check one pair explicitly; the rest follow by the cyclic symmetry.

Take S_1 = X_1 Z_2 Z_3 X_4 I_5 and S_2 = I_1 X_2 Z_3 Z_4 X_5. Multiply them position by position to see whether each shared non-identity position contributes a commutation or anticommutation.

Why two anticommutations make the operators commute overall: the full product S_1 S_2 equals (-1)^{(\text{number of anticommuting positions})} S_2 S_1. Two anticommutations give (-1)^2 = +1, so S_1 S_2 = S_2 S_1 and the two operators commute as a whole. This is a general rule for multi-qubit Pauli operators: they commute if and only if the number of positions where they anticommute (i.e. one has X or Y, the other has Z or Y, in an anticommuting combination) is even.

Run the same check on all \binom{4}{2} = 6 pairs of generators. Each pair has exactly two anticommuting positions and three commuting positions, giving an even count. All six pairs commute, so the four-generator set is a valid abelian stabilizer group.

Why 4 generators and 1 logical qubit

The generators are independent (no one is a product of the others up to sign — you can check by comparing patterns). So n - k = 4, and since n = 5, this gives k = 1. One logical qubit. The stabilizer group \mathcal{S} = \langle S_1, S_2, S_3, S_4 \rangle has 2^4 = 16 elements, and its +1-eigenspace inside the 2^5 = 32-dimensional Hilbert space has dimension 32 / 16 = 2 — exactly a one-qubit space.

Logical operators

The logical operators on the encoded qubit are the Pauli operators that commute with all four stabilizers but are not themselves in the stabilizer group. For the 5-qubit perfect code, the canonical choices are:

\boxed{X_L \;=\; X_1 X_2 X_3 X_4 X_5, \qquad Z_L \;=\; Z_1 Z_2 Z_3 Z_4 Z_5.}

Both have weight 5 — each acts as a non-identity Pauli on every one of the 5 qubits. Check that X_L = X^{\otimes 5} commutes with every S_i: each generator has some combination of Xs, Zs, and one I. The number of anticommuting positions between X_L and S_i equals the number of Zs in S_i (since X anticommutes with Z but commutes with X and I). Each generator has exactly 2 Zs (check the pattern XZZXI), so each anticommutation count is 2 — even — giving commutation. Same for Z_L = Z^{\otimes 5}: the anticommuting positions are the Xs in each generator, and each generator has 2 of them, giving commutation.

Minimum weight of any non-trivial logical operator = 3. This is what makes the code distance 3. You might suspect the minimum weight is 5 (since X_L, Z_L both have weight 5), but there are weight-3 logical operators too, obtained by multiplying X_L or Z_L by stabilizers. For example:

X_L \cdot S_1 = (X_1 X_2 X_3 X_4 X_5)(X_1 Z_2 Z_3 X_4 I_5) = I_1 (X_2 Z_2)(X_3 Z_3) I_4 X_5 = Y_2 Y_3 X_5

up to a phase, which has weight 3.

Why this is a logical operator: multiplying X_L (which is logical) by S_1 (which is in the stabilizer) gives another element of the logical-operator coset — i.e. it acts identically to X_L on the code space because the stabilizer factor is +1 there. The coset of X_L contains X_L, X_L \cdot S_1, X_L \cdot S_2, X_L \cdot S_1 S_2, and so on — 16 elements, each equivalent to X_L as a logical operation but different in weight. The weight-3 representatives (like Y_2 Y_3 X_5) are the "tightest" form of the logical X.

The code distance is the minimum weight in this coset, and it is 3. A single weight-2 error could not produce this coset's minimum-weight representative because the coset starts at weight 3. So any single-qubit error (weight 1) is far from any logical operator, and the syndrome can unambiguously identify it.

The perfectness condition

Now the punchline — the feature that gives the code its name.

With 4 stabilizer bits, you get 2^4 = 16 possible syndrome outcomes. One of them is the all-plus-one outcome (+1, +1, +1, +1), meaning "no error was detected" — the state is in the code space and no correction is needed.

The remaining 16 - 1 = 15 syndromes are "error detected" outcomes. Each one corresponds to some Pauli error (or an equivalence class of Paulis that produce the same syndrome).

Now count the single-qubit errors. There are 5 qubits, and on each qubit there are 3 non-trivial Pauli errors (X, Y, or Z). Total: 5 \times 3 = 15.

Exactly 15 single-qubit errors, exactly 15 non-trivial syndromes. The code provides enough syndrome bandwidth to distinguish every single-qubit error uniquely — no two single-qubit errors produce the same syndrome, and no syndrome is "wasted" on something other than a correctable single-qubit error.

This is the perfect property. Mathematically, the code saturates the quantum Hamming bound, which counts correctable patterns against available syndromes:

2^{n-k} \;\geq\; \sum_{j=0}^{t} 3^j \binom{n}{j}.

For n = 5, k = 1, t = 1 (single-error-correcting):

2^4 \;=\; 16 \;\geq\; 1 + 3 \cdot 5 \;=\; 16. \qquad \text{Equality.}

So the 5-qubit code satisfies the Hamming bound with equality — it is a quantum Hamming-perfect code. This is an even tighter claim than saturating the Singleton bound (which is Singleton equality n - k = 2(d-1), i.e. 4 = 4, also true). The 5-qubit code saturates both bounds. Few codes do.

The 5-qubit code's perfect syndrome matchingTwo columns with arrows. Left: 16 binary syndrome patterns 0000 to 1111. Right: 16 Pauli outcomes, grouped as 1 identity and 15 single-qubit errors (five each of X, Y, Z). Each arrow connects one syndrome to one error, filling all 16 slots.16 syndromes ↔ 16 errors (1 identity + 15 single-qubit)16 syndrome outcomes2^4 possible readings00000001001000110100010101100111100010011010101111001101111011111 "no error" +15 "error detected"unique match16 Pauli outcomesI + 15 single-qubit errorsno error (identity): 1X errors: X₁, X₂, X₃, X₄, X₅ (5)Y errors: Y₁, Y₂, Y₃, Y₄, Y₅ (5)Z errors: Z₁, Z₂, Z₃, Z₄, Z₅ (5)total: 1 + 15 = 16no syndrome wasted — the code is *perfect*
The perfectness of the 5-qubit code. The 4 stabilizer measurements yield 16 possible syndrome patterns; the 15 non-trivial single-qubit errors plus 1 "no error" outcome fill all 16 exactly, with no surplus and no shortage. Every error that the decoder might need to correct has its own dedicated syndrome.

The encoding circuit

Producing the encoded state from a raw logical qubit |\psi\rangle = \alpha|0\rangle + \beta|1\rangle plus four ancilla qubits in |0\rangle requires a specific sequence of Clifford gates. The canonical circuit uses:

  1. Hadamards on the four ancilla qubits, producing |+\rangle^{\otimes 4}.
  2. A sequence of controlled-Pauli gates (controlled-X, controlled-Y, controlled-Z) linking each ancilla to multiple data qubits, implementing the stabilizer measurements as conditional operations.
  3. A final layer of phase and Hadamard gates that match the specific cyclic structure of the stabilizers.

The explicit circuit has roughly 8 CNOTs, 4 controlled-Z gates, 5 Hadamards, and a few S (phase) gates. It does not decompose into the clean two-stage concatenation of Shor's code — the 5-qubit code is not a CSS code, and its encoding circuit has no simple product structure.

5-qubit code encoding circuitA 5-wire quantum circuit sketch. The top wire carries the data qubit; four ancillas in |0⟩ below. First column: Hadamards on the four ancillas. Subsequent columns: a mix of CNOTs (filled dots to XOR targets) and controlled-Z gates (filled dots with a Z-box target) interconnecting the five wires in the cyclic XZZXI pattern. A final phase gate appears on qubit 2.|ψ⟩|0⟩|0⟩|0⟩|0⟩ → 5-qubit code state|ψ⟩|0⟩|0⟩|0⟩|0⟩HHHHZZZS(schematic — the real circuit has ~8 CNOTs, 4 CZs, 5 Hadamards, some S gates)the code is not CSS, so no simple two-stage decomposition exists
Encoding circuit for the 5-qubit perfect code (schematic). After Hadamards on the four ancillas, a web of CNOTs and controlled-Z gates interconnects all 5 wires, implementing the cyclic structure of the stabilizers. Unlike Shor's 9-qubit code (two cleanly stacked stages), the 5-qubit circuit does not decompose into simple blocks — every pair of qubits is linked by the gates.

The details of the full encoding circuit appear in Laflamme et al.'s 1996 paper and are reproduced in Nielsen and Chuang §10.5.9. For most pedagogical purposes, the stabilizer generators and logical operators are what you need — the encoding circuit is machinery.

Decoding: how the syndrome maps to the error

Given a syndrome (s_1, s_2, s_3, s_4) \in \{+1, -1\}^4, the decoder must identify which single-qubit error (if any) produced it. The procedure:

  1. Measure the four stabilizers. This yields 4 classical bits. s_i = +1 means "this stabilizer is still in its +1 eigenstate" (no error seen by this stabilizer). s_i = -1 means "this stabilizer has flipped to -1" (some error anticommutes with S_i).

  2. Look up the syndrome pattern in a decoder table. Since every single-qubit error has a unique syndrome, and the code has no syndrome waste, the lookup table is 2^4 = 16 entries long and is deterministic: each syndrome either means "no error" (the all-plus-one outcome) or names a specific X_j, Y_j, or Z_j for some qubit j.

  3. Apply the matching Pauli correction to the identified qubit. If the syndrome says "X_3", apply X_3 to the data. This undoes the error, and the state returns to the code space.

The decoder table has 16 rows. You can construct it by computing, for each single-qubit error E, which stabilizers anticommute with E:

Because the stabilizers' pattern is cyclic, the syndromes come out with cyclic structure too. A single syndrome (s_1, s_2, s_3, s_4) maps to a single Pauli error E_{s_1 s_2 s_3 s_4} on some qubit j with some Pauli type.

Worked examples

Example 1: verify that S₁ and S₂ commute

Take the first two stabilizer generators of the 5-qubit code:

S_1 = X_1 Z_2 Z_3 X_4 I_5, \qquad S_2 = I_1 X_2 Z_3 Z_4 X_5.

Compute S_1 S_2 and S_2 S_1 and show they are equal — i.e., the generators commute.

Step 1. Write out the product S_1 S_2 position by position. Two Pauli operators on 5 qubits multiply as the tensor product of the individual 1-qubit products:

S_1 S_2 \;=\; (X \cdot I) \otimes (Z \cdot X) \otimes (Z \cdot Z) \otimes (X \cdot Z) \otimes (I \cdot X).

Step 2. Evaluate each tensor factor. Use the Pauli multiplication rules: XZ = -iY, ZX = +iY, ZZ = I, XX = I, I \cdot P = P.

  • Qubit 1: X \cdot I = X.
  • Qubit 2: Z \cdot X = -iY.
  • Qubit 3: Z \cdot Z = I.
  • Qubit 4: X \cdot Z = -iY. Why XZ = -iY: XZ = \begin{pmatrix}0&1\\1&0\end{pmatrix}\begin{pmatrix}1&0\\0&-1\end{pmatrix} = \begin{pmatrix}0&-1\\1&0\end{pmatrix} = -iY where Y = \begin{pmatrix}0&-i\\i&0\end{pmatrix}.
  • Qubit 5: I \cdot X = X.

So S_1 S_2 = X \otimes (-iY) \otimes I \otimes (-iY) \otimes X = (-i)^2 X Y I Y X = -X_1 Y_2 I_3 Y_4 X_5.

Step 3. Write out S_2 S_1 similarly. This time S_2 acts first:

S_2 S_1 \;=\; (I \cdot X) \otimes (X \cdot Z) \otimes (Z \cdot Z) \otimes (Z \cdot X) \otimes (X \cdot I).
  • Qubit 1: I \cdot X = X.
  • Qubit 2: X \cdot Z = -iY \cdot (-1) \cdot \ldots wait, let me recompute: XZ = -iY, so X \cdot Z means applying Z first then X, giving XZ = -iY. On the tensor-product multiplication S_2 S_1, the operator on qubit 2 is X \cdot Z = XZ = -iY. Hmm, that gives the same as step 2. Let me redo this carefully. Why I need to be careful: in a product AB on a qubit, AB is interpreted as "apply B first, then apply A" — operator composition. So S_1 S_2 on qubit 2 means apply S_2's qubit-2 factor (X) first, then S_1's qubit-2 factor (Z). That gives Z \cdot X = ZX = +iY. And S_2 S_1 on qubit 2 gives X \cdot Z = XZ = -iY. These differ by a sign. So on qubit 2: S_1 S_2 gives ZX = +iY; S_2 S_1 gives XZ = -iY. Difference: factor of -1.
  • Qubit 4: S_1 S_2 gives X \cdot Z = XZ = -iY; S_2 S_1 gives Z \cdot X = ZX = +iY. Another factor of -1.

Step 4. Combine the signs. Compared to S_1 S_2, the product S_2 S_1 picks up (-1) from qubit 2 and another (-1) from qubit 4, for a total factor of (-1)^2 = +1. So S_1 S_2 = S_2 S_1 — they commute.

Step 5. Verify via the commutation count. A faster route: count the number of positions where S_1 and S_2 anticommute (as in the section above): two (qubits 2 and 4). Even count ⇒ commute. Matches step 4.

Result. S_1 and S_2 commute. [S_1, S_2] = 0.

What this shows. The four stabilizer generators of the 5-qubit code are carefully designed so that the number of anticommuting positions between any pair is even. Each pair of generators has exactly 2 anticommuting positions, and the total stabilizer group is abelian. This is the algebraic invariant that makes the code valid.

S₁ and S₂ commute via even anticommutation countTwo rows comparing S1 and S2 qubit by qubit. Q1: X vs I, commute. Q2: Z vs X, ANTICOMMUTE. Q3: Z vs Z, commute. Q4: X vs Z, ANTICOMMUTE. Q5: I vs X, commute. Total anticommutations = 2, which is even, so S1 and S2 commute overall.q1q2q3q4q5S₁:XZZXIS₂:IXZZXcommuteANTIcommuteANTIcommuteTotal anticommutations = 2 (even) ⇒ S₁ and S₂ commute
Pair-by-pair commutation analysis between $S_1$ and $S_2$. Two of the five qubit positions anticommute. Because the count is even, the signs cancel and the two generators commute overall. This is a shortcut for checking commutation without multiplying out the full operators.

Example 2: the syndrome of an X₂ error

Suppose an X_2 error happens on the encoded state — a bit-flip on qubit 2. Compute the syndrome that the four stabilizers will read, and verify the syndrome is unique to this error.

Step 1. How does X_2 affect each stabilizer? A Pauli error E flips the eigenvalue of stabilizer S_i from +1 to -1 if and only if E anticommutes with S_i. For E = X_2 (Pauli X on qubit 2, identity elsewhere), check anticommutation with each S_i:

  • S_1 = X_1 Z_2 Z_3 X_4 I_5: on qubit 2, E has X and S_1 has Z. XZ anticommutes. No other qubits have non-identity from E. Anticommute. Syndrome bit: s_1 = -1.

  • S_2 = I_1 X_2 Z_3 Z_4 X_5: on qubit 2, E has X and S_2 has X. XX commutes. Commute. Syndrome bit: s_2 = +1.

  • S_3 = X_1 I_2 X_3 Z_4 Z_5: on qubit 2, E has X and S_3 has I. Trivial. Commute. Syndrome bit: s_3 = +1.

  • S_4 = Z_1 X_2 I_3 X_4 Z_5: on qubit 2, E has X and S_4 has X. XX commutes. Commute. Syndrome bit: s_4 = +1.

Step 2. The syndrome. (s_1, s_2, s_3, s_4) = (-1, +1, +1, +1). In binary form (with -1 \leftrightarrow 1 and +1 \leftrightarrow 0): 1000.

Step 3. Is this syndrome unique to X_2? Check each of the other 14 single-qubit errors. Pattern: a single-qubit error P_j produces a syndrome where bit s_i = -1 iff S_i has a Pauli on qubit j that anticommutes with P. Let me tabulate the syndromes for all 15 single-qubit errors:

Error Syndrome (s_1, s_2, s_3, s_4)
X_1 (+1, +1, +1, -1) = 0001
X_2 (-1, +1, +1, +1) = 1000
X_3 (-1, -1, +1, +1) = 1100
X_4 (+1, -1, -1, +1) = 0110
X_5 (+1, +1, -1, -1) = 0011
Z_1 (-1, +1, -1, +1) = 1010
Z_2 (+1, -1, +1, -1) = 0101
Z_3 (+1, +1, -1, +1) = 0010
Z_4 (-1, +1, +1, -1) = 1001
Z_5 (+1, -1, +1, +1) = 0100
Y_1 (-1, +1, -1, -1) = 1011
Y_2 (-1, -1, +1, -1) = 1101
Y_3 (-1, -1, -1, +1) = 1110
Y_4 (-1, -1, -1, -1) = 1111
Y_5 (+1, -1, -1, -1) = 0111

Why this table fills all 15 non-trivial syndromes exactly: the 15 single-qubit errors and the 15 non-trivial 4-bit syndromes line up bijectively because the code is perfect — by construction. Every row is distinct, covering all 15 non-zero binary patterns, and the all-zero pattern 0000 is reserved for "no error".

Step 4. Confirm the X_2 syndrome. The table entry for X_2 is (-1, +1, +1, +1) = 1000 — exactly what we computed in step 2. No other row has this syndrome, so X_2 is uniquely identified.

Result. A single X error on qubit 2 produces the unique syndrome 1000. The decoder reads the four stabilizer bits, gets 1000, looks up the table, identifies "X_2 error", and applies X_2 to the data. The error is undone, the code is back in its +1-eigenspace, and the logical state \alpha|0\rangle_L + \beta|1\rangle_L is preserved.

What this shows. The 5-qubit code's distinguishing feature is on display here: a four-bit syndrome has 16 possible values, the 15 non-trivial values map one-to-one to the 15 single-qubit errors, and no syndrome is ambiguous or wasted. This one-to-one mapping is what "perfect" means in the code's name, and it is what makes the 5-qubit code the most compact single-error-correcting stabilizer code possible.

X₂ syndrome lookup for the 5-qubit codeA pipeline diagram. Left: "X₂ error" box. Arrow to middle: four stabilizer measurements yielding (−1, +1, +1, +1) = 1000. Arrow to right: decoder lookup table row 1000 → "apply X on qubit 2". Final arrow to "code restored" box.X₂ errorbit-flip onqubit 2measureSyndromeS₁ = −1S₂ = +1S₃ = +1S₄ = +11000lookupDecoder tablerow 1000 →X on qubit 2unique to X₂apply X₂coderestoredEvery single-qubit error has its own 4-bit syndrome.No ambiguity, no wasted syndrome — the code is perfect.
End-to-end error-correction cycle for an $X_2$ error in the 5-qubit code. The error is detected by $S_1$ alone (which has a $Z$ on qubit 2, anticommuting with $X$), giving the unique syndrome 1000. The decoder looks up this row and applies $X_2$ to restore the code. The cycle is identical for any of the 14 other single-qubit errors — each has its own dedicated syndrome row.

Historical significance

The 5-qubit code was discovered twice, independently, in 1996, within weeks of each other:

The near-simultaneous discovery is not a coincidence — the quantum Singleton bound (known earlier) had told the community that any single-error-correcting code needed n \geq 5, and the search for a code saturating the bound was actively underway. Both groups landed on essentially the same construction through different algebraic approaches. The code is sometimes called the "Laflamme 5-qubit code" in retrospect, and the four-author papers are often co-cited.

Since 1996, the 5-qubit code has served as:

It is not used in modern fault-tolerant proposals — the surface code has better geometric properties for 2D chips, and Steane's 7-qubit code has cleaner transversal gate sets. But every quantum error correction textbook opens with Shor's 9-qubit code and ends the small-distance section with the 5-qubit perfect code — because the pairing tells the compactness story: Shor used 9, Steane got down to 7, and the 5-qubit code is the fundamental lower bound.

Not a CSS code

One final structural feature worth highlighting: the 5-qubit code is not a CSS code. In a CSS code (Calderbank-Shor-Steane, covered in the next chapter), the stabilizer generators come in two disjoint groups — pure-X stabilizers and pure-Z stabilizers, with no mixing. Steane's 7-qubit code and Shor's 9-qubit code are both CSS: their stabilizers are all either pure Xs or pure Zs.

The 5-qubit code's stabilizers like X_1 Z_2 Z_3 X_4 I_5 mix Xs and Zs on the same generator. That is why the code escapes the CSS framework. It achieves Singleton saturation (which no CSS code with k = 1, d = 3 does), at the cost of losing the simple "one classical code for X, another for Z" construction that CSS codes enjoy. The 5-qubit code therefore requires a non-CSS encoding circuit with intertwined gate layers, and its fault-tolerant operation requires more careful analysis than the CSS codes — which is part of why CSS codes dominate practical fault-tolerance proposals despite their higher qubit overhead.

Common confusions

Going deeper

You now know the 5-qubit perfect code by its stabilizers, its logical operators, and its decoder table. This section gives the full stabilizer-group structure, the encoding circuit in detail, the relation to a pentagon of Pauli operators, and the code's place in the broader landscape of quantum codes.

The 16-element stabilizer group

The stabilizer generators S_1, S_2, S_3, S_4 generate a 16-element abelian group. The full group consists of all products of the generators (with \pm 1 signs absorbed). Explicitly:

Total: 1 + 4 + 6 + 4 + 1 = 16 = 2^4. Each product is a specific weight-k Pauli string on 5 qubits. Computing them explicitly is tedious but mechanical — each element is a Pauli operator (times \pm 1), and all 16 mutually commute.

The +1-eigenspace of this 16-element group is the 2-dimensional code space, spanned by logical basis states |0\rangle_L and |1\rangle_L.

The pentagon picture

The cyclic structure of the stabilizer pattern X Z Z X I corresponds geometrically to labelling the vertices of a regular pentagon with the Pauli letters X, Z, Z, X, I in order. The four generators S_1, S_2, S_3, S_4 correspond to four cyclic rotations of this labelling around the pentagon.

The logical operators X_L = X^{\otimes 5} and Z_L = Z^{\otimes 5} correspond to the "uniform" labellings where every vertex gets the same Pauli. The pentagon symmetry group (D_5, the dihedral group of order 10) acts on the code, generating the cyclic permutations of the generators and the reflection that swaps X \leftrightarrow Z. The code's invariance under this pentagon symmetry is part of why the 5-qubit code has such clean algebraic structure despite being non-CSS.

Experimental demonstrations

The 5-qubit code has been implemented on several hardware platforms since its 1996 discovery:

Each demonstration confirms the theoretical construction: four stabilizers measured, syndrome read, correction applied, logical state preserved through single-error events.

Place in the code landscape

The 5-qubit code sits at a specific point in the (n, k, d) grid:

Compared to its neighbours:

If your constraint is "minimum physical qubits for a single-error correcting code", the 5-qubit code is the answer. If your constraint is "best fault-tolerant properties", other codes take over.

Indian experimental QEC

The Indian QEC community has contributed experimentally primarily through NMR — the IIT Kanpur, IISER Pune, and IIT Madras groups have longstanding programmes in NMR quantum information, and implementations of small stabilizer codes including 3-qubit and 5-qubit constructions have appeared in the Indian NMR literature since the 2000s. T. S. Mahesh's group at IISER Pune has published specifically on implementing stabilizer codes and error-correction protocols on NMR systems.

On the theoretical side, Indian contributions to code construction include work on quantum LDPC codes and concatenation from groups at IIT Madras and IIT Bombay. The National Quantum Mission (2023, ₹6000 crore) has listed fault-tolerant QEC as a thematic hub, with the 5-qubit code appearing in proposals for early experimental milestones.

Fault-tolerance considerations

The 5-qubit code, while perfect in the information-theoretic sense, is not fault-tolerant in the practical sense. Fault-tolerance requires that gates (including syndrome-measurement gates) do not themselves spread errors uncontrollably — and the 5-qubit code's stabilizers, being weight-4 and non-CSS, require careful syndrome-extraction protocols to achieve this.

Transversal gates (gates that act independently on each physical qubit within a block) are the standard tool for fault-tolerant operation. The 5-qubit code has a transversal logical Pauli group — X_L = X^{\otimes 5} is trivially transversal — but its logical Hadamard, logical S, and logical CNOT are not transversal in the simple form. Implementing these requires either the use of magic states distilled from separate 5-qubit code instances or a move to a richer code (like the Reed-Muller code or concatenated Steane) where more transversal gates are available.

This is partly why the 5-qubit code, despite its perfect information-theoretic efficiency, is not the default in fault-tolerant computing. The surface code's worse overhead is outweighed by its cleaner fault-tolerant gate structure.

Where this leads next

References

  1. Raymond Laflamme, Cesar Miquel, Juan Pablo Paz, Wojciech Zurek, Perfect quantum error correction code (1996) — arXiv:quant-ph/9602019. One of the two original papers introducing the 5-qubit code, focused on the perfectness property.
  2. Charles Bennett, David DiVincenzo, John Smolin, William Wootters, Mixed-state entanglement and quantum error correction (1996) — arXiv:quant-ph/9604024. The other independent discovery of the 5-qubit code, in the broader context of entanglement-assisted error correction.
  3. Daniel Gottesman, Stabilizer codes and quantum error correction (PhD thesis, 1997) — arXiv:quant-ph/9705052. Stabilizer-formalism treatment of the 5-qubit code alongside the whole code zoo.
  4. John Preskill, Lecture Notes on Quantum Computation, Chapter 7 — theory.caltech.edu/~preskill/ph229. Pedagogical derivation and the connection to the Hamming and Singleton bounds.
  5. Nielsen and Chuang, Quantum Computation and Quantum Information (2010), §10.5.9 — Cambridge University Press. The 5-qubit code with full encoding circuit and decoder table.
  6. Wikipedia, Five-qubit error correcting code — accessible overview with the stabilizer listing and encoding circuit. </content> </invoke>