Code Distances in Coding Theory
- Code distances are metric invariants that measure the separation between admissible information carriers, crucial for defining error detection and correction capabilities.
- They are computed using diverse metrics—such as Hamming, Lee, Manhattan, and quantum distances—and analyzed through algebraic and semidefinite programming techniques.
- These measures underpin practical error correction in classical, subspace, and quantum codes, influencing system design from communication standards to high-rate LDPC implementations.
Code distances are metric invariants that quantify separation between codewords or, more generally, between admissible information carriers in a coding system. In classical linear block coding, the basic quantity is usually the minimum Hamming distance, equivalently the minimum nonzero Hamming weight; in stabilizer quantum coding, the code distance is the minimum weight of a nontrivial logical Pauli operator; in subspace and flag coding, distance is defined from subspace metrics; and in -symbol, Lee, and Manhattan settings, the relevant distance depends on the channel model or ambient geometry (Chen, 2023, Dumer et al., 2014, Silberstein et al., 2010, Alonso-González et al., 2021).
1. Minimum distance and the classical Hamming framework
For a code , the Hamming weight of is
and the Hamming distance is . For a linear code, the minimum Hamming distance is
so distance is the minimum nonzero weight. This quantity controls error detection and bounded-distance correction: errors can be detected, and errors can be corrected (Chen, 2023).
Beyond the minimum distance, classical coding theory also studies the full distance distribution and weight distribution. For a code , the weight distribution is the sequence counting codewords of weight 0, while the distance distribution 1 counts unordered pairs of distinct codewords at distance 2. For systematic non-linear codes, these distributions are not generally accessible through linear duality, and brute-force pairwise comparison had been the only known general method for computing them. A Gröbner basis framework replaces this with algebraic ideals whose varieties encode codewords of bounded weight or pairs of codewords at bounded distance, thereby recovering the minimum distance, the full distance distribution, and all closest pairs (0909.1626).
A recurrent theme is that “code distance” may refer either to a minimum-distance parameter or to the whole set of realized pairwise distances. The latter viewpoint becomes central in the theory of 3-distance codes and in settings where the distance spectrum, rather than only its minimum, is the object of study (Landjev et al., 11 Mar 2025).
2. Distance sets, few-distance codes, and symmetric distance spectra
An 4-distance binary code of length 5 is a code 6 whose set of nonzero pairwise Hamming distances is exactly
7
For such codes, the maximum size satisfies the universal polynomial bound
8
with no restriction on the actual values 9. A refinement subtracts a lower-order correction involving partition numbers 0, but the dominant asymptotic term remains 1. The bound is asymptotically optimal for fixed 2: the family of all weight-3 binary words has size 4 and realizes exactly 5 distinct nonzero distances (Landjev et al., 11 Mar 2025).
A particularly rigid case is the 6-ary two-distance condition 7 for all distinct codewords. Such 8-codes interpolate between equidistant codes and unrestricted block codes. The theory includes direct constructions from balls of radius 1, parity extensions, mutually orthogonal Latin squares, difference matrices, and, in the linear case, a classification theorem: for 9, linear two-distance codes arise from linear equidistant codes by deleting or adding a coordinate; for 0, an additional MOLS-derived family appears (Boyvalenkov et al., 2019).
The symmetric-distance condition imposes another global restriction. In a space with maximal distance 1, a code has symmetric distances if its distance set 2 is symmetric with respect to 3, that is,
4
For binary constant-weight codes of length 5 and weight 6, viewed in the Johnson space 7, this symmetry improves the usual Johnson-type cardinality bound. If the degree set has size 8, then
9
This is interpreted through the language of 0-bipartite 1-polynomial association schemes, where the symmetry of the distance set forces a parity restriction on the annihilator polynomial. Equality is highly constrained: the paper identifies Hadamard-type one-distance examples and Erdős–Ko–Rado-type intersecting families, and derives number-theoretic restrictions showing that tight symmetric-distance codes are exceptional (Hegedüs et al., 20 Jan 2025).
3. Alternative metrics: subspace, flag, 2-symbol, Lee, and Manhattan distances
When codewords are subspaces rather than vectors, the relevant metric changes. For subspaces 3, possibly of different dimensions, the subspace distance is
4
For constant-dimension codes 5, this reduces to
6
The same paper gives a rank formulation,
7
and a refined decomposition
8
which separates the contribution of identifying vectors from the residual rank term (Silberstein et al., 2010).
Flag codes generalize subspace codes by using nested chains of subspaces. For two flags
9
of a fixed type 0, the flag distance is
1
Because the same total 2 can be realized by many different componentwise patterns, the notion of a distance vector
3
is introduced. Valid distance vectors are characterized by evenness, coordinate bounds, a fixed total sum, and the Lipschitz-type condition
4
Distance vectors then yield structural statements about shared subspaces, generalized disjointness, and cardinality bounds for flag codes (Alonso-González et al., 2021).
For channels with overlapping reads, the Hamming metric is replaced by the 5-symbol metric. If 6, its 7-symbol support is
8
the 9-symbol weight is 0, and
1
For linear codes, 2 is the minimum nonzero 3-symbol weight. The associated Singleton-like bound is
4
with 5-symbol MDS and almost MDS codes defined by equality and a deficiency of 1, respectively (Xu et al., 2023).
On finite grids 6, the Manhattan distance
7
coexists with Hamming and Lee distances. The paper shows
8
and studies the size of Manhattan balls 9 as a function of the center. Balls centered at corners minimize 0, while those centered at innermost points maximize it. These extremal sizes feed directly into Manhattan-metric versions of the Hamming and Gilbert–Varshamov bounds (García-Claro et al., 2022).
4. Quantum code distance, error models, and topological effects
For a qubit stabilizer code 1, the quantum code distance is the minimum weight of a Pauli operator that commutes with the stabilizer but is not itself a stabilizer: 2 In CSS codes, the distance decomposes into 3 and 4, with
5
This makes quantum distance the minimum weight of a nontrivial logical operator rather than merely the minimum distance between vectors in a linear space (Dumer et al., 2014).
Topological quantum codes sharpen the dependence of distance on geometry and on the allowed error model. In dislocation-based surface codes with twist defects separated by lattice distance 6, an earlier estimate gave distance 7 under an error model allowing only physical 8 and 9 errors. When 0 errors are allowed, a shorter undetectable logical operator exists: local 1 patterns near the twists merge into a single 2-chain across the bulk, and the logical operator weight becomes
3
Accordingly,
4
This example makes explicit that quoted code distances can depend on the permitted physical errors even when the algebraic definition of distance itself does not change (Gidney, 2019).
Generalized bicycle (GB) codes provide another quantum setting in which distance depends strongly on structural constraints. A GB code is a CSS code built from two binary circulant matrices, with length 5. Unlike many simple quantum LDPC ansätze, unrestricted GB codes may have linear distance scaling. For bounded generator weight 6, however, incommensurate GB codes can be mapped to CSS codes local in dimension 7, yielding upper bounds
8
For low-density families with row weights 9 and 0, exhaustive enumeration is reported to be consistent with
1
with 2 increasing with 3 (Wang et al., 2022).
5. Distance constructions in highly structured families
Several families are designed specifically to preserve additional algebraic structure while retaining nontrivial distance growth. For Euclidean self-dual repeated-root cyclic codes over 4, the paper constructs infinite families of lengths
5
with minimum distance
6
For Hermitian self-dual repeated-root cyclic codes over 7, it constructs families of lengths
8
with
9
These are “square-root-like” distance bounds: the minimum distance is 00 within a strongly constrained self-dual cyclic setting (Chen, 2023).
A different structural program concerns embedding ordinary binary linear codes into self-orthogonal codes. For 01, algorithmic procedures append carefully chosen simplex columns to a generator matrix 02 so as to obtain a self-orthogonal code of the shortest possible length, preserving the same dimension and guaranteeing a minimum distance 03. The same work gives exact formulas for
04
for every 05, and for
06
for all 07 outside the congruence classes
08
thereby determining optimal minimum distances for large classes of self-orthogonal codes (Kim et al., 2020).
Matrix product codes furnish still another distance mechanism. If
09
with 10 an 11 matrix of rank 12, then the minimum 13-symbol distance satisfies
14
where 15 is the minimum Hamming distance of the code generated by the first 16 rows of 17. When 18 is nonsingular by columns,
19
This framework yields exact 20-symbol distance formulas for Reed–Muller codes,
21
when 22, and also produces 23-symbol almost MDS families from the 24-construction (Xu et al., 2023).
6. Computational, semidefinite, and standards-based distance analysis
The computation of code distance is itself a substantial research area. For systematic non-linear codes, Gröbner basis ideals 25 and 26 encode respectively the existence of codewords of weight at most 27 and pairs of codewords at distance at most 28. The minimum distance is the first value at which 29 exceeds the diagonal, and the distance distribution follows recursively from the sizes of these varieties (0909.1626).
For classical and quantum linear codes, several generic numerical techniques have been adapted to distance computation. In the complexity-exponent notation
30
the paper surveys sliding-window, random-window, bipartition-match, and punctured-bipartition methods, then introduces a linked-cluster technique for classical and quantum LDPC codes. In an 31-LDPC code, any minimum-weight codeword induces a connected cluster in the graph formed by code positions and shared parity checks. Enumerating only connected supports yields a complexity exponent
32
linear in the relative distance 33, improving deterministic searches for the small-34 regime characteristic of known quantum LDPC families (Dumer et al., 2014).
Upper bounds on code size can also be sharpened by moving beyond pairwise distances. A quadruple-based semidefinite programming hierarchy defines 35 using positive semidefiniteness constraints on matrices indexed by codes of size at most 4. This yields, among other results,
36
showing that the quadruply shortened Golay code is optimal, together with improved upper bounds for many other values of 37 (Gijswijt et al., 2010).
In quasi-cyclic LDPC codes used by communication standards, minimum distance is often constrained by the protograph. For IEEE 802 QC-LDPC codes with polynomial parity-check matrix 38 and weight matrix 39, the Smarandache–Vontobel bound gives
40
so the upper bound depends only on the protomatrix and is independent of the circulant size 41. Search-based minimum distances for multiple IEEE 802 standards are often significantly below these structural upper bounds, especially at high rates (Butler, 2016).
A recent 5G NR analysis applies related QC-LDPC distance methods to BG1 codes. For the high-rate punctured BG1 6-layer code 42, the minimum distance is bounded by
43
while for the low-rate all-layer BG1 code 44,
45
The same work proposes an early-termination scheme based on circulant modular reduction, reducing syndrome-calculation complexity while preserving the underlying code-distance analysis (Danilko et al., 6 Jul 2026).