Shor's Nine-Qubit Code and Beyond
Shor's nine-qubit code was the first code to protect a qubit against any single-qubit error. It nests the three-qubit phase-flip code around three copies of the three-qubit bit-flip code, and it works because every possible single-qubit error — even a tiny analog rotation — behaves, once the parity checks act, like one of just four discrete cases: no error, a bit flip (X), a phase flip (Z), or both (XZ).
Why isn't one three-qubit code enough?
In this course you have built two codes. The three-qubit bit-flip code catches bit flips — errors that act like an unwanted X gate, swapping |0⟩ and |1⟩. The three-qubit phase-flip code catches phase flips — errors that act like an unwanted Z gate, flipping the sign between the |0⟩ and |1⟩ parts of a superposition (a state that is partly |0⟩ and partly |1⟩ at once). Each code is blind to the other error type: a Z passes straight through the bit-flip code, and an X passes straight through the phase-flip code.
Real hardware produces both kinds at once. Energy decay and dephasing — the T1 and T2 processes from why qubits fail — do not politely restrict themselves to one axis. So a useful code must handle an arbitrary single-qubit error: any unwanted change to one qubit, including partial rotations that are neither a full X nor a full Z.
In 1995 Peter Shor published the first such code. It uses nine physical qubits to protect one, and its trick — nesting one code inside another — is called concatenation. Before we get to the nine qubits, we have to defuse the objection every engineer raises first.
You’ve read the opening of chapter 6 — 7 more sections follow, with worked examples and circuits you can run on the page. A free account unlocks every chapter of every course (paid plans aren’t live yet — early readers get everything free).