# Error-correcting code

> Source: https://modeladay.com/models/error-correcting-code/
> Category: principle | Topics: science | Difficulty: 3/5

## Definition

Deliberately adding controllable redundancy to detect and fix errors: fighting noise with spare bits.

## Core Rule

Deliberately add controllable redundancy to detect and correct errors — redundancy is the weapon against noise. Common forms: from the crudest "send it three times" to parity bits, Hamming codes, CRC, LDPC/polar codes — all essentially trade extra bits for reliability.

## Opening Context

On Friday, Richard Hamming left a batch of jobs with a computer and expected to collect the answers Monday. The machine could detect some errors, retry, and move on if a job still failed. He recalled coming back empty handed two weekends in a row.

If a machine already knew that something was wrong, could it find the bad bit and put it right?

An error-correcting code adds information that lets the receiver spot and repair certain errors. Follow what Hamming did after those weekends and you'll see what it takes to get past the alarm.

## How It Works (Preview)

To see what the machine was missing, start by adding one check bit. If the number of ones is odd, add one more to make it even. If the count is already even, add a zero.

When the receiver gets an odd count, it knows something changed, but it can't point to the bit. Hamming recalled trying a grid and checking each row and column. One failed row meets one failed column at the error, like streets at a crossing.

## When It Fails (Preview)

The next thing to check is what kinds of damage your insurance actually covers.

## Full Lesson, Audio & Practice

Get the full Error-correcting code breakdown, 5-minute audio lesson, interactive mechanism animation, and decision checklist in the ConceptFlow app:
- iOS App Store: https://apps.apple.com/app/conceptflow-mental-models/id6756862333
- Google Play: https://play.google.com/store/apps/details?id=com.juxianyp.conceptflow
- Web page: https://modeladay.com/models/error-correcting-code/

## Related Mental Models

- [Channel coding theorem](https://modeladay.com/models/channel-coding-theorem/)
- [Redundancy](https://modeladay.com/models/redundancy/)
- [Landauer's principle](https://modeladay.com/models/landauers-principle/)
