The Three-Qubit Bit-Flip Code
Classical computers guard data against hardware faults by repeating bits: instead of storing 0,
a hard drive stores 000, and a majority vote corrects any single bit flip. The quantum world is
more constrained — we cannot clone an unknown state, and measuring to check for errors would
collapse the superposition we are trying to protect. Yet the spirit of repetition still works, at
least for one type of noise.
Errors in quantum channels
A bit-flip error is a Pauli acting on a qubit without our knowledge:
If we store in a single physical qubit, one such error scrambles the information irreversibly. The three-qubit bit-flip code spreads the logical information across three physical qubits so that any single error can be detected and corrected by syndrome measurement.
Logical codewords
Define the logical basis states:
An arbitrary logical qubit then becomes
The encoding circuit
Start with qubit and ancilla qubits . Two CNOT gates — each controlled on — propagate 's computational-basis value to the ancillas:
The result is exactly .
Why does this not violate no-cloning? Because the circuit does not copy and — it creates an entangled state in which both amplitudes are still encoded together. There is no way to extract from any single qubit without disturbing the others.
Error correction (preview)
After a potential bit-flip channel, we measure two parity checks — comparisons between pairs of qubits — without ever touching the logical information:
| Syndrome (, ) | Error | |---|---| | 00 | None | | 10 | Flip on | | 11 | Flip on | | 01 | Flip on |
The syndrome tells us which qubit flipped, so we apply a corrective to that qubit and the logical state is restored. The amplitudes and are never revealed.
Try it
Prepare qubit 0 in (so both logical codewords are equally weighted), then apply the two CNOT gates to encode it. The encoded state should be . The grader checks the full statevector.
After running, inspect the Statevector panel: only amplitudes and should be non-zero, each with magnitude .
Sign in on the full site to ask questions and join the discussion.