Skip to content

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 [[5,1,3]][[5,1,3]] 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

g1=XZZXI,g2=IXZZX,g3=XIXZZ,g4=ZXIXZ.\begin{aligned} g_1&=XZZXI,&g_2&=IXZZX,\\ g_3&=XIXZZ,&g_4&=ZXIXZ. \end{aligned}

The code is their common +1+1 eigenspace. Each pair commutes: the number of positions with unlike nonidentity Pauli factors is even. For example, g1g_1 and g2g_2 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 −I-I. The fifth cyclic shift is already determined:

g5=ZZXIX=g1g2g3g4.g_5=ZZXIX=g_1g_2g_3g_4.

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 S=⟨g1,g2,g3,g4⟩\mathcal S=\langle g_1,g_2,g_3,g_4\rangle, the code projector is

P=116∏a=14(I+ga)=116∑M∈SM.\begin{aligned} P&=\frac1{16}\prod_{a=1}^4(I+g_a)\\ &=\frac1{16}\sum_{M\in\mathcal S}M. \end{aligned}

The four factors (I+ga)/2(I+g_a)/2 are commuting orthogonal projectors, so PP is an orthogonal projector. Only the identity in the group sum has nonzero trace. Consequently,

dim⁡C=Tr⁡P=3216=2.\dim\mathcal C=\operatorname{Tr}P=\frac{32}{16}=2.

The common eigenspace C\mathcal C 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

X‾=XXXXX,Z‾=ZZZZZ.\overline X=XXXXX,\qquad\overline Z=ZZZZZ.

They commute with all four checks and anticommute with each other. A compatible orthonormal basis is

∣0L⟩=4P∣00000⟩,∣1L⟩=X‾∣0L⟩.\begin{aligned} |0_L\rangle&=4P|00000\rangle,\\ |1_L\rangle&=\overline X|0_L\rangle. \end{aligned}

To understand the normalization, expand 16P16P as the sum over S\mathcal S. Its sixteen terms send ∣00000⟩|00000\rangle to sixteen distinct computational basis vectors, each with coefficient +1+1 or −1-1. Therefore P∣00000⟩P|00000\rangle has norm 1/41/4. Multiplying by four gives sixteen amplitudes of magnitude 1/41/4, whose squared magnitudes sum to one.

Every basis vector in ∣0L⟩|0_L\rangle has even Hamming weight, so Z‾∣0L⟩=∣0L⟩\overline Z|0_L\rangle=|0_L\rangle. Applying X‾\overline X flips all five bits, giving odd weight and the −1-1 eigenstate ∣1L⟩|1_L\rangle. This constructs the full encoding V∣ψ⟩=α∣0L⟩+β∣1L⟩V|\psi\rangle=\alpha|0_L\rangle+\beta|1_L\rangle 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

gaE=(−1)sa(E)Ega.g_aE=(-1)^{s_a(E)}Eg_a.

We always list bits in the order (g1,g2,g3,g4)(g_1,g_2,g_3,g_4). A bit 1 means anticommutation and hence measured eigenvalue −1-1 after EE acts on a code state. For a fixed Pauli error the result does not depend on α\alpha or β\beta.

For example, X1X_1 commutes with the first three generators and anticommutes with the ZZ on qubit 1 in g4g_4. Thus s(X1)=0001s(X_1)=0001. The complete single-error table is compact when organized by carrier:

Qubit jj s(Xj)s(X_j) s(Yj)s(Y_j) s(Zj)s(Z_j)
1 00010001 10111011 10101010
2 10001000 11011101 01010101
3 11001100 11101110 00100010
4 01100110 11111111 10011001
5 00110011 01110111 01000100

Together with s(I)=0000s(I)=0000, these are all sixteen possible bit strings, each appearing once. Because Yj=iXjZjY_j=iX_jZ_j, its syndrome is the bitwise sum

s(Yj)=s(Xj)⊕s(Zj).s(Y_j)=s(X_j)\oplus s(Z_j).

The phase ii does not affect commutation. More generally, syndromes add under Pauli multiplication even when the Paulis anticommute with each other.

For a measured string ss, the joint projector is

Πs=116∏a=14[I+(−1)saga].\Pi_s=\frac1{16}\prod_{a=1}^4 \left[I+(-1)^{s_a}g_a\right].

Let EsE_s be the unique identity or weight-one Pauli with that syndrome. Then

Πs=EsPEs†.\Pi_s=E_sPE_s^\dagger.

