Number the wires from top to bottom as . The first two controlled-NOT gates encode into the bit-flip repetition code
on data wires . The lower two zero ancillas store an error syndrome. Reading the PDF's four detection CNOTs gives
The syndrome and the data qubit to be flipped are therefore
This is coherent syndrome extraction for the three-qubit repetition code. The recovery Toffoli gates implement these conditions; the intervening Pauli X gates temporarily turn zero-valued controls into one-valued controls and then restore the syndrome wires. Finally, inverse encoding returns the logical state to the top wire and resets data wires 2 and 3 to zero.
For the specified error , the encoded data becomes . Both terms have syndrome , so detection factors out without revealing the logical amplitudes. Recovery flips data wire 1, restoring , and decoding yields
The lower four wires need not all return to zero: their syndrome record is independent of the logical state, which is what the correction requirement needs.
A syndrome determines a phase-error set only up to multiplication by : an error of weight and its complement of weight have the same error syndrome. Their probability ratio is
For , maximum likelihood therefore chooses the representative of smaller weight. This is exactly majority-vote decoding of a repetition code: correction succeeds when fewer than half the qubits are flipped, with a random tie-break at when is even.
If , then and . For every fixed , the distance from the mean to the decision boundary in standard deviations is
Thus the logical failure probability tends to zero, in fact exponentially by a Chernoff bound. At the two representatives are equiprobable and decoding cannot improve with . Hence
Measure each generator . If a Pauli error has occurred, its outcome is , where
The bit vector is the error syndrome. Choose one representative with this syndrome. Another Pauli has the same syndrome exactly when commutes with every , namely when . Therefore
This stabilizer-syndrome coset is all the syndrome reveals: multiplication by a stabilizer changes nothing on the code, while multiplication by an element of can change the logical state without changing any syndrome bit.
The six displayed generators of the Steane code are independent and commuting, so the common positive eigenspace has dimension
it encodes one logical qubit. The binary columns of the underlying Hamming parity-check matrix are all nonzero and distinct. Hence no weight-one or weight-two Pauli lies in the stabilizer normalizer outside the stabilizer. On the other hand,
is logical, and multiplying it by gives the weight-three representative
The analogous statement holds for , so
Now include both and in the proposed error set. Their product is
which is non-scalar on the code and violates the Knill--Laflamme condition. Since multiplying by a logical operator does not change commutation with stabilizers, and have the same error syndrome. A decoder cannot know which occurred and may apply a correction that leaves a logical error.
Quantum error correction encodes a logical qubit into a larger Hilbert space, diagnoses a specified error family with an error syndrome, and reverses it without learning the protected logical amplitudes. It must preserve arbitrary superpositions, not just distinguish two classical codewords.
The bit-flip repetition code encodes
Measure the commuting stabilizer generators and using ancillary qubits. Their outcomes reveal the parity relations, with the three-qubit bit-flip syndrome table
Both codewords have the same parity checks, so the syndrome does not reveal or . For example, the error produces ; applying restores the encoded superposition. A coherent combination of correctable errors is also recoverable after the syndrome is recorded in an ancilla, by linearity.
This three-qubit code corrects one bit flip, not every one-qubit error. A physical changes the relative logical phase without a nontrivial bit-flip syndrome. General single-qubit noise is a linear combination of ; protecting arbitrary single-qubit errors therefore needs a code such as the Shor code, the Steane code or the five-qubit code, with the corresponding enlarged syndrome structure.
The general exact-recovery criterion is the Knill--Laflamme condition. For code projector and error operators , there must be constants such that
It expresses that the syndrome information can depend on the error but not on the logical state. Encoding entangles several physical qubits; it does not create independent copies of an unknown input, so it respects the no-cloning theorem. Fault-tolerant implementations must also prevent noisy syndrome extraction and recovery gates from spreading an initially correctable error into an uncorrectable one.
Quantum error correction Created 2026-09-24 Updated 2026-10-18
Quantum error correction protects a logical qubit by encoding its quantum state into a larger Hilbert space, where a specified family of physical errors can be diagnosed and reversed by a common recovery quantum channel. The requirement is to restore every encoded quantum superposition, including its relative phase, rather than only the computational basis states. A quantum error-correcting code specifies which errors have this protection; it does not promise recovery from every possible disturbance.
The beautiful idea is to measure relations between physical qubits that reveal an error syndrome while revealing nothing about the protected logical qubit. For example, the bit-flip repetition code compares neighboring qubits without reading their individual values. Its parity checks can locate one Pauli X gate error while leaving the unknown coefficients intact. Encoding is a linear isometry, consistent with the no-cloning theorem: redundancy in a shared quantum state supplies protection without making independent copies of the unknown input.
Peter W. Shor's 1995 paper [ref], published on 1 October, introduced the nine-qubit Shor code to reduce quantum decoherence in memory. Andrew M. Steane's [ref], published on 29 July 1996 and [ref], connected quantum error correction to classical linear codes; the seven-qubit Steane code protects against arbitrary errors on one physical qubit. These constructions protect relative phase as well as computational basis values, going beyond the elementary bit-flip repetition code.
For an authored account of the mechanism, see John Preskill's [ref], especially section 7.1 on collective parity measurements and section 7.9 on stabilizer codes. Andrew Steane's A tutorial on quantum error correction develops the distinction between correcting a stored quantum state and operating with imperfect quantum gates.
Quantum error detection 2026-10-14
A code with orthogonal projector detects an error when its compression to the code is scalar. A projective measurement of then either flags departure from the code or, on a successful code-space outcome, leaves the logical state unchanged up to normalization. This includes harmless scalar errors, even though they need not produce a nonzero error syndrome. Detectability extends by linearity to the span of a set of errors. Every Pauli operator of weight less than the quantum code distance is detectable.
Stabilizer code Created 2026-09-24 Updated 2026-10-14
A stabilizer code is the common eigenspace of a stabilizer group , an abelian subgroup of the Pauli group excluding . Choose independent stabilizer generators on physical qubits. They are commuting Hermitian operators, each squaring to . The stabilizer subspace and its orthogonal projector are
The stabilizer-projector formula gives , so logical qubits remain. Independent here means that no nonempty product of the chosen stabilizer generators is . Excluding is necessary: a vector cannot simultaneously be fixed by and unless it is zero.
For the three-qubit bit-flip repetition code, take and , with the Pauli Z gate on site and identities elsewhere. The stabilizer group is . Both stabilizer generators have eigenvalue exactly on the span of and , giving dimensions for one logical qubit. A projective measurement of these checks distinguishes four orthogonal two-dimensional sectors rather than eight individual computational basis states.
A Pauli error that anticommutes with a stabilizer generator changes that check's sign, producing an error syndrome. A Pauli operator commuting with every check can still act on the logical qubits; the centralizer of a stabilizer group describes these possibilities. Thus the number of checks determines the encoded dimension, while the quantum code distance determines protection against arbitrary local errors. The five-qubit error correcting code, for instance, has four stabilizer generators and quantum code distance three; the three-qubit bit-flip repetition code has two checks but quantum code distance one because a single phase flip is unflagged. [ref].
Steane code Created 2026-09-24 Updated 2026-09-28
The Steane code is a seven-qubit CSS stabilizer code encoding one logical qubit with distance three.
Surface code Created 2026-09-24 Updated 2026-09-24
The surface code is a topological stabilizer code whose electric and magnetic excitations are bosons with mutual-semion braiding.
Measure the commuting stabilizer generators and in that order. Use error syndrome bit for eigenvalue and bit for eigenvalue . For the Pauli X gate on physical qubit , every row holds for arbitrary normalized . This ordered parity-check convention follows [ref]:
ErrorState before recovery eigenvaluesError syndromeRecovery
Each pair of computational basis words within a row has the same two parities. Consequently the projective measurement reveals the row without distinguishing its two amplitudes. For example, becomes under . Both checks give with probability one, and applying restores both coefficients exactly, including the relative phase .
One implementation uses two quantum ancillas initialized to . Two controlled-NOT gates from data qubits 1 and 2 to the first quantum ancilla write their parity; two more from data qubits 2 and 3 to the second quantum ancilla write the other parity. Measuring only the quantum ancillas in the computational basis gives . Measuring the individual data qubits instead would reveal the encoded computational basis value and destroy the unknown quantum superposition. The existing coherent syndrome extraction for the three-qubit repetition code uses the alternative ordered checks , so its bit labels differ from this table.
Figure 1.
Parity checks identify a bit flip without reading the logical amplitudes
. Details.
The recovery also handles coherent errors. Put . Their images of the code are mutually orthogonal, giving , the Knill--Laflamme condition for this family. For any linear combination , its component in sector is . Measuring that error syndrome has probability on the normalized erroneous state, and recovery returns . More generally one recovery quantum channel corrects every noise quantum channel whose Kraus operators belong to this span. The assumption concerns the whole jointly correctable family; it does not extend to the span of arbitrary single-site Pauli errors. [ref].
A fully computed coherent example is the unitary operator . At it gives
The error syndromes and occur with probabilities and , independently of . Doing nothing for and applying for restores the same logical qubit in both branches; the scalar in the second branch is an irrelevant global phase. This is an example of linearity of coherent quantum error correction, rather than an assumption that the original error was a classical random bit flip.
Suppose the first ancilla records parity , then a fault of value flips , and the second ancilla records parity . For incoming bit-error pattern , the observed error syndrome is the displayed pair, while the final data error before recovery is . When , the observed syndrome differs from the actual data syndrome by . Applying the usual minimum-weight recovery leaves a nonzero syndrome, so the state is outside the code space even when the channel itself made no error. This is a timing-dependent failure of this simple extraction circuit, not a general obstruction to fault-tolerant quantum error correction.