Repetition, Bit-Flip, Phase-Flip, and Shor Codes
Before arguing about surface codes and thresholds, you need one code you can trace by hand. This chapter walks the smallest real examples — repetition, bit-flip, phase-flip, and Shor's nine-qubit construction — until encode, corrupt, syndrome, recover is mechanical.
The toy codes deserve study precisely because they are insufficient: each repairs exactly the error its designer allowed, and seeing that boundary clearly is what separates correction from wishful thinking.
By the end of this chapter you will be able to encode a logical qubit in three physical ones, trace a single error through syndrome and recovery, and state exactly which errors each small code cannot touch.
Core concepts: quantum error correction, logical qubits, noise channels.
Redundancy you can trace by hand
Small codes are teaching instruments. They show redundancy, syndrome extraction, and recovery working against a limited error set — concretely enough to simulate in your head. They cannot prove a scalable machine, but they make the logic of quantum error correction mechanical instead of mystical.
The three-qubit bit-flip code encodes and . An arbitrary logical state becomes . Note what this is not: three copies of , which the no-cloning theorem forbids. It is a single entangled state spread across the register. A single bit flip moves the state out of the code space in a way a syndrome can identify.
One code per error type
The error model comes first. The bit-flip channel is what the repetition code is built against, and the syndrome map turns each error pattern into a diagnostic signature.
Bit-flip codes handle -like errors. Phase-flip codes handle -like errors by the same construction in a rotated basis: Hadamard gates turn phase flips into bit flips, the repetition machinery catches them, and Hadamards turn back. Shor's nine-qubit code nests the two — a phase-flip triplet whose three branches are each bit-flip triplets — so any single-qubit error, , , or (which acts as both), lands in a distinct syndrome. That nesting, not a bigger majority vote, is the idea that scales.
Worked example: a flip on the middle qubit
Encode logical zero as . A bit flip strikes the second physical qubit: the register reads . The parity checks report — the signature of a middle-qubit flip — and applying to that qubit returns the word to .
Now the important case: the superposition suffers the same flip and becomes . The same syndrome logic identifies the middle qubit, the same repairs it, and and were never read. The correction acted on the error, not the data — which is the only way it can work.
Where small codes stop
The repetition code protects against a restricted error model, full stop. Real hardware suffers bit-like and phase-like errors, plus leakage out of the qubit subspace, correlated errors across neighbors, measurement errors, and control errors. A code built for one error says nothing about the rest.
The second trap is casual classical language. "Majority vote" suggests measuring all three qubits and taking the popular value — which would collapse the superposition you were protecting. The quantum version extracts syndromes that preserve the logical information, and your vocabulary should say so.
The engineering view
Treat small codes as unit tests for QEC reasoning. Each one exercises the full pipeline in miniature:
- encode
- inject one error
- compute the syndrome
- map the syndrome to a correction
- recover the code space
- state the limitation
The same shape recurs in industrial-scale codes; only the decoder and the geometry get harder. Practice honest limitation language here, where it is cheap: the three-qubit bit-flip code corrects one bit flip under a simplified model. Phase-flip codes protect against Z-like errors via a basis change. Shor's construction handles broader single-qubit errors. None of these statements converts into a claim that near-term hardware is fault tolerant — their value is conceptual and diagnostic.
What this buys you in diligence
A small-code demo is useful evidence when it shows syndrome extraction and recovery under a stated noise model, and weak evidence when marketed as fault tolerance. The questions to ask: which error model is covered, is syndrome measurement repeated, and does logical error improve as the code grows?
For a builder, the step after a toy code is a better experiment, not a bigger claim: inject controlled errors, verify the syndrome classification, include measurement errors, repeat rounds, and track whether the encoded version beats the unencoded one under identical assumptions.
Exercise
Syndrome extraction table. Table-trace the three-qubit repetition code for no error and for each single bit flip.
- Evidence: for each case, record the encoded state, corrupted state, syndrome, correction, and the code's limitation.
- Check: tie the trace back to the bit-flip channel and the syndrome map — every row should be derivable, not memorized.
- Submit: the trace plus a label — teaching code, error-detection evidence, correction evidence, or fault-tolerance evidence — and what extra evidence the next label up would require.
- Repair: if your trace measures the logical state directly and calls it correction, rework it after Chapter 47 (Stabilizers and Syndrome Measurement), which is built around exactly that mistake.
Check your understanding
Without notes: simulate or table-trace a single-bit error and its recovery in the three-qubit repetition code.
Oral defense: explain why is not "three copies" of the logical qubit — and why that distinction is what makes correction possible at all.
If you get stuck
If you cannot keep toy-code correction apart from scalable fault-tolerant evidence, return to Chapter 46 (Error Mitigation vs Error Correction) for the claim categories and Chapter 47 (Stabilizers and Syndrome Measurement) for the extraction mechanism, then re-trace the table.