Skip to content
Tutorials Center
My learning

Topics

Lesson 24 of 39 ยท Noise and Error Correction

Noise and Decoherence in Quantum Computers

Learn why real qubits fail: decoherence, T1 and T2 times, gate errors and noise channels, modeled with density matrices and Kraus operators in NumPy.

So far the qubits in our simulations were perfect. Real qubits are fragile: a stray photon, a fluctuating magnetic field or a slightly miscalibrated pulse changes the state in ways the algorithm did not ask for. This unwanted change is noise, and the loss of quantum behavior through interaction with the environment is decoherence. Noise is the main reason today's machines cannot yet run Shor's algorithm or deep versions of Grover's search.

This lesson gives you the vocabulary (T1, T2, fidelity, error rate) and the mathematical tool to simulate noise: the density matrix and noise channels.

Where errors come from

  • Decoherence. The qubit leaks energy or information into its surroundings. Superconducting qubits typically keep coherence for tens to hundreds of microseconds; trapped ions for seconds or more; neutral atoms for around a second.
  • Gate errors. Pulses are never perfect. Typical two-qubit gate error rates are about 10^-2 to 10^-3 (best systems reach a few times 10^-4 to 10^-3); single-qubit gates are around 10^-3 to 10^-4.
  • Measurement (readout) errors. Reading 0 as 1 or the reverse, often 0.5% to a few percent.
  • Crosstalk and leakage. Operations on one qubit disturb neighbors, or push a qubit out of the |0>, |1> subspace.

T1 and T2

Two numbers summarize a qubit's coherence:

  • T1 (relaxation time). How fast |1> decays to |0> by losing energy. The excited-state probability falls as exp(-t / T1).
  • T2 (dephasing time). How fast the relative phase in a superposition like |+> randomizes. The off-diagonal terms of the density matrix shrink as exp(-t / T2). Physics requires T2 <= 2 * T1.

The ratio of gate time to T1 and T2 tells you how many gates fit inside the coherence window. A 50 ns gate on a qubit with T2 = 100 us allows around 2000 gates in principle, but gate errors usually bite first.

Density matrices

A state vector describes a pure state. If you are uncertain which state you have (for example, because noise acted randomly), you need the density matrix:

Text
rho = sum of p_i |psi_i><psi_i|

For a pure state rho = |psi><psi|. The diagonal entries of rho are measurement probabilities; the off-diagonal entries are the coherences that carry interference. Purity Tr(rho^2) equals 1 for a pure state and 1/2 for a single qubit in the maximally mixed state.

Noise acts on rho through Kraus operators with sum of K_i^dagger K_i = I:

Text
rho -> sum of K_i rho K_i^dagger

Common single-qubit channels:

Channel What it does Parameter
Bit flip Applies X with probability p p
Phase flip (dephasing) Applies Z with probability p p
Depolarizing Replaces the state by the maximally mixed state with probability p p
Amplitude damping The excited state decays to the ground state (T1 process) gamma
Python Noise channels acting on a density matrix

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice that the phase-flip channel leaves P(0) = 0.5 unchanged but shrinks the coherence from 0.5 to 0.2. That is exactly what dephasing is: the probabilities still look fine, yet interference is destroyed. Algorithms depend on interference, so dephasing silently ruins them.

Decay over time

Combining the channels with time gives T1 and T2 decay. For a qubit idling for time t:

  • Amplitude damping with gamma = 1 - exp(-t / T1).
  • Extra pure dephasing so that coherences shrink as exp(-t / T2).
Python T1 and T2 decay of an idle qubit

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The simulation matches exp(-t/T1) for the excited state and 0.5 * exp(-t/T2) for the coherence.

Errors add up

Suppose every gate fails independently with probability epsilon. A circuit with G gates then succeeds with probability roughly (1 - epsilon)^G. With epsilon = 10^-3, that is 37% for 1,000 gates, and only 0.005% for 10,000 gates. This simple estimate explains the shape of the whole field:

flowchart LR
    A["Error rate per gate"] --> B["Circuit success = (1 - e)^G"]
    B --> C["Short circuits: usable now (NISQ)"]
    B --> D["Long algorithms: need error correction"]

Noisy hardware can run shallow circuits; long algorithms need error correction.

Python How many gates can a noisy machine run?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Shor's algorithm for a 2048-bit RSA key needs on the order of 10^9 to 10^12 gates. Even 10^-6 error rates fall short, which is why we need logical qubits built from many noisy physical ones.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What does T1 measure?

    T1 is the energy relaxation time. T2 describes loss of phase coherence.
  2. 2. A phase-flip channel acts on |+>. What happens to the measurement probabilities in the computational basis?

    Z errors only change relative phase. Probabilities look the same but interference is lost.
  3. 3. Which condition always holds between T1 and T2?

    Dephasing includes the contribution of energy relaxation, so T2 cannot exceed twice T1.
  4. 4. With a 0.1% error per gate, about how likely is a 1,000-gate circuit to run without any error?

    (1 - 0.001)^1000 is about e^-1, roughly 37%.
  5. 5. Why use a density matrix instead of a state vector?

    Noise turns pure states into mixtures that no single state vector can describe.

Summary

  • Real qubits suffer decoherence, gate errors and readout errors.
  • T1 is energy relaxation, T2 is dephasing; T2 <= 2*T1.
  • Noise is modeled with density matrices and Kraus operators: bit flip, phase flip, depolarizing, amplitude damping.
  • Circuit success falls like (1 - epsilon)^G, so long algorithms need error correction and shallow ones need error mitigation.

Next: Bit-Flip and Phase-Flip Codes