Each sector EsCE_s\mathcal C has dimension two. Distinct sectors are orthogonal because at least one measured eigenvalue differs. All sixteen sectors together exhaust the physical space:

H2⊗5=⨁sEsC.\mathcal H_2^{\otimes5} =\bigoplus_s E_s\mathcal C.

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.

After measuring ss, apply Es†=EsE_s^\dagger=E_s. Discarding the classical outcome gives the channel

R(ρ)=∑sEs†ΠsρΠsEs.\mathcal R(\rho) =\sum_sE_s^\dagger\Pi_s\rho\Pi_sE_s.

Its Kraus operators are Ks=Es†ΠsK_s=E_s^\dagger\Pi_s. Since Ks†Ks=ΠsK_s^\dagger K_s=\Pi_s and ∑sΠs=I\sum_s\Pi_s=I, recovery is trace preserving on the entire physical Hilbert space.

For the sixteen errors Ea∈{I,Xj,Yj,Zj}E_a\in\{I,X_j,Y_j,Z_j\}, orthogonality gives

PEa†EbP=δabP.PE_a^\dagger E_bP=\delta_{ab}P.

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

Aμ=∑acμaEa.A_\mu=\sum_a c_{\mu a}E_a.

For ρ=PρP\rho=P\rho P, projecting onto sector ss selects only the coefficient cμsc_{\mu s}. Recovery removes EsE_s, so the branch contributes ∣cμs∣2ρ|c_{\mu s}|^2\rho. Trace preservation of the noise channel implies

∑μ,s∣cμs∣2=1,\sum_{\mu,s}|c_{\mu s}|^2=1,

and therefore R(N(ρ))=ρ\mathcal R(\mathcal N(\rho))=\rho. The same argument holds when ρ\rho 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,

U=X1+iZ22U=\frac{X_1+iZ_2}{\sqrt2}

is unitary and exactly correctable. It acts on two carriers, but both terms in its Pauli expansion have weight one. In contrast, X1Z2X_1Z_2 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: −I-I 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,

Y1Z2Y3=−g3Z‾.Y_1Z_2Y_3=-g_3\overline Z.

This weight-three operator acts as −ZL-Z_L on the code. It is an undetected logical error, proving d=3d=3. The weight-five operators X‾\overline X and Z‾\overline Z are convenient representatives, not minimum-weight ones.

The perfect-packing statement follows separately. Sixteen mutually orthogonal error sectors, each of dimension two, occupy 16×2=3216\times2=32 dimensions. Equivalently the nondegenerate quantum Hamming bound is saturated:

2k(1+3n)=2(1+15)=25.2^k(1+3n)=2(1+15)=2^5.

Finally, minimum length follows from the quantum Singleton bound

n−k≥2(d−1).n-k\geq2(d-1).

With k=1k=1 and d≥3d\geq3, this requires n≥5n\geq5, 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

s(X2Z4)=1000⊕1001=0001=s(X1).\begin{aligned} s(X_2Z_4)&=1000\oplus1001\\ &=0001=s(X_1). \end{aligned}

Recovery applies X1X_1 in either case. For the true single error X1X_1, that restores the state. For X2Z4X_2Z_4, the residual X1X2Z4X_1X_2Z_4 acts as −Z‾-\overline Z on the code. The syndrome returns to zero, but the relative phase of the logical state has changed.

A single X error and a two-qubit error share syndrome 0001; the same correction restores the first state but leaves a logical Z in the second.

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 ∣0L⟩|0_L\rangle and ∣1L⟩|1_L\rangle.

In fact, every weight-two Pauli produces a nontrivial logical residual under this single-error recovery. Let EE have weight two and let FF be the weight-one correction with its syndrome. The product FEFE has zero syndrome and weight at most three. It cannot be proportional to identity because EE and FF 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 ZLZ_L leaves ∣0L⟩|0_L\rangle 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 II with probability 1−p1-p and each of X,Y,ZX,Y,Z with probability p/3p/3. Assume encoding, checks and recovery are ideal. To calculate the resulting logical channel, group all 45=10244^5=1024 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 X‾\overline X and Z‾\overline Z. Each row sums to (5w)3w\binom5w3^w. The three nonidentity columns agree, so the logical channel is again depolarizing.

A weight-ww string has probability (p/3)w(1−p)5−w(p/3)^w(1-p)^{5-w}. Multiplying by the counts and summing gives the total probability of a nonidentity logical Pauli:

