research30 min studyLesson 432 in Physics

Three-qubit repetition and phase-flip codes

Protect one restricted error type by parity measurements that preserve the unknown logical amplitudes.

On this page

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 ∣0L⟩=∣000⟩|0_L\rangle=|000\rangle and ∣1L⟩=∣111⟩|1_L\rangle=|111\rangle. A controlled encoding maps an unknown input and two initialized ancillas to α∣000⟩+β∣111⟩\alpha|000\rangle+\beta|111\rangle. 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 Z1Z2Z_1Z_2 and Z2Z3Z_2Z_3, 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.

∣ψL⟩=α∣000⟩+β∣111⟩,∣α∣2+∣β∣2=1,S1=Z1Z2,S2=Z2Z3|\psi_L\rangle=\alpha|000\rangle+\beta|111\rangle,\quad |\alpha|^2+|\beta|^2=1,\qquad S_1=Z_1Z_2,\quad S_2=Z_2Z_3
Alpha and beta are dimensionless logical amplitudes. These checks describe ideal projective parity measurements on three two-level systems.↔ Scroll wide equations horizontally.

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 X1X2X3X_1X_2X_3, 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.

Pfail=(32)p2(1−p)+p3=3p2−2p3P_{\mathrm{fail}}=\binom32p^2(1-p)+p^3=3p^2-2p^3
This exact dimensionless failure probability assumes independent X errors with probability p on each data qubit, perfect encoding/checks/correction, and a decoder that corrects every single X error.↔ Scroll wide equations horizontally.

Exchange bit and phase roles

Conjugating every physical qubit by Hadamard exchanges X and Z. The transformed code has basis ∣+++⟩,∣−−−⟩|+++\rangle,|---\rangle and checks X1X2,X2X3X_1X_2,X_2X_3. 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.

HXH=Z,HZH=X,∣0L′⟩=∣+++⟩,∣1L′⟩=∣−−−⟩H X H=Z,\qquad H Z H=X,\qquad |0_L'\rangle=|+++\rangle,\quad |1_L'\rangle=|---\rangle
H is the dimensionless unitary Hadamard. Basis conjugation changes which physical Pauli family is correctable but does not supply full single-qubit error correction.↔ Scroll wide equations horizontally.

Correct the middle qubit and count failures

The bit-flip code contains (∣000⟩+i∣111⟩)/2(|000\rangle+i|111\rangle)/\sqrt2. An X error strikes qubit two. Find its syndrome and corrected state. Separately compute block failure for independent X probability p=0.10p=0.10.

  1. The corrupted state is (∣010⟩+i∣101⟩)/2(|010\rangle+i|101\rangle)/\sqrt2. In both terms the first two bits disagree, and the last two bits also disagree, giving syndrome (−,−)(-,-).

  2. That syndrome selects X2X_2. 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.

  3. Exactly two errors have probability 3(0.10)2(0.90)=0.0273(0.10)^2(0.90)=0.027, and three errors have probability 0.0010.001. Adding the disjoint cases gives Pfail=0.028P_{\mathrm{fail}}=0.028, under the restricted ideal model.

The result

The middle-qubit correction restores the encoded phase exactly; the separate independent-noise calculation gives a 2.8 percent logical bit-flip probability.

Explore the model

Interactive lab

Interactive lab · probability

Count uncorrectable restricted faults

Reset and set success probability p=0.10p=0.10 and trials n=3n=3. Interpret success as an X error and predict the combined bars for two and three errors to total 0.0280.028. For a fresh comparison Reset and set p=0.20,n=3p=0.20,n=3; predict 0.1040.104. 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.

Count uncorrectable restricted faultsThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

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.

Check your understanding

Why may ideal repetition-code parity checks preserve an unknown encoded superposition?

Try it yourself

In the phase-flip code an error Z3Z_3 acts on α∣+++⟩+β∣−−−⟩\alpha|+++\rangle+\beta|---\rangle. Find the ordered syndrome and recovery. For independent phase-flip probability 0.200.20, 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 Z3Z_3. It restores both amplitudes. Independently, the probability of two or three Z errors is 3(0.20)2(0.80)+(0.20)3=0.096+0.008=0.1043(0.20)^2(0.80)+(0.20)^3=0.096+0.008=0.104. A single X remains unprotected, so this result is conditional on the stated phase-only noise.

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.