Code Distance on the Lattice
The protective power of a surface code is set by its distance : the minimum weight of any logical operator. Because logical operators are strings that span the patch (or wind the torus), the distance is a purely geometric quantity that grows with the linear size of the lattice. This lesson makes the relationship precise and works out the code parameters .
Distance is the shortest logical string
Recall that a logical Pauli is a homologically nontrivial string: a noncontractible loop on the torus, or a boundary-to-boundary string on the planar patch. Any such string can be deformed by multiplying with stabilizers, but its weight cannot drop below the geometric minimum needed to cross the system. Hence
For an toric code the shortest noncontractible loop runs straight across one direction and has length , so . For a planar patch with qubits between the two like-type boundaries, the shortest boundary-to-boundary string has length .
The rotated surface code
The most hardware-efficient layout is the rotated surface code. To achieve distance it uses
with stabilizer checks (half -type, half -type, including weight-2 checks along the boundaries). Its parameters are therefore
So for distance one needs data qubits. Inverting, the distance recoverable from a rotated patch of data qubits is .
How many errors does it correct?
A distance- code can detect up to errors and correct up to
arbitrary errors. A distance-5 patch () thus corrects errors; a distance-3 patch corrects a single error. Increasing by 2 (the smallest step that keeps an odd, unambiguous distance) buys one more correctable error while keeping every check local.
Why this is the whole point
Every check stays weight-4 (weight-2 at boundaries) no matter how large becomes — locality is never sacrificed. Yet , and hence the protection, scales with . Combined with a positive error threshold (two lessons ahead), this lets the logical error rate be suppressed exponentially in by a merely polynomial growth in qubit count. That favorable trade is the engineering case for surface codes.
Try it
For a rotated surface-code patch with data qubits, recover the distance and return the number of correctable errors .
Sign in on the full site to ask questions and join the discussion.