pL=10p2−2009p3+1609p4−12827p5.p_L={}10p^2-\frac{200}{9}p^3 +\frac{160}{9}p^4-\frac{128}{27}p^5.

Thus each of XL,YL,ZLX_L,Y_L,Z_L occurs with probability pL/3p_L/3. The leading term 10p210p^2 has a direct interpretation: there are (52)=10\binom52=10 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, pL(0)=0p_L(0)=0, while pL(3/4)=3/4p_L(3/4)=3/4: at p=3/4p=3/4 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.

Verify pairwise commutation, the relation for g5g_5, and the code dimension. Why is 4P∣00000⟩4P|00000\rangle normalized?

Solution

Each pair of generators has two unlike nonidentity overlaps, so it commutes. Multiplying factors with their Pauli phases gives g1g2g3g4=+ZZXIXg_1g_2g_3g_4=+ZZXIX. Enumerating the sixteen generator products gives identity and fifteen distinct weight-four strings. Therefore the generators are independent and −I-I is absent.

The group-average projector has trace 32/16=232/16=2. Its action on ∣00000⟩|00000\rangle gives sixteen orthogonal basis vectors with amplitudes ±1/16\pm1/16, so

∥P∣00000⟩∥2=16162=116.\|P|00000\rangle\|^2=\frac{16}{16^2}=\frac1{16}.

Multiplication by four normalizes it. The projector equation then guarantees all four +1+1 stabilizer conditions.

Show that YZYIIYZYII and IYYIXIYYIX represent logical Z and X, respectively, up to sign. Find a weight-three representative of logical Y.

Solution

Keeping phases in each product gives

YZYII=−g3Z‾,IYYIX=−g1X‾.\begin{aligned} YZYII&=-g_3\overline Z,\\ IYYIX&=-g_1\overline X. \end{aligned}

They act as −ZL-Z_L and −XL-X_L. Multiplying these representatives and choosing the Hermitian Pauli phase gives YXIIXYXIIX, which acts as −YL-Y_L. 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 s(X3)s(X_3) and s(Z3)s(Z_3) directly, then obtain s(Y3)s(Y_3) without another commutation calculation. Explain why any two-carrier Pauli is detected.

Solution

At position 3 the generators have factors Z,Z,X,IZ,Z,X,I. Thus

s(X3)=1100,s(Z3)=0010.s(X_3)=1100,\qquad s(Z_3)=0010.

Their bitwise sum gives s(Y3)=1110s(Y_3)=1110. 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 −1-1.

4. Correct a coherent operation on two carriers

Section titled “4. Correct a coherent operation on two carriers”

Prove that U=(X1+iZ2)/2U=(X_1+iZ_2)/\sqrt2 is unitary. Find its two possible syndromes and the corrected logical state. Does this imply correction of X1Z2X_1Z_2?

Solution

X1X_1 and Z2Z_2 commute and square to identity. Hence the cross terms in U†UU^\dagger U cancel, leaving II. On a code state,

U∣ψL⟩=X1∣ψL⟩+iZ2∣ψL⟩2.U|\psi_L\rangle =\frac{X_1|\psi_L\rangle+iZ_2|\psi_L\rangle}{\sqrt2}.

The terms occupy orthogonal sectors with syndromes 00010001 and 01010101. Each outcome has probability 1/21/2. The corresponding corrections yield ∣ψL⟩|\psi_L\rangle and i∣ψL⟩i|\psi_L\rangle, which describe the same state. This argument also preserves entanglement with a reference.

The product X1Z2X_1Z_2 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.

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; YZYIIYZYII 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 n≥k+2(d−1)=5n\geq k+2(d-1)=5. 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 X2Z4X_2Z_4, find the syndrome, correction and residual logical class. Explain the leading 10p210p^2 term for independent depolarizing noise.

Solution

The syndromes 10001000 and 10011001 add to 00010001, so recovery applies X1X_1. The residual is R=X1X2Z4R=X_1X_2Z_4. It commutes with Z‾\overline Z and anticommutes with X‾\overline X, identifying logical Z. In the chosen signs, RV=−VZRV=-VZ.

All weight-two strings similarly leave nontrivial logical Paulis. There are 10×9=9010\times9=90 of them, each with probability (p/3)2(1−p)3(p/3)^2(1-p)^3. Their combined contribution is

90(p/3)2(1−p)3=10p2+O(p3).90(p/3)^2(1-p)^3=10p^2+O(p^3).

Higher-weight strings contribute only at order p3p^3 and above. This establishes the leading term without needing the complete weight table.

  • 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.