Three-qubit repetition and phase-flip codes
Protect one restricted error type by parity measurements that preserve the unknown logical amplitudes.
On this page
The question for today
What you’ll understand
- Compute the two-bit syndrome of each single bit flip.
- Explain why parity measurements do not reveal the encoded qubit.
- Derive logical failure probabilities under independent restricted noise.
Classical repetition repairs a corrupted bit by majority vote, but a quantum code must preserve an unknown relative phase as well as populations. The three-qubit repetition construction is a useful first test because its promise is deliberately narrow: it corrects one bit flip when syndrome extraction is ideal. Rotating the basis produces a phase-flip code. Neither construction alone corrects arbitrary single-qubit noise, and their elementary failure polynomial must not be mistaken for a fault-tolerance threshold.
Encode correlations rather than copies
Define the logical basis as and . A controlled encoding maps an unknown input and two initialized ancillas to . It does not produce three copies of the unknown qubit: the encoded state generally has entanglement, and an individual output qubit has lost the input coherence when viewed alone. The information resides in correlations across the block and can remain entangled with a remote reference.
Measure the commuting parities and , rather than measuring each Z separately. Both logical basis states have positive parity, so the check outcomes are independent of the unknown amplitudes. Measuring individual qubits would distinguish the logical basis states and destroy their superposition. An ancilla-assisted parity circuit must therefore record only agreement or disagreement. Its ideal mathematical description projects onto an entire parity sector without resolving states inside that sector.
Read an error location from signs
Report each parity eigenvalue in the fixed order of the two checks. No error gives ; a flip on qubit one gives ; a flip on qubit two gives ; and a flip on qubit three gives . Applying X on the inferred qubit returns the full encoded superposition. The correction works for any amplitudes because it reverses the location error rather than estimating the unknown logical state.
Two bit flips are already ambiguous. Flips on qubits one and two have the same syndrome as a single flip on qubit three. The single-error decoder then applies a third flip, leaving , which exchanges the logical basis states. More fundamentally, a single Z on any physical qubit changes the logical relative phase without changing either parity. The unrestricted quantum distance is therefore one, even though the code has distance three against the restricted X-error family.
Exchange bit and phase roles
Conjugating every physical qubit by Hadamard exchanges X and Z. The transformed code has basis and checks . It corrects one Z error with the same syndrome table. The reason is algebraic: Z exchanges the plus and minus X eigenstates. Calling this a phase-flip code refers to the computational basis, while its parity checks operate in the complementary basis.
A single physical X now acts as a logical phase operation, so changing basis exchanges the weakness rather than removing it. Protecting both types requires a larger construction with compatible complementary checks. Also, the binomial calculation excludes the gates used to collect parities: an ancilla fault can propagate to several data qubits. The next step in code design is to preserve the clean syndrome logic while accounting for the new errors introduced by carrying it out physically.
Work it through
Correct the middle qubit and count failures
The bit-flip code contains . An X error strikes qubit two. Find its syndrome and corrected state. Separately compute block failure for independent X probability .
The corrupted state is . In both terms the first two bits disagree, and the last two bits also disagree, giving syndrome .
That syndrome selects . Applying it maps both terms back, including their relative factor i; no measurement of the logical amplitudes has occurred. The corrected state equals the initial encoded state.
Exactly two errors have probability , and three errors have probability . Adding the disjoint cases gives , under the restricted ideal model.
The middle-qubit correction restores the encoded phase exactly; the separate independent-noise calculation gives a 2.8 percent logical bit-flip probability.
The living notebook
Explore the model
Interactive lab · probability
Count uncorrectable restricted faults
Reset and set success probability and trials . Interpret success as an X error and predict the combined bars for two and three errors to total . For a fresh comparison Reset and set ; predict . Use Step to inspect the highlighted two-error and three-error probabilities. These are exact independent binomial counts, not quantum syndrome extraction or noisy correction.
- Mean · np
- 5
- Variance · np(1−p)
- 2.5
- Total probability
- 1
These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forThe polynomial counts only the explicitly assumed independent data faults and says nothing about circuit faults.
Pause & reason
Check your understanding
Your turn
Try it yourself
In the phase-flip code an error acts on . Find the ordered syndrome and recovery. For independent phase-flip probability , calculate the ideal block failure.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Use X-eigenstate labels as the repetition symbols and retain the check order X-one X-two, then X-two X-three.
Compare with the solution
The corrupted terms have labels and . Their first parity is positive and second parity negative, so the syndrome is and recovery is . It restores both amplitudes. Independently, the probability of two or three Z errors is . A single X remains unprotected, so this result is conditional on the stated phase-only noise.
Keep the idea
Take it with you
- Parity can reveal an error without disclosing the logical state.
- The three-qubit repetition code corrects a restricted error family.
- Its failure polynomial assumes perfect syndrome extraction and independent data faults.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.