Simple Algorithm
Quantum Computing · Ground State · 17 min

Noise & Error Correction

Fighting decoherence: how fragile qubits become reliable computers.

Today's best qubits forget what they were told within a fraction of a millisecond, and a typical two-qubit operation fails somewhere between once in a hundred and once in a thousand tries. Large quantum algorithms need billions of operations. This lesson shows how that gap gets closed: not with perfect hardware, but by catching errors you are not even allowed to look at.

What you’ll learn

  • Explain what decoherence does to a qubit, and what the times T1T_1 and T2T_2 measure.
  • Describe noise as a Bloch vector shrinking into the ball, with a loss of purity.
  • Show how the three-qubit repetition code fixes a bit flip without learning the encoded state.
  • Explain why quantum codes must also catch phase flips, and what the surface code and the threshold promise.
  • Name the five Excited State subtopics and the question each one answers.

Why qubits are fragile

A classical bit is robust because it is big. A bit in your laptop's memory is stored in the charge of many thousands of electrons, and no stray disturbance can flip all of them at once. A qubit cannot be protected that way. Its power lies in superposition and in the relative phase between ∣0⟩\ket{0} and ∣1⟩\ket{1}, and both are wiped out whenever the outside world gains information about the qubit.

Any stray interaction (an emitted photon, a fluctuating magnetic field, a vibration of the chip) that lets the environment "notice" whether the qubit is ∣0⟩\ket0 or ∣1⟩\ket1 acts like an unintended measurement. This is decoherence: the qubit's quantum information leaks into its surroundings, where you can never get it back.

Three more facts make the problem look hopeless at first:

  • No copying. The no-cloning theorem forbids making backup copies of an unknown qubit.
  • No peeking. Measuring a qubit to check it for errors collapses its superposition.
  • Errors are continuous. A qubit can be rotated by 0.1∘0.1^\circ, not just flipped, so there seem to be infinitely many different errors to fix.

By the end of this lesson you will have seen how all three obstacles are overcome.

Think first If quantum states are so fragile, why not simply isolate the qubit perfectly from everything?

Because you must also control it. The wires, lasers and couplings that apply gates and read out the qubit inevitably connect it to the outside world. A perfectly isolated qubit would be a perfect memory that you could never use. Every hardware platform balances isolation against control.

Two clocks: T₁ and T₂

Noise is characterized by two standard experiments. Both use the Bloch sphere, where a pure state is an arrow of length 1.

  • Energy relaxation (T1T_1). A qubit prepared in the excited state ∣1⟩\ket1 eventually hands its energy to the environment and falls to ∣0⟩\ket0. The probability of still finding ∣1⟩\ket1 decays as P1(t)=e−t/T1P_1(t) = e^{-t/T_1}.
  • Dephasing (T2T_2). A qubit prepared in ∣+⟩\ket+ has a definite phase. Random jitter of the qubit's frequency scrambles that phase, so the horizontal part of the arrow shrinks as e−t/T2e^{-t/T_2}, even if the chances of 00 and 11 never change.
Predict before you look

A qubit with T1=100 μsT_1 = 100\,\mu\text{s} is prepared in ∣1⟩\ket1. After 100 μs100\,\mu\text{s}, what is the probability (in %) that it is still in ∣1⟩\ket1?

Show the answer

37 %

P1=e−t/T1=e−1≈0.37P_1 = e^{-t/T_1} = e^{-1}\approx0.37. After one T1T_1 about 37% of the excitation remains; after 3T13T_1 only about 5%.

How bad is that? As of the mid-2020s, good superconducting qubits have T1T_1 and T2T_2 of tens to hundreds of microseconds, while a gate takes tens of nanoseconds: room for roughly a thousand to ten thousand operations before the qubit forgets, and imperfect control adds errors on top. Trapped ions keep their phase for seconds or longer but run gates more slowly. What matters is the error per operation, and every platform is still far from the billions of reliable operations that large algorithms need.

Noise makes states mixed

