A code is a set of points in Hamming space with enough elbow room to survive noise. Parallel coordinates lets you see the codewords and the distance between them.
Bits flip in noisy channels. If allowed messages are drawn from a chosen set with enough separation, damage can be detected and repaired. The geometric statement: pick messages so no two are too close, so a little noise cannot push one all the way to another.
Hamming distance counts positions where two strings disagree. A codeword survives t bit flips if every other codeword is at distance at least 2t+1 away.
Hamming distilled this into a concrete scheme in 1950; his contemporary Golay pushed it into 24 dimensions. Today Reed-Solomon protects CDs and QR codes; Reed-Muller decoded the Mariner photos; LDPC carries 5G data. All are the same geometry: pack points into high-dimensional space so their separation survives noise.
Error correction is sphere packing. Each codeword claims a ball of acceptable corruptions; as long as the balls don't overlap, any received word inside a ball snaps to the center.
Four data bits plus three parity bits give a seven-bit codeword. The map is linear, so the code is the row span of a 4×7 generator matrix G. There are 2⁴ = 16 codewords.
The left block is the identity: the data bits appear unchanged in positions 1 to 4. The right block P specifies the parity bits as sums of data bits: parity-1 = d2+d3+d4, parity-2 = d1+d3+d4, parity-3 = d1+d2+d4. Every arithmetic is mod 2. The parity check matrix is H = [PT | I3]; a seven-bit vector r is a codeword exactly when HrT = 0. The syndrome of a received word is this product, and when an error flips a single bit the syndrome is the column of H at that position, and the decoder simply reads it off.
The minimum Hamming distance between any two of the 16 codewords is three. Every nonzero codeword has weight ≥ 3. A single bit flip leaves the received word at distance 1 from the original but at distance ≥ 2 from every other codeword, so decoding is unambiguous. In parallel coordinates, every pair of polylines disagrees on at least three axes.
In decode mode: click any axis position to flip a bit. The decoder finds the nearest valid codeword.
Figure 1. The sixteen codewords of the Hamming [7,4,3] code, laid out as polylines across seven binary axes (bit 1 on the left, bit 7 on the right). The four data bits sit on the left, the three parity bits on the right. Every pair of polylines differs on at least three axes; you can pick any two and count. In decoding mode, the orange line is the received word after bit flips. The green line is the nearest codeword, the decoder's best guess.
Fix a codeword and look at everything within distance one of it: the codeword itself plus the seven words you get by flipping any one bit. Eight points. Do the same for all sixteen codewords. That is 16 × 8 = 128 points, and {0,1}7 has exactly 27 = 128 points. The spheres tile the space perfectly. Every seven-bit string is within distance one of exactly one codeword. There is nothing left over and nothing double-counted.
A code whose spheres tile the space with equality is perfect. Perfect binary codes are almost nonexistent: the Hamming family (one per dimension 2m−1), the binary Golay code in 23 dimensions, and trivial repetition codes. The classification is complete.
Figure 2. The 128 points of {0,1}7, drawn as a disk around each of the 16 Hamming codewords. Each disk is a Hamming-distance-1 ball: the codeword and its seven single-flip neighbors. 16 × 8 = 128 perfectly covers the 128 possible seven-bit strings. Hover a codeword to highlight its ball and see the neighbors light up.
The Hamming bound makes the sphere-packing constraint quantitative. If a code has length n, minimum distance d, and can therefore correct t = ⌊(d−1)/2⌋ errors, its size is capped by:
The denominator is the number of points inside a Hamming ball of radius t. The numerator is the ambient space. A code achieves equality exactly when it is perfect. Every other code leaves gaps between the spheres and falls short of the bound.
Figure 3. The Hamming bound for binary codes at various lengths n. The curve is the log-scale bound on log2|C|; every code lives on or below it. Known codes are plotted as dots. The Hamming [7,4] and Golay [23,12] sit exactly on the curve; they are perfect. BCH, Reed-Muller, and Reed-Solomon codes sit below, with room left over that nobody has ever managed to fill.
Reed-Muller codes are a family parameterized by two integers: an order r and a dimension m. The length is always n = 2m. The minimum distance is 2m−r. They are among the oldest families of codes, dating to 1954, and they are defined recursively. The code RM(r, m) is built from RM(r, m−1) and RM(r−1, m−1) by the rule:
Every codeword has length 2m: the first half comes from RM(r, m−1), and the second half is that same word XOR-ed with a codeword from the shorter, lower-order subcode. This is the Plotkin (u, u+v) construction, and it works because distances compose cleanly: if v is nonzero, its weight adds to that of the second half. Reed-Muller codes are the recursively-built siblings of the Hamming family.
The first-order code RM(1, 3) has length 8, contains 16 codewords, and has minimum distance 4. It was used by the Mariner 9 mission in 1971 to relay photographs of Mars. A similar code flew on Mariner 6, 7, and on the Voyager missions, the reason any image of the outer planets reached the ground intact.
Figure 4. RM(1, 3): the 16 codewords of the first-order Reed-Muller code in 8 dimensions. Each codeword is a polyline across eight binary axes. The (u, u+v) split is visible as two halves: axes 1-4 form the u block, axes 5-8 form u+v. Minimum distance is 4, twice that of Hamming [7,4]; this code corrects single errors and detects triples.
Reed-Solomon protects CDs, DVDs, QR codes, DSL modems, deep space probes, and distributed storage. It handles burst errors (long consecutive damage from scratches or cosmic rays).
The trick is symbols instead of bits. A Reed-Solomon code over GF(q) has length n ≤ q with each position taking one of q values. A burst of 8 flipped bits in a byte-symbol code is one symbol error. CDs use Reed-Solomon over GF(256).
Here we show a toy example: Reed-Solomon over the 8-element field GF(8). The generator evaluates polynomials of degree at most 2 at the eight points of the field, giving a [8, 3] code with minimum distance 6, correcting up to 2 symbol errors. Instead of a binary axis, each of the 8 axes takes values in {0, 1, α, α2, ..., α6} where α is a primitive root.
Figure 5. A Reed-Solomon [8, 3, 6] code over GF(8). The 512 codewords are polynomials of degree up to 2 evaluated at the eight field elements. Each axis takes one of eight symbol values; color marks each individual codeword. Under 2-symbol corruption, two axes flip to random symbols, but even so, the damaged polyline still lies closest (in symbol distance) to exactly one codeword.
Here is where coding theory and lattice geometry fuse into one subject. Take a binary code C in {0,1}n and embed it in ℤn by treating each bit as a 0 or 1 integer. Then take the union of all integer lattice points congruent to codewords mod 2:
This is Construction A. It is a lattice (closed under addition, closed under negation) because C is linear. Every codeword sits at the origin of a 2ℤn fundamental domain, and the sphere packing around it inherits the minimum distance of C. Distance d in Hamming space becomes distance √d in Euclidean space, since the bits that disagree each contribute 1 to the squared distance.
Construction A applied to the Hamming [7,4,3] code gives a 7D lattice with kissing number 14. Applied to the extended Hamming [8,4,4] code, it gives a lattice closely related to the E₈ root lattice. Applied to the binary Golay code with glue vectors, it produces the Leech lattice.
Hover a codeword to see its neighbors in the lattice.
Figure 6. Construction A applied to a small binary code, projected into 2D for visualization. Codewords form a sublattice of ℤ2/2ℤ2; each codeword seeds a family of lattice points that tile the plane. The sphere packing inherits the code's minimum distance. The full construction for Hamming [7,4] lives in 7D; for E8 in 8D; for the Leech lattice in 24D.
To close the loop we simulate the real job of a code: push a message through a channel that randomly flips bits, and let the decoder put it back together. For each trial, pick a codeword at random, flip each of its bits independently with probability p, compute the syndrome, and snap back to the nearest codeword. Count how often the decoder lands on the right codeword.
The Hamming [7,4] decoder always succeeds for ≤ 1 error and fails silently for ≥ 2. The success curve is flat near p = 0, concave up as errors accumulate, and asymptotic to 1/16 as the channel becomes pure noise.
Figure 7. Decoding performance of the Hamming [7,4] code on a binary symmetric channel with bit error probability p. The blue curve is codeword error rate: the chance that the decoder, after snapping to its nearest codeword, has landed on the wrong one. The gray curve is the raw channel: what happens if you send the 4 data bits unprotected. Below p ≈ 0.08 the code saves you; above, it makes things worse, because adding parity bits adds more targets for noise.
Every code has a crossover: low noise it helps, high noise it hurts. Engineers pick codes whose crossover exceeds the channel's worst-case noise.
The [7,4] code and its descendants bridge information theory (filters for noisy transmission), combinatorics (extremal packings in discrete spaces), and lattice geometry (seeds for dense sphere packings via Construction A — Hamming cube → E₈ → Leech lattice via the Golay code).
In parallel coordinates: a codeword is a polyline; minimum distance is the minimum number of axes where any two polylines disagree; decoding is snapping a noisy polyline to its nearest codeword.