Five-Qubit Code
The five-qubit code protects one unknown qubit against an arbitrary error on any one of five physical qubits. Four commuting measurements distinguish the identity and all fifteen single-qubit Pauli errors without revealing the encoded amplitudes. This is the smallest code with full single-qubit error correction, and its notation records five physical qubits, one logical qubit and distance three.
The code is also perfect: its sixteen correctable error sectors exactly fill the physical Hilbert space. This describes the geometry of ideal recovery. Noisy gates, faulty syndrome measurements and errors on several carriers require further analysis.
Required background. Stabilizer formalism explains commuting checks, syndrome sectors and logical Pauli operators. Three-qubit codes introduces recovery of an entire operator span and distinguishes protection against one noise axis from full quantum distance.
Four cyclic checks define the logical qubit
Section titled “Four cyclic checks define the logical qubit”Read tensor strings from qubit 1 on the left to qubit 5 on the right. Choose the generators
The code is their common eigenspace. Each pair commutes: the number of positions with unlike nonidentity Pauli factors is even. For example, and anticommute locally at positions 2 and 4; the two minus signs cancel.
These four generators are independent. Their sixteen products are distinct, and none is . The fifth cyclic shift is already determined:
Thus five visible cyclic patterns provide only four independent constraints. The plus sign in this product matters: changing a stabilizer sign changes the chosen eigenspace.
Writing , the code projector is
The four factors are commuting orthogonal projectors, so is an orthogonal projector. Only the identity in the group sum has nonzero trace. Consequently,
The common eigenspace therefore holds one qubit. This cyclic convention is discussed in Gottesman (1997), Sections 3.3 and 8.2. The original five-qubit constructions appear in Laflamme et al. (1996) and Bennett et al. (1996). Equivalent descriptions can use different local bases, qubit orders or codeword phases; their printed syndromes need not match.
Logical basis states without a long expansion
Section titled “Logical basis states without a long expansion”Convenient logical operators are
They commute with all four checks and anticommute with each other. A compatible orthonormal basis is
To understand the normalization, expand as the sum over . Its sixteen terms send to sixteen distinct computational basis vectors, each with coefficient or . Therefore has norm . Multiplying by four gives sixteen amplitudes of magnitude , whose squared magnitudes sum to one.
Every basis vector in has even Hamming weight, so . Applying flips all five bits, giving odd weight and the eigenstate . This constructs the full encoding without needing to memorize sixteen signs. The projector formula specifies those signs whenever explicit amplitudes are needed.
Sixteen syndromes distinguish all single-qubit Paulis
Section titled “Sixteen syndromes distinguish all single-qubit Paulis”Define the four-bit syndrome by
We always list bits in the order . A bit 1 means anticommutation and hence measured eigenvalue after acts on a code state. For a fixed Pauli error the result does not depend on or .
For example, commutes with the first three generators and anticommutes with the on qubit 1 in . Thus . The complete single-error table is compact when organized by carrier:
| Qubit | |||
|---|---|---|---|
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 |
Together with , these are all sixteen possible bit strings, each appearing once. Because , its syndrome is the bitwise sum
The phase does not affect commutation. More generally, syndromes add under Pauli multiplication even when the Paulis anticommute with each other.
For a measured string , the joint projector is
Let be the unique identity or weight-one Pauli with that syndrome. Then
Each sector has dimension two. Distinct sectors are orthogonal because at least one measured eigenvalue differs. All sixteen sectors together exhaust the physical space:
The measurement learns which two-dimensional sector contains the state, while leaving its logical amplitudes intact. This is the useful distinction between learning about an error and measuring the encoded qubit.
Recovery corrects an operator span
Section titled “Recovery corrects an operator span”After measuring , apply . Discarding the classical outcome gives the channel
Its Kraus operators are . Since and , recovery is trace preserving on the entire physical Hilbert space.
For the sixteen errors , orthogonality gives
This is the nondegenerate Knill–Laflamme criterion. It proves more than correction of a classical lottery over Pauli errors. Suppose every Kraus operator of a noise channel has the form
For , projecting onto sector selects only the coefficient . Recovery removes , so the branch contributes . Trace preservation of the noise channel implies
and therefore . The same argument holds when is entangled with an untouched reference, because every equation acts as the identity on that reference.
Any channel acting on one physical qubit has Kraus operators in this span, including a coherent rotation or amplitude damping on that carrier. The span also contains some operations supported on several carriers. For example,
is unitary and exactly correctable. It acts on two carriers, but both terms in its Pauli expansion have weight one. In contrast, is a weight-two product. The number of carriers touched by an operator and the weights of terms in its Pauli expansion are different questions.
Products of independent single-carrier channels generally introduce weight-two and higher terms. They are therefore not all corrected exactly, even though each individual carrier channel would be correctable if it acted alone.
Distance, perfect packing and minimum length
Section titled “Distance, perfect packing and minimum length”The distance is the smallest weight of a Pauli that preserves the code but acts nontrivially on its logical qubit. Scalar phases are ignored: is not a nontrivial logical error.
No weight-one Pauli has zero syndrome. A weight-two Pauli is a product of two single-site Paulis on different carriers. Those factors have different syndromes in the table, so their bitwise sum cannot vanish. Thus no weight-one or weight-two Pauli commutes with every check.
On the other hand,
This weight-three operator acts as on the code. It is an undetected logical error, proving . The weight-five operators and are convenient representatives, not minimum-weight ones.
The perfect-packing statement follows separately. Sixteen mutually orthogonal error sectors, each of dimension two, occupy dimensions. Equivalently the nondegenerate quantum Hamming bound is saturated:
Finally, minimum length follows from the quantum Singleton bound
With and , this requires , including for degenerate codes. Hamming counting alone would not exclude a smaller degenerate code. These bounds and their assumptions are discussed in Gottesman (1997), Chapter 7.
The code is non-CSS in the displayed physical basis: its stabilizer group has no nonidentity pure-X or pure-Z element, so no generating set of those two types can generate it. Mixed-looking generators alone would not establish this; a different choice of generators can sometimes hide CSS structure. Here all fifteen nonidentity stabilizers have weight four and contain more than one Pauli type. Steane code gives a useful comparison with separate X and Z checks.
A detected error can still be corrected incorrectly
Section titled “A detected error can still be corrected incorrectly”A nonzero syndrome diagnoses departure from the code, but it does not uniquely identify an unrestricted physical error. Consider
Recovery applies in either case. For the true single error , that restores the state. For , the residual acts as on the code. The syndrome returns to zero, but the relative phase of the logical state has changed.
The same measured syndrome leads to the same correction. The two physical errors nevertheless leave different logical states. The minus sign on the lower final state is an overall phase; the logical Z changes the relative phase between and .
In fact, every weight-two Pauli produces a nontrivial logical residual under this single-error recovery. Let have weight two and let be the weight-one correction with its syndrome. The product has zero syndrome and weight at most three. It cannot be proportional to identity because and have different weights. It cannot be a nonidentity stabilizer because every such stabilizer has weight four. Hence it is a nontrivial logical Pauli. All ninety weight-two Paulis are detected, but all ninety are miscorrected by this recovery.
This does not mean that each one changes every logical state. A residual leaves unchanged as a ray. Failure here means failure to preserve an arbitrary logical state, including its entanglement with a reference.
Exact logical error probability for independent depolarizing noise
Section titled “Exact logical error probability for independent depolarizing noise”Assume each physical carrier independently receives with probability and each of with probability . Assume encoding, checks and recovery are ideal. To calculate the resulting logical channel, group all physical Pauli strings by weight and residual logical class. The counts are
| Weight | Logical I | Logical X | Logical Y | Logical Z |
|---|---|---|---|---|
| 0 | 1 | 0 | 0 | 0 |
| 1 | 15 | 0 | 0 | 0 |
| 2 | 0 | 30 | 30 | 30 |
| 3 | 60 | 70 | 70 | 70 |
| 4 | 135 | 90 | 90 | 90 |
| 5 | 45 | 66 | 66 | 66 |
For a reproducible calculation, form each Pauli string, find its syndrome from commutation with the four generators, multiply by the table’s correction, and classify the residual through its commutation with and . Each row sums to . The three nonidentity columns agree, so the logical channel is again depolarizing.
A weight- string has probability . Multiplying by the counts and summing gives the total probability of a nonidentity logical Pauli:
Thus each of occurs with probability . The leading term has a direct interpretation: there are choices of two faulty carriers, and all nine Pauli choices on each pair fail. Single errors are removed, leaving a quadratic leading probability.
As checks, , while : at every physical Pauli is equally likely and recovery cannot restore the lost information. The formula is a property of this noise model and ideal recovery, not a fault-tolerance threshold. Syndrome measurement explains how a faulty extraction circuit can itself introduce correlated data errors.
Exercises
Section titled “Exercises”1. Construct the code from its checks
Section titled “1. Construct the code from its checks”Verify pairwise commutation, the relation for , and the code dimension. Why is normalized?
Solution
Each pair of generators has two unlike nonidentity overlaps, so it commutes. Multiplying factors with their Pauli phases gives . Enumerating the sixteen generator products gives identity and fifteen distinct weight-four strings. Therefore the generators are independent and is absent.
The group-average projector has trace . Its action on gives sixteen orthogonal basis vectors with amplitudes , so
Multiplication by four normalizes it. The projector equation then guarantees all four stabilizer conditions.
2. Find shorter logical representatives
Section titled “2. Find shorter logical representatives”Show that and represent logical Z and X, respectively, up to sign. Find a weight-three representative of logical Y.
Solution
Keeping phases in each product gives
They act as and . Multiplying these representatives and choosing the Hermitian Pauli phase gives , which acts as . Each has weight three and commutes with every check. The signs do not change its logical error class, but they matter in operator identities and coherent superpositions.
3. Derive a syndrome and its Y counterpart
Section titled “3. Derive a syndrome and its Y counterpart”Compute and directly, then obtain without another commutation calculation. Explain why any two-carrier Pauli is detected.
Solution
At position 3 the generators have factors . Thus
Their bitwise sum gives . Any two-carrier Pauli is a product of two distinct weight-one Paulis, whose different syndromes have nonzero bitwise sum. At least one check must therefore return .
4. Correct a coherent operation on two carriers
Section titled “4. Correct a coherent operation on two carriers”Prove that is unitary. Find its two possible syndromes and the corrected logical state. Does this imply correction of ?
Solution
and commute and square to identity. Hence the cross terms in cancel, leaving . On a code state,
The terms occupy orthogonal sectors with syndromes and . Each outcome has probability . The corresponding corrections yield and , which describe the same state. This argument also preserves entanglement with a reference.
The product is a different operator: it has weight two and lies outside this weight-one span. It is detected but miscorrected by the lookup recovery. A sum of local errors should not be confused with their product.
5. Separate the three code parameters
Section titled “5. Separate the three code parameters”Explain why the code has distance three, why it is perfect, and why five carriers are necessary. Which part of the argument needs nondegeneracy?
Solution
The syndrome table excludes undetected weight-one and weight-two Paulis; supplies a weight-three nontrivial logical operator. This proves distance three.
Perfection counts sixteen orthogonal two-dimensional sectors, filling all 32 dimensions. Orthogonality of the separately counted errors is the nondegeneracy assumption in this Hamming argument.
The Singleton bound gives . This minimum-length conclusion also applies to degenerate codes. It is stronger than merely observing that the chosen five-qubit construction has no unused syndrome.
6. Follow a two-qubit error through recovery
Section titled “6. Follow a two-qubit error through recovery”For the error , find the syndrome, correction and residual logical class. Explain the leading term for independent depolarizing noise.
Solution
The syndromes and add to , so recovery applies . The residual is . It commutes with and anticommutes with , identifying logical Z. In the chosen signs, .
All weight-two strings similarly leave nontrivial logical Paulis. There are of them, each with probability . Their combined contribution is
Higher-weight strings contribute only at order and above. This establishes the leading term without needing the complete weight table.
References
Section titled “References”- C. H. Bennett, D. P. DiVincenzo, J. A. Smolin, and W. K. Wootters, “Mixed-state entanglement and quantum error correction,” Physical Review A 54, 3824–3851 (1996). doi:10.1103/PhysRevA.54.3824.
- D. Gottesman, Stabilizer Codes and Quantum Error Correction, Ph.D. thesis, California Institute of Technology (1997). arXiv:quant-ph/9705052.
- E. Knill and R. Laflamme, “Theory of quantum error-correcting codes,” Physical Review A 55, 900–911 (1997). doi:10.1103/PhysRevA.55.900.
- R. Laflamme, C. Miquel, J. P. Paz, and W. H. Zurek, “Perfect quantum error correcting code,” Physical Review Letters 77, 198–201 (1996). doi:10.1103/PhysRevLett.77.198.