Pricing…Open Lab
Chapter 04 of 10 · ~34 min

The Bit-Flip Code

The three-qubit bit-flip code stores one logical qubit as α|000⟩ + β|111⟩. It spots any single X error (bit flip) with a majority vote and undoes it exactly. It gets back the original amplitudes, not just the odds. In this chapter you run the whole cycle — encode, add an error, correct — on three qubits. You trace every prediction by hand first.

What is the three-qubit bit-flip code?

The oldest trick for sending messages is repetition. Picture a bad phone line. You say "yes, yes, yes." If one word gets garbled, the other two outvote it. Last chapter proved we can't do that directly with qubits. An unknown qubit state cannot be copied. But the same chapter showed the way out: spread the state across several qubits with entanglement instead of copying it.

The three-qubit bit-flip code puts that idea into practice. It is small enough to run from start to finish, right here. Two terms first:

  • A logical qubit is the unit of information we are protecting.
  • A physical qubit is one real piece of hardware. See physical vs logical qubits.

Here, one logical qubit lives in three physical qubits. The state α|0⟩ + β|1⟩ is encoded as α|000⟩ + β|111⟩. α and β are the state's amplitudes. These are the weights on 0 and 1. Their squares give the chances of each result when you measure.

Where does the phone-line picture break? On the phone, each "yes" is a full copy. Here, no single qubit holds a copy of α and β. The information lives in all three together.

The goal for this chapter: encode → add a bit-flip error → correct it → check that the original amplitudes come out exactly. Not roughly — exactly. And "check" means comparing run counts to numbers you predicted by hand.

What the rest of this chapter covers
  1. Worked example: which test state can we verify?
  2. How do you spread one qubit across three?INTERACTIVE
  3. How do you take a majority vote without looking at the data?
  4. What happens when you break q1 and then fix it?INTERACTIVE
  5. What if the error hits the data qubit itself?INTERACTIVE
  6. How much protection did three qubits buy?
  7. Has the bit-flip code run on real hardware?
Keep learning with Pro

You’ve read the opening of chapter 4. Pro unlocks the other 7 sections — plus every chapter of every course, with circuits you can run right on the page. That’s $11.99 a month, about the price of a coffee, or $99.99 a year (save 30%). The first chapter of every course, and the whole math course, stay free.

Start learning with ProSee plansRead chapter 1 free
The Bit-Flip Code · QPU137