Error Correction, Explained
Hamming distance isn't just a game mechanic. It's how computers catch their own mistakes.
Swipe or tap Next for the next section
The Problem: Data Gets Corrupted
Every time data moves — through the air to a satellite, across a network cable, sitting in your phone's memory — there's a small chance a bit flips by accident. A 0 becomes a 1, or a 1 becomes a 0. Usually caused by things like electrical interference, cosmic radiation, or a weak signal.
For a single wrong digit, that might not sound serious. But multiply it across billions of bits, and errors become inevitable. Computers need a way to catch them — and ideally, fix them — automatically.
The Idea: Add a Few Extra Bits
In the 1940s, a mathematician named Richard Hamming came up with a clever trick. Instead of just sending your data as-is, you add a small number of extra bits, calculated from the original data. These extra bits don't carry new information — they exist purely to check the rest.
If a bit gets flipped in transmission, those extra "check" bits won't line up anymore. And because of exactly where the mismatch shows up, the receiving computer can work out precisely which bit was wrong — and flip it back. No retransmission needed.
The highlighted bit is the one that flipped.
This Is the Same Idea as LogicDash
Sound familiar? It's the same core concept you use every time you play. In the game, you're told how many bits differ from the secret, and you use logic to figure out which ones. Real error-correcting codes do something similar, just automated — the extra check bits let a computer instantly pinpoint the flipped bit, without a human needing to guess at all.
Where This Shows Up in Real Life
- Satellites — sending data across huge distances, where interference is common and re-sending data is slow or expensive
- Computer memory (RAM) — many servers use error-correcting memory that silently fixes the occasional flipped bit, caused by things as small as background radiation
- QR codes and barcodes — built to stay scannable even when part of the code is smudged, torn, or dirty
- CDs and DVDs — able to keep playing even with small scratches on the disc
5 quick questions. Pick one answer for each — you'll see why straight away.
Which of these can flip a bit by accident while data is moving?
Noise on a cable, a weak wireless signal, even cosmic rays can turn a 0 into a 1 or a 1 into a 0.
Why are extra check bits added to data?
The check bits are calculated from the data, so if a bit flips they no longer line up — which reveals the error.
Do the check bits carry any new information?
They're worked out from the original bits, so they add no new meaning, only a way to check.
With an error-correcting code, if a single bit flips on the way, the receiving computer can…
Where the check bits stop lining up points to the exact bit that flipped.
Adding extra bits that aren't needed when nothing goes wrong is an example of…
Extra copies or extra bits kept "just in case" are redundancy — it's what lets the system tolerate a fault.