The repetition code
Real qubits are fragile. Stray fields, heat and imperfect control all disturb them, and a long computation will fail unless those errors are found and fixed while it runs. This lesson builds the simplest scheme that does so.
It assumes you know the material in the Quantum Information track up to entanglement.
How classical computers do it
Section titled “How classical computers do it”To send a bit down a noisy line, send it three times: 0 becomes 000 and 1 becomes 111. If one copy is flipped on the way, say 000 arrives as 010, the receiver takes a majority vote and recovers 0. The scheme fails only if two or more copies flip, which is much less likely than one.
Three reasons this should not work for qubits
Section titled “Three reasons this should not work for qubits”Suppose we want to protect an unknown state .
- We cannot copy it. The no-cloning theorem says there is no operation that turns an unknown into .
- We cannot look at it. A majority vote means reading the bits, and measuring a qubit destroys its amplitudes.
- Errors are not just flips. A qubit can be rotated by any small amount, so there seem to be infinitely many errors to fix.
Until the mid-1990s many physicists suspected these made quantum error correction impossible. Each one has a way around it, and the three-qubit code shows the first two.
Encoding without copying
Section titled “Encoding without copying”We do not copy the state. We spread it across three qubits:
Compare this with three copies, which would be and contain terms like . The encoded state has only two terms. It is one entangled state of three qubits, and no-cloning is not violated.
In the puzzle the top qubit holds the state to protect, here , and the other two start in .
The input is on the top wire. Encode it as .
This puzzle needs JavaScript.
Hint
You made a GHZ state in the entanglement lesson. Copy the top qubit's bit value onto each of the others.
The same two CNOTs encode every input state, because the circuit is linear: goes to and goes to .
Finding the error without looking
Section titled “Finding the error without looking”Now suppose a bit flip, an gate, hits the middle qubit. The state becomes
We need to learn which qubit flipped without learning anything about and . The trick is to ask only whether neighbouring qubits agree:
- Do qubits 0 and 1 hold the same value?
- Do qubits 1 and 2 hold the same value?
In the damaged state above, both terms give the same answers: no and no. Because the answers do not depend on which term we are in, measuring them does not disturb the superposition. These two answers are called the syndrome.
To measure a parity, add an extra qubit in , called an ancilla, and CNOT both data qubits onto it. The ancilla ends up as 1 exactly when the two data qubits differ.
The three data wires hold an encoded state in which one qubit has been flipped. Make the fourth wire record whether data 0 and data 1 differ, and the fifth wire record whether data 1 and data 2 differ. You are shown one particular error, but your circuit is also tested with the flip on each other qubit and with no flip at all.
This puzzle needs JavaScript.
Hint
Each ancilla is the target of two CNOTs. The fourth wire needs data 0 and data 1 as controls.
Look at the final state. Both terms end in 11, so measuring the two ancillas gives 11 with certainty, and the three data qubits are left exactly as they were. The syndrome tells us what to fix:
| Syndrome | Meaning | Correction |
|---|---|---|
| 00 | No flip | Nothing |
| 10 | Qubit 0 differs from the others | on qubit 0 |
| 11 | Qubit 1 differs from both neighbours | on qubit 1 |
| 01 | Qubit 2 differs from the others | on qubit 2 |
An encoded state has become . Which qubit was flipped?
Both terms have the first two bits equal and the last one different, so the syndrome is 01 and the flip is on qubit 2.
Read the state, work out where the error is, and repair it.
This puzzle needs JavaScript.
What about small errors?
Section titled “What about small errors?”The third objection was that errors come in a continuum. Suppose the middle qubit is not fully flipped but slightly rotated, so the state is mostly correct with a small amplitude for the flipped version:
Measure the syndrome. With probability it reads 00 and the state collapses to the undamaged one. With probability it reads 11 and the state collapses to the fully flipped one, which we know how to fix. The measurement forces the error to be all or nothing. A code that corrects a discrete set of errors therefore corrects small errors too. This is called the digitisation of errors, and it is the reason quantum error correction is possible at all.
What this code cannot do
Section titled “What this code cannot do”The code handles one bit flip. It is defeated by two, which produce a syndrome pointing at the wrong qubit.
A deeper weakness is that qubits suffer a kind of error that classical bits do not. A phase flip, the gate, on any one qubit turns into . No qubit disagrees with its neighbours, so the syndrome is 00, yet the encoded information has changed. The next lesson repairs this by combining two repetition codes into the nine-qubit Shor code.
Remember it
Section titled “Remember it”Why can't we protect a qubit by making three copies of it?
An unknown quantum state cannot be copied (no-cloning), and measuring it to learn it would destroy it.
How does the three-qubit bit-flip code encode ?
As . This is one entangled state, not three copies.
What do the two syndrome bits of the bit-flip code record?
Whether qubits 0 and 1 agree, and whether qubits 1 and 2 agree (two parities).
Why does measuring the syndrome leave the encoded state intact?
The parities are the same for the and parts, so the outcome says nothing about and .
Name an error the three-qubit bit-flip code cannot correct.
A phase flip () on any qubit. Two simultaneous bit flips also defeat it.