Learn · Quantum error correction

How a surface code spots an error without looking at the data

A distance-3 surface code stores one logical qubit in nine data qubits. Eight checks each measure the parity of two or four neighbouring data qubits. An error flips the parity of the checks around it, and that pattern of fired checks (the syndrome) points to where the error is, without reading the data qubits themselves.

Raised cap: an error on that data qubitRaised flag and lit latch: a check that firedRound station: X-check · square: Z-checkIllustration — not to scale, not a live system. A distance-3 rotated surface code: 9 data qubits, 4 X-checks and 4 Z-checks. An X error fires the Z-checks that contain its qubit, a Z error fires the X-checks, Y fires both; two errors on one check cancel there. The syndrome is computed in your browser from these rules; no quantum hardware or decoder runs here.

Why the checks do not disturb the data

Each check asks only whether its two or four qubits agree (an even or odd parity), never what any one of them holds. All eight checks commute with each other and with the encoded logical state, so they can be measured over and over while the logical qubit stays intact. In hardware an extra ancilla qubit per check collects the parity through CNOT gates and is then measured.

What happens next: decoding

The syndrome does not name the error directly. Different errors can give the same pattern, and measurements themselves can be wrong, so a decoder (for example minimum-weight perfect matching) picks the most likely correction from syndromes collected over several rounds. Try adding two X errors next to each other on the board: the check they share stays quiet, and only the ends of the chain fire.