Skip to content

9.10

An introduction to quantum error correction

No cloning, no peeking — and yet errors can be corrected: the three-qubit code catches them with choral measurements that ask only about parity, never content; the stabiliser formalism turns the trick into a system, and the surface code and threshold theorem carry it into engineering.

Recommended first

After this section you should be able to

  • State the triple bind facing quantum error correction: no cloning, measurement collapse, and continuous errors
  • Hand-compute the full three-qubit bit-flip code pipeline: encoding, syndrome measurement, lookup-table correction
  • Explain the mechanism by which syndrome measurement leaks no data, and how continuous errors get digitised by measurement
  • Survey the stabiliser formalism and the surface code, and state the threshold theorem's content and magnitudes

Shor’s algorithm demands trillions of gate operations with next to no mistakes, while real hardware has single-gate error rates around 10310^{-3} — nine orders of magnitude apart. Classical computers cleared this hurdle with error correction: keep three copies, let the majority rule. But in the quantum world that old road looks blocked at every turn. What this section presents is one of the most beautiful escapes in this book.

A triple bind

Try transplanting the classical “three copies, majority vote” onto a quantum state χ=α0+β1\ket{\chi}=\alpha\ket{0}+\beta\ket{1} and you slam into three walls at once:

  1. No backups: making three copies of χ\ket{\chi} requires a cloning machine, which section 9.5 proved does not exist;
  2. No peeking: before voting you would have to read out each copy’s value, but measurement collapses α,β\alpha,\beta to 0 or 1 — destroying the data in order to protect it;
  3. Errors are continuous: a classical bit can only flip 0↔1, while a qubit’s errors are arbitrarily small rotations on the Bloch sphere — a turn of 0.010.01 radians is an error too. Are we supposed to keep a correction table for every angle?

Quantum information looks doomed to go unprotected. In 1995, Shor and Steane each found the hidden door, and it takes two keys: replace copying with entanglement, and replace peeking with measurements that ask only about relationships, never about content.

The three-qubit bit-flip code: the full pipeline by hand

Start with a simplified problem: suppose the channel only applies XX (a bit flip) to each qubit independently with probability pp, and set phases aside for now.

Encoding — entangle, don’t clone. Two CNOTs spread χ\ket{\chi} across three qubits:

|χ⟩ ──●──●──      α|0⟩+β|1⟩
      │  │
|0⟩ ──⊕──┼──  ⟹   α|000⟩ + β|111⟩

|0⟩ ─────⊕──
χˉ=α000+β111(9.10.1)\ket{\bar\chi}=\alpha\ket{000}+\beta\ket{111}\tag{9.10.1}

Note that this is not three copies χ3\ket{\chi}^{\otimes3} (that would require cloning) but a GHZ-type entangled state: one piece of data spread across three-party correlations — section 9.3’s “information lives in the correlations” turns, for the first time, from an obstacle into a shield.

Is this insurance worth its premium? After encoding, an error survives only if at least two qubits flip at once:

plogical=3p2(1p)+p3=3p22p3(9.10.4)p_{\text{logical}}=3p^2(1-p)+p^3=3p^2-2p^3\tag{9.10.4}

At p=0.1p=0.1 we get plogical=0.028p_{\text{logical}}=0.028 — the error rate drops to roughly a quarter. As long as p<12p<\tfrac12 the encoding is a net win, and the smaller pp is, the bigger the win (p2p^2 versus pp).

From three qubits to stabilisers: one language

The three-qubit code guards against XX but not ZZ: a phase flip turns α000+β111\alpha\ket{000}+\beta\ket{111} into α000β111\alpha\ket{000}-\beta\ket{111}, both parity checks glow green, and the error slips away. The countermeasure is not hard to guess: in the Hadamard-rotated basis (±\ket{\pm}), a ZZ error is an XX error, so wrap another three-qubit code around the first. Shor’s nine-qubit code of 1995 is exactly this two-layer nesting (inner layer correcting XX, outer layer correcting ZZ), the first proof that any single-qubit error can be corrected.

Distil this playbook into a general language and you have the stabiliser formalism: a code is defined by a set of mutually commuting Pauli-string operators {Si}\{S_i\} (the stabilisers), and the code space is their common +1+1 eigenspace:

Siχˉ=+χˉi(9.10.5)S_i\ket{\bar\chi}=+\ket{\bar\chi}\quad\forall i\tag{9.10.5}

The three-qubit code’s stabilisers are simply Z1Z2Z_1Z_2 and Z2Z3Z_2Z_3. The error-correction cycle now acquires a standard rhythm: measure all stabilisers repeatedly → read the syndrome → infer the error → correct. If an error operator EE anticommutes with some SiS_i, that stabiliser’s readout flips to 1-1 and the syndrome lights up — a well-designed code makes different errors light up different combinations of lamps. With nn physical qubits and nkn-k independent stabilisers, a 2k2^k-dimensional code space remains, encoding kk logical qubits; how heavy an error can be corrected is set by the code distance dd: up to (d1)/2\lfloor(d-1)/2\rfloor errors.

A bird’s-eye view of the surface code and the threshold theorem

Real hardware imposes one more hard constraint: qubits sit on a chip and can only interact with their neighbours. The surface code is the star scheme born for exactly this, and a bird’s-eye view takes three strokes:

  • Layout: qubits tile a two-dimensional chessboard, data qubits alternating with measurement ancillas; each stabiliser involves only four neighbouring data qubits (one kind checks XX parity, the other ZZ parity), so every check is local.
  • The error-correction picture: errors leave paired “lit lamps” as endpoints on the board, like footprints in snow; a decoder (a classical algorithm) pairs up the lamps and guesses the error chains. Only when errors join into a long chain spanning the board (length about dd, the board’s side) does the logical information get hurt — and a big board makes that exponentially unlikely.
  • Cost-effectiveness: it tolerates physical error rates up to about 1%1\% (an extremely forgiving threshold, kind to hardware), at the price of low data density: one logical qubit costs on the order of d2d^2 — hundreds to thousands of physical qubits at practical parameters. Section 9.9’s conversion “thousands of logical ⇒ millions of physical” comes from exactly here.

Holding it all up is the threshold theorem:

As long as the physical error rate pp is below some threshold pthp_{\text{th}} (which depends on the code and the noise model; about 10210^{-2} for the surface code), increasing the code distance drives the logical error rate arbitrarily low: plogical(p/pth)(d+1)/2p_{\text{logical}}\sim(p/p_{\text{th}})^{(d+1)/2}, while the resource overhead grows only polynomially with the target precision.

This theorem is the foundation of the entire quantum-computing industry: it declares that “good enough” is a finite bar, not an infinite demand. In 2023–2024, teams at Google and Harvard/QuEra demonstrated, one after another, the key milestone that “larger code distance really does lower the logical error rate” — error correction stepped from theorem into data.

What comes next

All chapter long we have been sparring with a villain who never quite shows his face: errors, decoherence, noise. Error correction tells us how to beat him, but never once asked — who is he, exactly? Why does a qubit left completely alone develop errors on its own? Why do errors favour the ZZ (phase) direction? Why do “measurement” and “noise” look so much alike? Answering these questions means leaving the comfort zone of “isolated system + unitary evolution” and letting the environment take the stage at last: the system no longer owns a state vector of its own, only a density matrix; evolution is no longer unitary, but the Lindblad equation. Next chapter — open quantum systems: where noise comes from, and how the quantum world turns classical before our eyes.

Section 74 of 106 · use to turn the page