What does a partly dephased qubit look like? Suppose that with probability 10% a random phase flip ZZ hit the qubit, turning ∣+⟩\ket+ into ∣−⟩\ket-, and you don't know whether it happened. The honest description is a mixed state: ∣+⟩\ket+ with probability 0.90.9 and ∣−⟩\ket- with probability 0.10.1, written as a density matrix ρ\rho.

Mixed states live inside the sphere, in the Bloch ball. The shorter the arrow, the less you know about the qubit, and the lower its purity Tr⁡ρ2\Tr\rho^2. Purity runs from 1 (pure, on the surface) down to ½ (the center: a perfectly random qubit).

ρ=0.9 ∣+⟩ ⁣⟨+∣+0.1 ∣−⟩ ⁣⟨−∣=(0.50.40.40.5),Tr⁡ρ2=0.82\rho = 0.9\,\dyad{+} + 0.1\,\dyad{-} = \begin{pmatrix} 0.5 & 0.4 \\ 0.4 & 0.5 \end{pmatrix},\qquad \Tr\rho^2 = 0.82
The 10% phase-flip state. The off-diagonal "coherences" fell from 0.50.5 to 0.40.4; the Bloch vector shrank from length 1 to 0.80.8.
Check your understanding

A qubit starts in ∣+⟩\ket+ and is completely dephased, so its Bloch vector reaches the center. What do you now get when you measure it?

  1. 00 every time in the ZZ basis
  2. 50/50 in the ZZ basis, but ++ every time in the XX basis
  3. 50/50 in the ZZ basis and 50/50 in the XX basis
  4. 11 every time in the ZZ basis
Show the answer

C. 50/50 in the ZZ basis and 50/50 in the XX basis

At the center of the ball ρ=I/2\rho = \id/2: a fair coin in every basis. In the ZZ basis ∣+⟩\ket+ was already 50/50, so nothing changed there. The damage shows only in the XX basis, where ∣+⟩\ket+ used to give ++ with certainty.

Redundancy without copying

Classical engineers beat noise with redundancy: send 00 as 000000 and 11 as 111111, then take a majority vote. A single flipped bit is outvoted.

The quantum version cannot copy α∣0⟩+β∣1⟩\alpha\ket0+\beta\ket1 three times. Instead it spreads the state over three qubits:

α∣0⟩+β∣1⟩  ⟼  α∣000⟩+β∣111⟩.\alpha\ket{0}+\beta\ket{1}\;\longmapsto\;\alpha\ket{000}+\beta\ket{111}.

These are not three copies (that would be (α∣0⟩+β∣1⟩)⊗3(\alpha\ket0+\beta\ket1)^{\otimes3}). It is one logical qubit stored in the correlations of three physical qubits: an entangled state made with two CNOT gates.

To find a flip without looking at α\alpha and β\beta, measure only parities: is qubit 1 equal to qubit 2? Is qubit 2 equal to qubit 3? These checks, written Z1Z2Z_1Z_2 and Z2Z3Z_2Z_3, give the same answer for ∣000⟩\ket{000} and ∣111⟩\ket{111}. So they reveal where a flip happened while revealing nothing about the encoded state. The pattern of answers is the syndrome.

Flipped qubitZ1Z2Z_1Z_2Z2Z3Z_2Z_3Correction
none+1+1+1+1nothing
1−1-1+1+1flip qubit 1
2−1-1−1-1flip qubit 2
3+1+1−1-1flip qubit 3
Each single flip produces a different syndrome. +1+1 means "same", −1-1 means "different".
Predict before you look

Each qubit flips independently with probability p=10%p = 10\%. The code fails only when two or three qubits flip. What is the logical failure rate, in %?

Show the answer

2.8 %

