PricingOpen Lab
Chapter 04 of 10 · ~34 min

The Bit-Flip Code

The three-qubit bit-flip code stores one logical qubit as α|000⟩ + β|111⟩, detects any single X error by a majority vote, and undoes it exactly — recovering the original amplitudes, not just their probabilities. This chapter runs the entire encode–error–correct cycle coherently on three qubits, with every prediction traced by hand first.

What is the three-qubit bit-flip code?

The oldest trick in classical communication is repetition: send every bit three times, and if one arrives flipped, the other two out-vote it. Last chapter proved we cannot do that literally — an unknown qubit state cannot be copied. But it also showed the escape: spread the state across several qubits with entanglement instead of copying it.

The three-qubit bit-flip code is that escape made concrete, and it is small enough to run end to end right here. One logical qubit — the unit of information we are protecting — is stored in three physical qubits (the distinction is drawn carefully in physical vs logical qubits): the state α|0⟩ + β|1⟩ is encoded as α|000⟩ + β|111⟩. Here α and β are the state's amplitudes — the weights on 0 and 1 whose squared magnitudes are the measurement probabilities.

The full mission for this chapter: encode → inject a bit-flip error → correct it → verify that the original amplitudes come out exactly. Not approximately — exactly. And "verify" means checking run counts you predicted by hand.

Continue this chapter

You’ve read the opening of chapter 47 more sections follow, with worked examples and circuits you can run on the page. A free account unlocks every chapter of every course (paid plans aren’t live yet — early readers get everything free).

Create a free accountAll chaptersStart with the free chapters
The Bit-Flip Code · QPU137