Quantum Computing · Part D — 14

The Surface Code

The 3-qubit code was a toy. The surface code is the real thing — the design almost every company is betting on. Spread one logical qubit across a 2-D tile of physical qubits, cover it in stabilizers, and errors stop being point failures: they become chains whose endpoints light up. The cure is geometric — just connect the dots.

↩ before you start · keep these handy
·From QC 13: a stabilizer reports +1 when quiet and flips to −1 when an error anti-commutes with it — the syndrome.
·From QI 10: redundancy lets you detect & fix errors without measuring the data.
·From QI 05: X flips a bit, Z flips a phase — the two error types the code handles separately.
🔑 symbol decoder · every new mark, in plain words
data qubita physical qubit holding part of the encoded information — the dots on the lattice. plaquette (face)a Z-type stabilizer = Z on the data qubits around one tile; catches X (bit-flip) errors. star (vertex)an X-type stabilizer = X on the qubits around a crossing; catches Z (phase) errors. The two checkerboards interleave. error chaina line of errors on neighbouring qubits. Only its two endpoints trigger a stabilizer. distance dthe length of the shortest error chain that crosses the tile undetected — the code’s toughness. Bigger d, stronger code. logical qubitthe single protected qubit the whole tile stores, far more reliable than any one physical qubit.
feel

Errors become chains; you cure the endpoints

Tile a patch of physical qubits and lay a stabilizer at every little crossing. A single error lights the stabilizers right around it. A whole string of errors, though, is sneakier — the stabilizers in the middle of the string see two errors and stay quiet, so only the two ends raise an alarm. The decoder’s job becomes a puzzle a child could state: you see lit dots; pair them up and lay down a matching string to cancel the error. The code only fails if an error chain stretches all the way across the tile — and you make that arbitrarily unlikely by making the tile bigger.

🏛️ everyday picture

Think of a long zipper. Do up a run of teeth in the middle and the only places that “feel different” are the two ends of the run — everything inside is uniformly zipped, everything outside uniformly open. To undo the change you don’t need to know which exact teeth moved; you just zip between the two end-markers. The surface code works the same way: errors leave a mark only at their boundary, and you repair by connecting marks.

recapA single error lights its neighbours; a chain lights only its endpoints. Decode by pairing lit stabilizers.
play

Light up a surface-code patch

The data qubits (round dots) live on the edges; a stabilizer sits at every vertex (the diamonds) and checks the parity of the edges meeting it. Click a dot to put an error on it — a vertex glows amber when an odd number of its edges carry an error. Lay errors end to end into a chain (or hit show a chain) and watch the interior vertices fall quiet, leaving only the two endpoints lit.

▸ surface patch · click data qubitsamber node = stabilizer fired
! X
errors placed
{{ nErr }}
stabilizers lit
{{ nLit }}
{{ status }}
recapA face fires on odd-parity corners, so a chain’s interior stays quiet and only its two ends are flagged.
math

Two checkerboards, one logical qubit

Every face carries a Z-type stabilizer; every vertex carries an X-type stabilizer — each a product of the four Paulis on its surrounding qubits:

plaquette  Bᶫ = ∏i∈face Zᵢ  ·  star  Aᴠ = ∏i∈vertex Xᵢ
all of them commute — a face and a star always share 0 or 2 qubits

On a tile of distance d there are about d² data qubits and one qubit’s worth of freedom left over — the logical qubit. A logical operation is a Pauli chain stretching from one boundary to the opposite one; it commutes with every stabilizer, so it’s invisible to the syndrome. The code only fails when nature accidentally builds such a coast-to-coast chain:

code distance  d = length of shortest logical chain
corrects any error touching fewer than d⁄2 qubits
✎ worked example · a 2-edge error chain
1.Errors on two edges that share a vertex, forming a chain through vertices A–M–B.
2.The middle vertex M touches both error edges → even parity → stays quiet.
3.The two end vertices A and B each touch one error edge → both fire.
4.Syndrome = two lit ends. Pair them, apply errors along a connecting path → chain cancelled.
recapFaces & stars are commuting 4-qubit stabilizers; the logical qubit hides in boundary-to-boundary chains of length d.
⚠ common misconceptions

“The syndrome tells me exactly which qubits failed.” It only marks the endpoints of error chains. Several different chains share the same endpoints, so the decoder must guess the most likely one — usually the shortest.

“A bigger patch needs no extra qubits.” Protection costs hardware: a distance-d tile uses on the order of d² physical qubits for a single logical one. That overhead is the whole subject of the next chapter.

“One tile handles bit-flips and phase-flips with the same checks.” No — that’s why there are two interleaved stabilizer types. Faces (Z) catch X errors; stars (X) catch Z errors. The widget shows one checkerboard; the other lives on top of it.

✓ you can now
lay out a surface-code patch: data qubits, face (Z) and star (X) stabilizers
explain why a single error lights neighbours but a chain lights only its ends
decode a syndrome by pairing lit stabilizers with the shortest matching chain
define code distance d and say what error weight a tile can correct
← 13 Stabilizer Formalism 15 Thresholds & Magic