The 3-qubit bit-flip repetition code is the simplest possible quantum error correcting code. It can correct one bit-flip error (but not phase-flip errors, we’ll get to that). It’s the “hello world” of quantum error correction and the clearest way to see how the tricks work.
The encoding
We take one logical qubit in state and encode it as a 3-qubit state:
Notice: this is not three copies of . That would be , which expands to eight terms and is forbidden by no-cloning anyway. What we have is an entangled state where the three physical qubits are correlated — and that correlation is what protects the logical information.
The encoding is done with a simple circuit: start with , apply CNOT from qubit 0 to qubit 1, then CNOT from qubit 0 to qubit 2. The result is .
The correction
Suppose a bit-flip error hits qubit 1 (an unwanted gate). The state becomes:
We want to detect which qubit was flipped without learning or — if we learn those, we collapse the logical state and destroy it.
The trick: measure syndromes. Specifically, measure the two operators and (the product of two operators). These measurements don’t tell you the value of any individual qubit; they only tell you parity — whether two specific qubits agree or disagree.
Here’s the syndrome table:
| Error | Diagnosis | ||
|---|---|---|---|
| No error | Nothing to fix | ||
| on qubit 0 | Apply to qubit 0 | ||
| on qubit 1 | Apply to qubit 1 | ||
| on qubit 2 | Apply to qubit 2 |
Each single-qubit error produces a distinct syndrome, and the syndrome can be measured without disturbing the logical state. Apply the appropriate correction, and the logical qubit is restored — the errors have been corrected.
Try it
Pick an error to inject. Watch the 3-qubit state change. Then jump to the “Corrected” stage and watch the state return to its original form. The logical information never leaked; the correction was applied blindly based only on the syndrome.
What the code can and can’t do
Can do:
- Correct any single bit-flip error.
- Detect (but not correct, alone) double bit-flip errors — the syndrome tells you something is wrong, but not what.
Can’t do:
- Correct phase-flip () errors. A error on qubit transforms . The syndrome measurements produce the same result as no-error, because errors don’t affect the parities and . The code is completely blind to phase errors.
The symmetric situation applies if you use a phase-flip repetition code (encoding in the basis instead of the basis) — it corrects errors but not errors.
Why this matters
The 3-qubit code is the simplest working example of the “syndrome measurement” technique, which is the fundamental idea behind all quantum error correction. Every more sophisticated code — the Shor code, the Steane code, the surface code — uses the same pattern:
- Encode logical qubits into entangled multi-qubit states within a carefully chosen “codespace.”
- Repeatedly measure specific parity-like operators that detect errors without touching the logical state.
- Apply corrections based on the syndrome.
The difficulty is building codes that handle all single-qubit errors (not just bit-flips) and scale to large logical qubits. The 3-qubit code is a stepping stone; the next lesson introduces codes that handle both bit-flip and phase-flip errors simultaneously.
What’s next
The Shor and Steane codes handle both bit-flip and phase-flip errors by concatenating two repetition codes. The basic idea: encode into a phase-flip code, then encode each qubit of that into a bit-flip code. The result uses more physical qubits per logical qubit, but catches all single-qubit errors.