Code Distance and Errors
The distance of a code is the weight of its smallest logical operator — the fewest single-qubit errors that can change the encoded state without being detected. For the surface code this equals the length of the shortest string spanning the patch. Distance is the single number that summarises how robust the code is.
How many errors can it correct?
A code of distance can detect up to errors and correct up to
errors of a given type. The reasoning is the same as for classical codes: if two distinct correctable errors produced the same syndrome, they would differ by an undetectable operator of weight at most . To keep them distinguishable we need , i.e. .
For the surface code the practical consequences are:
- : corrects error — the smallest patch that can fix any single fault.
- : corrects errors.
- : corrects errors.
Only odd distances are used in practice. With even a weight- error and its complementary weight- partner are equidistant from the syndrome, leaving the decoder no majority to break the tie; odd guarantees a unique nearest correction.
Distance versus probability
Correcting "up to errors" is a worst-case statement. What actually matters operationally is that any error chain shorter than is matched correctly by the decoder, and only chains of weight can cause a logical failure. Because each additional error carries a factor of the small physical error rate , raising pushes the dominant failure mode to higher and higher order in — the exponential suppression we make precise in the threshold lesson.
Try it
Compute, for a distance- surface-code patch, how many errors of one type it can correct. Apply with and return the result. The grader checks that your returned value equals .
Sign in on the full site to ask questions and join the discussion.