Hamming codes, decoding spheres, and Reed-Solomon. Recovery from corruption.
Shannon's noisy channel coding theorem promises that reliable communication is possible up to channel capacity — but it does not tell you how. Error-correcting codes are the constructive answer. They take k information symbols, append redundancy, and transmit n > k symbols. A clever receiver can then recover the original message even when some of those symbols flip mid-flight.
The geometry behind every code is the same. Each codeword sits at the center of a decoding sphere in Hamming space — the set of all received words it is closer to than any other codeword. A code with minimum distance d has spheres of radius ⌊(d−1)/2⌋, so it can detect d−1 errors and correct ⌊(d−1)/2⌋. Hamming(7,4) has d = 3 and corrects one bit error per block; Reed-Solomon codes work over larger alphabets and correct symbol errors, which is why they protect CDs, QR codes, and the data packets sent home by the Voyager probes.
Toggle any data bit to re-encode; the parity bits update so every circle contains an even number of ones. Click any bit on the diagram to flip it (simulating channel noise). Failing parity circles turn red — the binary number formed by which circles fail is the syndrome, and it names the bit position to flip back. Try flipping two bits to see how the decoder is fooled into "correcting" the wrong one.
d_min = 3, so this code corrects 1 error. Each sphere has radius 1 — every received word lies in exactly one sphere. The cube shows every binary word of length 3. Codewords are large filled dots; non-codewords are color-coded by which codeword they decode to. The dashed circles are the decoding spheres of radius t = ⌊(d_min − 1)/2⌋. Click any vertex to choose a received word — the decoder maps it to the nearest codeword by Hamming distance.
Encode k = 3 symbols by treating them as the coefficients of a polynomial and evaluating at n = 7 points in GF(11). The Singleton bound says d ≤ n − k + 1 = 5, so this code corrects up to 2 symbol errors. Push the error slider beyond 2 and watch the recovered polynomial diverge from the true one — decoding is no longer guaranteed.