← Quantum Store · Guides · Lessons · Glossary · Packages · About · Türkçe

Noise and quantum error correction course · Lesson 1 / 5 · 10 min

Noise and kinds of errors: why do qubits go wrong?

Real qubits interact with their surroundings and lose their information. Meet bit flips, phase flips, gate and measurement errors, and see why the phase flip exists only in quantum computers.

Fragile qubits

A bit in a classical computer is a robust signal made by billions of electrons and almost never goes wrong. A qubit is the state of a single atom, ion, photon or superconducting circuit. The smallest vibration, heat or electromagnetic noise around it can disturb it. This disturbance is called decoherence.

Decoherence is measured by two times: T1, the time for the excited |1⟩ state to lose its energy and drop to |0⟩, and T2, the time for the phase of a superposition to wash out. For superconducting qubits these times are typically between microseconds and milliseconds.

Bit flips and phase flips

A bit flip (X error) turns 0 into 1 and 1 into 0, just as in classical computers. A phase flip (Z error) exists only in the quantum world: it flips the sign of |1⟩, turning |+⟩ into |−⟩. It goes unnoticed when you measure in the Z basis, but it ruins interference and so the result of the algorithm.

The code below applies both errors to the state |+⟩. The bit flip does not change |+⟩ at all, while the phase flip turns the X measurement from +1 into −1. Any small error can be written as a combination of X and Z errors, so it is enough for error-correcting codes to catch these two.

from qiskit import QuantumCircuit
from qiskit.quantum_info import SparsePauliOp, Statevector

for name, error in [('no error', None), ('bit flip', 'x'), ('phase flip', 'z')]:
    qc = QuantumCircuit(1)
    qc.h(0)                                   # the state |+⟩
    if error:
        getattr(qc, error)(0)
    sv = Statevector(qc)
    z = sv.expectation_value(SparsePauliOp('Z')).real
    x = sv.expectation_value(SparsePauliOp('X')).real
    print(name, round(z, 3) + 0, round(x, 3) + 0)
# no error 0.0 1.0
# bit flip 0.0 1.0       |+⟩ is not affected by a bit flip
# phase flip 0.0 -1.0    but a phase flip reverses the X measurement

Gate and measurement errors

Errors do not only happen while waiting. Every gate is applied with a small error: on today’s best devices single-qubit gates go wrong around 0.01–0.1% of the time and two-qubit gates around 0.1–1%. Measurement also sometimes reads 0 as 1 or 1 as 0.

These small rates add up in a long circuit: in a circuit with 1,000 two-qubit gates, each with 0.5% error, the chance of running without any error is only 0.995¹⁰⁰⁰ ≈ 0.7%. That is why algorithms like Shor’s, which need billions of gates, cannot run without error correction.

Try it yourself

In the H, Z, H circuit the Z in the middle acts like a phase flip: it is invisible in the Z basis, but the final H turns it into a bit flip and the result becomes 1 instead of 0. Remove the Z: the “error-free” circuit always gives 0.

Open the circuit in your browser

The circuit playground is in Turkish. Button guide: “1000 kez ölç” = measure 1000 times, “Durum vektörünü göster” = show the state vector, “Bu devrenin Qiskit kodu” = this circuit’s Qiskit code, “Geri al” = undo, “Temizle” = clear. Click a gate in the circuit to remove it.

Key points

Test yourself

What does a phase flip (Z) do to the state |+⟩?

Show the answer

It makes it |−⟩. Z flips the sign of |1⟩: the state (|0⟩ + |1⟩)/√2 becomes (|0⟩ − |1⟩)/√2, that is |−⟩.

The repetition code: finding an error without looking at the data →

Share: X · LinkedIn