pL=3p2(1−p)+p3=3p2−2p3=0.03−0.002=0.028p_L = 3p^2(1-p)+p^3 = 3p^2-2p^3 = 0.03-0.002 = 0.028: about 2.8%, versus 10% unprotected. Because pL≈3p2p_L\approx3p^2, the code helps whenever p<12p<\tfrac12 and helps enormously for small pp: at p=1%p = 1\%, pL≈0.03%p_L\approx0.03\%.

Phase flips, and why quantum codes work at all

The repetition code has a blind spot. A phase flip ZZ on any one qubit turns α∣000⟩+β∣111⟩\alpha\ket{000}+\beta\ket{111} into α∣000⟩−β∣111⟩\alpha\ket{000}-\beta\ket{111}. Both parity checks still read +1+1, and the logical state is silently damaged. Real qubits suffer phase errors at least as often as bit flips; that is what T2T_2 measures.

The fix is a neat symmetry: a Hadamard turns phase flips into bit flips, HZH=XHZH = X. So a code that repeats in the ∣±⟩\ket\pm basis catches phase flips. In 1995 Peter Shor nested the two ideas into a 9-qubit code that corrects any error on any single qubit: the first quantum error-correcting code.

Think first Why not simply measure each of the three qubits to see which one flipped?

Measuring qubit 1 in the ∣0⟩,∣1⟩\ket0,\ket1 basis would collapse α∣000⟩+β∣111⟩\alpha\ket{000}+\beta\ket{111} to ∣000⟩\ket{000} or ∣111⟩\ket{111}, destroying the very superposition you wanted to protect. A parity measurement asks only "same or different?", which has the same answer in both branches, so the superposition survives.

The surface code

Today's leading design is the surface code: data qubits on a 2D grid, with parity checks on small groups of neighbors. Some checks are XX-type (they catch ZZ errors) and some are ZZ-type (they catch XX errors). Each check involves at most four nearby qubits, which suits chips where qubits only talk to their neighbors.

Below is the smallest interesting patch: 9 data qubits and 8 checks, enough to correct any single error.

That experiment shows what a code's distance means: the smallest number of errors that can fool it. This patch has distance 3. A larger patch has a larger distance, so it fails only when a long chain of errors happens to line up. That becomes exponentially unlikely as the patch grows, provided each qubit's error rate is below a threshold, roughly 1% for the surface code.

Fault tolerance and the road ahead

There is a catch: the checks themselves are carried out by noisy gates and measurements. Fault-tolerant design arranges every step so that a single fault cannot spread into many errors. The threshold theorem (proved in the late 1990s) then guarantees that below the threshold error rate, arbitrarily long quantum computations can be made reliable, with an overhead that grows only polylogarithmically with the size of the computation.

The price is steep: at today's error rates, each logical qubit may need hundreds to thousands of physical qubits. Until such machines exist, NISQ devices rely on error mitigation: run noisy circuits cleverly and post-process the results to estimate what a noiseless device would have produced. Mitigation reduces bias, but its cost grows exponentially with circuit size, so it complements error correction rather than replacing it.

Excited State lessonThe question it answers
Decoherence: T₁, T₂ and NoiseHow do relaxation and dephasing act on density matrices? Kraus operators, the Bloch equations and a proof that T2≤2T1T_2\le2T_1.
Quantum Error Correction BasicsHow do the bit-flip, phase-flip and Shor codes work, and why does fixing XX and ZZ fix every error?
Stabilizer Codes & the Surface CodeHow do you describe a code by the Pauli checks that fix it, and how are surface-code syndromes decoded?
Fault Tolerance & the Threshold TheoremHow can a computer built from faulty parts compute reliably, and where do non-Clifford gates come from?
Error Mitigation for Near-Term DevicesHow can you get better answers from noisy hardware without full error correction, and at what cost?
Your next steps at the Excited State level.

