|q⟩ Bad Qubits

advanced · Programming · Implementing Error-Correcting Codes

The Five-Qubit Code

The Shor code uses nine physical qubits to protect one logical qubit against an arbitrary single-qubit error. Can we do better? The five-qubit code, discovered by Laflamme, Miquel, Paz, and Zurek in 1996, is the answer: it is the smallest possible code that corrects any single-qubit error. No four-qubit code can.

The quantum Hamming bound

To correct any single-qubit Pauli error on nn qubits encoding kk logical qubits, the distinct error syndromes must fit into the available syndrome space. There are 3n3n single-qubit Pauli errors (XX, YY, ZZ on each of nn qubits) plus the identity, and the code uses nkn - k stabilizer generators giving 2nk2^{\,n-k} syndromes. The quantum Hamming bound requires

(3n+1)2k2n.(3n + 1)\,2^{k} \le 2^{n}.

For k=1k = 1 this reads 3n+12n13n + 1 \le 2^{\,n-1}. The smallest nn satisfying it is n=5n = 5, where 16=1616 = 16 holds with equality. A code meeting the bound with equality is called perfect: every syndrome corresponds to exactly one correctable error, with none wasted. The five-qubit code is the unique smallest perfect code — denoted [[5,1,3]][[5,1,3]]: five physical qubits, one logical qubit, distance three.

Its stabilizers

The code is defined by four stabilizer generators. A common choice is the cyclic set

S1=XZZXI,S2=IXZZX,S3=XIXZZ,S4=ZXIXZ,\begin{aligned} S_1 &= X\,Z\,Z\,X\,I, \\ S_2 &= I\,X\,Z\,Z\,X, \\ S_3 &= X\,I\,X\,Z\,Z, \\ S_4 &= Z\,X\,I\,X\,Z, \end{aligned}

each obtained from the previous one by a cyclic shift of the five qubit positions. The logical codewords are the simultaneous +1+1 eigenstates of all four. Because the generators mix XX and ZZ on the same qubits, the code is not a CSS code (unlike Steane's, in the next lesson) — its XX-type and ZZ-type checks are entangled together.

Why it matters

The trade-off

Perfection in qubit count comes at a price. The five-qubit code lacks the transversal-gate structure that makes CSS codes (Steane, surface) convenient for fault-tolerant computation: most of its logical gates require more elaborate constructions. In practice, codes are chosen for their fault-tolerant gate set and high threshold, not minimal qubit count — which is why the surface code, despite using far more qubits, dominates real devices. Still, as the provably smallest code that does the job, the five-qubit code marks the exact boundary of what quantum error correction can achieve.

Sign in on the full site to ask questions and join the discussion.