Noise and the three-qubit code: when do extra qubits help?
Flip a qubit yourself and see how two checks find it, then race one qubit against three.
Background: Why qubits are so fragile.
Check yourself
After the noise the three qubits read 011. What do the checks report, and what does the fix do?
Answer
Check A: disagree. Check B: agree. That points at qubit 1, so the fix flips it and the three read 111. If the stored value was 1 and one qubit flipped, that's right. If it was 0 and two flipped, it's now wrong. The checks can't tell which.
Each qubit flips with a 20% chance. Does the three-qubit code help?
Answer
Yes, but less than at lower flip chances: it's wrong 10.4% of the time instead of 20%, about half. At 1% it's wrong 0.0298% of the time instead of 1%, more than thirty times better.
Why isn't this a complete quantum error-correcting code?
Answer
It can't see sign flips. After one, both checks still report "agree", yet the stored blend has changed. A complete code needs checks for both kinds of error. (And on this page the checks themselves never fail, which real ones do.)
A recall question on majority voting and quantum error correction is in Why qubits are so fragile.
Show the maths
- Each qubit flips with chance p, independently. With three qubits there are eight flip patterns. No flip: (1 − p)³. Exactly one flip: 3p(1 − p)². Exactly two: 3p²(1 − p). All three: p³.
- The checks and the fix repair every pattern with no flip or one flip, and turn every pattern with two or three flips into the wrong stored value.
- Chance the code is wrong: 3p²(1 − p) + p³ = 3p² − 2p³. At p = 0.1: 0.027 + 0.001 = 0.028.
- Break-even: 3p² − 2p³ = p when p = 0, ½ or 1. In between 0 and ½ the code's chance is the smaller one; between ½ and 1 it's the larger.
- The sign flip in Part 1: the blend is (|000⟩ + |111⟩)/√2. A Z on any one qubit gives (|000⟩ − |111⟩)/√2. In both kets all three digits agree, so both checks report "agree" with certainty.
- Undoing the spreading (two CNOTs controlled by qubit 1) leaves qubit 1 as (|0⟩ + |1⟩)/√2 or (|0⟩ − |1⟩)/√2, with qubits 2 and 3 back at 0.
- H then turns those into |0⟩ and |1⟩: a reading of 0 every time without the sign flip, 1 every time with it.
What this page leaves out
- Faulty checks. Here the checks and the fixes never fail. Real checks use helper qubits and gates that make errors of their own, so a real code also has to cope with wrong check results.
- How real errors behave. Here every qubit flips with the same chance, independently, in a single round. Real errors differ from qubit to qubit, can be linked, and build up over many rounds of checking.
- Other kinds of error. A whole flip is the simplest. Real qubits also suffer sign flips (Part 1) and small partial turns, and a useful code has to handle them all.
- Real thresholds. The 50% break-even belongs to this toy model. A real code's threshold depends on the code, the method that interprets the check results and the noise, and it is far lower than 50%: the qubits and their operations have to be much better than that before a bigger code helps (Why qubits are so fragile).
- Copying. The three qubits aren't three copies of a qubit: an unknown qubit state can't be copied. The stored blend is one state spread across three qubits. For a plain 0 or 1, as in most of this lab, that looks the same as three copies of a bit, which is why this code is the usual first example. It isn't a complete quantum code: its checks can't see sign flips (Part 1).
- It's a calculation, not an experiment. The page works out each chance exactly and draws each round with an ordinary random number generator. Nothing runs on a quantum computer.
Where to go next
- What the protected unit is called, and how many physical qubits one takes: What is a logical qubit?
- The full story of noise, checks and thresholds: Why qubits are so fragile.
- Why a sign matters even though no single reading shows it: Interference: split, turn, recombine.
The page runs entirely in your browser. Your flips and your results aren't stored, and this page's own code doesn't send them anywhere. Cloudflare Web Analytics runs on every Plain Quantum page and measures how each page loads and responds, including to clicks and key presses; see Privacy. The model is tested automatically: every flip pattern, every chance and the sampling are checked against an exact calculation.
Sources and further reading
Tags show the kind of source (how sources are chosen and checked). Spotted an error? Report a correction.
- BookQuantum Computation and Quantum Information (10th anniversary edition)Michael Nielsen and Isaac Chuang, Cambridge University Press, 2010
- Peer-reviewed paperQuantum Computing in the NISQ era and beyondJohn Preskill, Quantum, 2018
- ExperimentQuantum error correction below the surface code thresholdGoogle Quantum AI and collaborators, Nature, 2024