Key takeaways

  • Decoherence is the environment acquiring information about a qubit; it erases superposition and phase.
  • T1T_1 measures energy relaxation (∣1⟩→∣0⟩\ket1\to\ket0) and T2T_2 the loss of phase coherence; always T2≤2T1T_2\le2T_1.
  • Noise shrinks the Bloch vector into the ball: states become mixed and their purity drops below 1.
  • Quantum codes spread one logical qubit over many physical qubits and measure only parities (syndromes), which locate errors without revealing the encoded state.
  • Syndrome measurement digitizes errors. Codes such as Shor's and the surface code catch both bit and phase flips, and below threshold bigger codes give exponentially fewer logical errors.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

Which experiment measures T1T_1?

  1. Prepare ∣1⟩\ket1 and record how fast the population of ∣1⟩\ket1 decays
  2. Prepare ∣+⟩\ket+ and record how fast the phase coherence decays
  3. Prepare ∣0⟩\ket0 and record how often it is read out as 00
  4. Apply many XX gates in a row and count the failures
Show the answer

A. Prepare ∣1⟩\ket1 and record how fast the population of ∣1⟩\ket1 decays

T1T_1 is the energy-relaxation time: an excited qubit decays toward ∣0⟩\ket0 with P1(t)=e−t/T1P_1(t) = e^{-t/T_1}.

Question 2

A device reports T1=50 μsT_1 = 50\,\mu\text{s}. Which value of T2T_2 is physically impossible?

  1. 20 μs20\,\mu\text{s}
  2. 50 μs50\,\mu\text{s}
  3. 150 μs150\,\mu\text{s}
  4. 100 μs100\,\mu\text{s}
Show the answer

C. 150 μs150\,\mu\text{s}

T2≤2T1=100 μsT_2\le2T_1 = 100\,\mu\text{s}, because relaxation by itself already destroys coherence. 100 μs100\,\mu\text{s} is exactly the limit, reached when there is no extra dephasing.

Question 3

Why does the three-qubit code measure the parities Z1Z2Z_1Z_2 and Z2Z3Z_2Z_3 instead of each qubit individually?

  1. Parity measurements are faster on real hardware
  2. Parities locate a bit flip without revealing (or disturbing) α\alpha and β\beta
  3. Measuring individual qubits would copy the state and violate no-cloning
  4. Individual measurements cannot detect bit flips
Show the answer

B. Parities locate a bit flip without revealing (or disturbing) α\alpha and β\beta

∣000⟩\ket{000} and ∣111⟩\ket{111} have the same parities, so the checks cannot tell the two branches of the superposition apart and leave it intact. Measuring single qubits would collapse it.

Question 4

A phase flip ZZ hits one qubit of the three-qubit bit-flip code. What happens?

  1. The syndrome points to the right qubit and the error is fixed
  2. The syndrome points to the wrong qubit
  3. Both checks read −1-1
  4. Both checks read +1+1, and the logical state is silently corrupted
Show the answer

D. Both checks read +1+1, and the logical state is silently corrupted

ZZ flips no bit, so the parities are unchanged and the syndrome is trivial, yet α∣000⟩+β∣111⟩↦α∣000⟩−β∣111⟩\alpha\ket{000}+\beta\ket{111}\mapsto\alpha\ket{000}-\beta\ket{111}. That is why real codes, like Shor's or the surface code, also check in the XX basis.

Question 5

What does it mean for physical error rates to be "below threshold"?

  1. Physical errors no longer happen
  2. Making the code bigger makes logical errors rarer, without limit
  3. The logical error rate equals the physical error rate
  4. Error mitigation becomes unnecessary for every circuit
Show the answer

B. Making the code bigger makes logical errors rarer, without limit

Below threshold, each increase in code distance suppresses the logical error rate further, so it can be made as small as an algorithm needs. Above threshold, bigger codes just add more places for errors to occur and make things worse.

Go deeper

Further reading

  • M. A. Nielsen & I. L. Chuang, Quantum Computation and Quantum Information, Ch. 8 (quantum noise) and Ch. 10 (quantum error correction) (Cambridge, 10th anniv. ed., 2010).
  • D. Gottesman, "An introduction to quantum error correction and fault-tolerant quantum computation", arXiv:0904.2557 (2009).