Computing Library › Quantum Error Correction
Quantum Error Correction

Code Distance

The code distance is the minimum weight of a logical operator, setting how many errors a code can correct.

Definition

For a stabilizer code, the distance d is the smallest weight among all logical operators, that is, among all Pauli operators that commute with every stabilizer but are not themselves in the stabilizer group. A code with distance d is written [[n, k, d]], encoding k logical qubits in n physical qubits. It can correct any error of weight up to floor((d-1)/2) and detect any error up to weight d-1.

Intuitively, an undetectable logical error is one that looks like nothing to the stabilizers yet still changes the encoded state. The lowest-weight such operator is the code's weakest point, and its weight is the distance.

Kronos motion — error correction

Why distance governs correction

Two distinct errors are confusable only if their product is either a stabilizer (harmless) or a logical operator (a genuine failure). If every logical operator has weight at least d, then any two errors each of weight at most (d-1)/2 have a product of weight at most d-1, which cannot be a logical operator. So the decoder can always tell them apart. This is the quantum analog of the classical minimum-distance decoding guarantee.

Scaling

In the surface code, distance equals the linear lattice size, and the number of physical qubits per logical qubit scales as d^2. Increasing d lowers the logical error rate exponentially, provided the physical error rate is below the threshold. This exponential suppression with linear qubit growth is what makes large-distance codes practical: to run a longer algorithm, one simply builds a bigger patch.

Choosing d is an engineering decision that balances the required logical error rate against the available qubits, discussed under overhead.