Richard Hamming: how one frustrated mathematician made data repair itself

nutwani911 pts1 comments

When Bits Flip and Everything Breaks: Richard Hamming's Self-Correcting Code

Nirmal Utwani

SubscribeSign in

When Bits Flip and Everything Breaks: Richard Hamming's Self-Correcting Code<br>Week 03 of the Turing Award Series — how one frustrated mathematician made data repair itself<br>Nirmal Utwani<br>Jun 11, 2026

Share

Week 03 of my learning series on Turing Award winners: Richard Hamming.<br>Richard Hamming, a mathematician, was trying to do what all of us do today. Submit a bunch of jobs Friday evening, expect the machine to keep running all weekend, and have stuff ready Monday morning.<br>It wasn’t as smooth for him. He’d come back with nothing done, because random bits were flipping mid-run, corrupting the computation and stopping it cold.

My Take

He decided the data could carry enough extra information to fix itself. A few extra bits added to whatever you’re transmitting is all it takes, and if a bit flips in transit, those bits tell you exactly which one flipped so you can fix it without retransmitting or restarting. This is now the foundation of everything we do. Think about RAM, SSDs, hard disks, QR codes, even deep space telemetry. Most error-correcting codes today trace back to this one 1950 paper.<br>Bit flipping happens way more than you’d expect. RAM is the worst case. Google published a study showing a typical server sees one to two bit flips a day in memory, and a data center has hundreds of thousands of machines with bits flipping constantly. Without error correction, servers silently compute the wrong answers. It would feel like the servers are hallucinating and giving you wrong answers.<br>The Mag-7, the hyperscalers, the H100 clusters training the next frontier model, they all run on hardware that self-corrects at the bit level, all because of Hamming’s work in 1950.

What He Actually Did

Richard Hamming won the Turing Award in 1968 “for his work on numerical methods, automatic coding systems, and error-detecting and error-correcting codes.”<br>The error-correcting code is what changed everything.<br>The Problem<br>In the 1940s, computers at Bell Labs ran on punched cards and electromechanical relays. They were unreliable. Bits would flip. A calculation that ran overnight would finish with a wrong answer, and you’d have no idea where the error crept in.<br>Hamming worked weekdays. The machine ran his jobs on nights and weekends. Every error cost him a full week of waiting.<br>He spent his weekends furious about this.<br>The Insight<br>Before Hamming, error detection existed. A single parity bit appended to a byte can tell you that some bit flipped, but not which one. To correct an error you need to know its location.<br>Hamming’s idea: add a few extra bits whose values are determined by the data bits. These “parity bits” are placed at specific positions so that any single flipped bit disturbs a unique combination of them.<br>The receiver checks all the parity bits and computes a number called the syndrome .<br>If the syndrome is zero, no error.<br>If it’s nonzero, the syndrome is literally the position of the bad bit. Flip it back. Done.<br>How It Works — Hamming(7,4)<br>4 data bits become 7 bits total. Three parity bits buy you full single-error correction.<br>Here’s the actual process:<br>Step 1: You have data to send: 1011<br>Step 2: Positions that are powers of 2 get parity bits. Everything else gets data.<br>position: 1 2 3 4 5 6 7<br>type: p1 p2 d1 p4 d2 d3 d4<br>bit: ? ? 1 ? 0 1 1

Step 3: Each parity bit covers specific positions based on binary representation.<br>p1 (pos 1): covers positions 1, 3, 5, 7

p2 (pos 2): covers positions 2, 3, 6, 7

p4 (pos 4): covers positions 4, 5, 6, 7

Each parity bit is set so its group XORs to zero:<br>p1: 1 XOR 0 XOR 1 = 0 → p1 = 0<br>p2: 1 XOR 1 XOR 1 = 1 → p2 = 1<br>p4: 0 XOR 1 XOR 1 = 0 → p4 = 0Final codeword: 0110011<br>Step 4: Transmit it. A bit flips. Position 5 changes from 0 to 1.<br>sent: 0 1 1 0 0 1 1<br>received: 0 1 1 0 1 1 1<br>bit flipped<br>Step 5: Receiver recomputes all three groups:<br>p1 checks 1,3,5,7: 0 XOR 1 XOR 1 XOR 1 = 1 ✗ broken<br>p2 checks 2,3,6,7: 1 XOR 1 XOR 1 XOR 1 = 0 ✓ fine<br>p4 checks 4,5,6,7: 0 XOR 1 XOR 1 XOR 1 = 1 ✗ brokenStack the results: p4=1, p2=0, p1=1 → binary 101 → 5<br>The syndrome points directly to position 5. Flip it back. Extract data: 1011 ✓<br>No retransmit. No restart. The data fixed itself.

Where You See This Today

ECC Memory: Every server in every data center. RAM modules have extra chips that store Hamming parity bits. When a cosmic ray flips a bit, the memory controller computes the syndrome and corrects it silently.<br>QR Codes: Reed-Solomon error correction, a descendant of Hamming codes. You can scratch off 30% of a QR code and it still scans.<br>Hard Disks and SSDs: Every sector has error-correcting codes. Bits rot. Controllers fix them.<br>Deep Space: Voyager uses Reed-Solomon codes over GF(2⁸). It’s 15 billion miles away and still sending data through a 20-watt transmitter. Error correction makes that possible.<br>5G and Wi-Fi 6: LDPC codes (low-density parity-check), which trace their lineage to...

bits error hamming data parity codes

Related Articles