Error Correction, Explained

AdvancedAbout 12 minData & binary

Hamming distance isn't just a game mechanic. It's how computers catch their own mistakes.

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.

Before
After

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

Check your understanding

5 quick questions. Pick one answer for each — you'll see why straight away.

  1. Which of these can flip a bit by accident while data is moving?

  2. Why are extra check bits added to data?

  3. Do the check bits carry any new information?

  4. With an error-correcting code, if a single bit flips on the way, the receiving computer can…

  5. Adding extra bits that aren't needed when nothing goes wrong is an example of…