GET THE APP
Artwork for Error-Correcting Codes: How Machines Learned to Repair Messages
Origins

Error-Correcting Codes: How Machines Learned to Repair Messages

From punched-card failures to scratched discs, discover how mathematical checks let machines reconstruct information damaged in transit.

Saturday, September 5, 2026 • 7:19 min

Read the episode (Narration script)

Welcome to Origins. In this program we explore the technological and scientific roots of the modern world. Let's begin.

A hole punched in the wrong place can ruin a weekend.

At Bell Telephone Laboratories in the 1940s, the mathematician Richard Hamming submitted calculations to a large electromechanical computer. His instructions arrived on punched cards. Inside the machine, relays clicked through operations that would have taken a person much longer.

But the computer had a frustrating habit. It could recognize certain errors in its input without knowing how to repair them.

During the working week, an operator could intervene. On weekends, when Hamming had access, an error could simply stop his job and send the machine onward to someone else's.

Hamming later recalled the irritation of returning to discover that another run had failed.

That irritation suggested a question. If a machine could identify that something was wrong, could it also determine what was wrong and fix it?

Today's subject is the error-correcting code: a way of arranging information so that damage leaves enough evidence for the original message to be reconstructed.

The problem is older than computers.

A shouted instruction crosses a windy harbor. A manuscript passes through generations of copyists. A telegraph operator mistakes one signal for another. Every method of communication has opportunities for information to change between sender and receiver.

Human language already offers some protection. A sentence with a missing letter often remains readable because its other letters, its grammar, and its subject constrain what belongs in the gap.

A column of numbers offers fewer clues. Change one digit in a payroll total, and the result may still look perfectly respectable.

Machines needed a deliberately constructed version of the clues that language supplies naturally.

One early approach was the parity check.

Imagine a message made of switches, each either off or on, represented by zeros and ones. Add one extra digit so that the total number of ones is even.

The receiver counts again. If the total is odd, something has changed.

That additional digit carries no payroll amount, scientific measurement, or instruction. It describes a property of the other digits.

Yet the protection is limited. An even count does not guarantee an undamaged message, because two changes can cancel each other. And an odd count does not reveal which digit went wrong.

It is rather like knowing that a shipment is one crate short without knowing which crate is missing.

Hamming wanted a more informative inspection.

The simplest repair scheme would be repetition. Send every digit three times. A one becomes three ones. If the receiver gets two ones and a zero, it chooses the majority.

Provided only one digit in that group has changed, the original can be recovered.

But sending everything three times consumes three times the capacity. Telephone companies, computer operators, and eventually spacecraft engineers had reasons to seek something more economical.

Hamming's solution used several checks, each watching a different, overlapping group of digits.

Picture a warehouse where every crate belongs to a particular combination of inspection groups. One inspection covers certain rows, another covers alternating positions, and another covers a different selection.

If one crate has a problem, a distinctive combination of inspections fails. Their pattern identifies the crate.

In Hamming's code, the failed checks identify the position of a changed digit. The receiver can then reverse it.

One compact arrangement carries four message digits with three checking digits. Across those seven positions, any single changed digit can be located and corrected. Even a damaged checking digit can be identified.

The checks protect the whole arrangement, including one another.

Hamming published his influential paper in 1950. By then, Bell Labs had also produced a broader explanation of what such methods might achieve.

In 1948, Claude Shannon published his mathematical theory of communication. His central concern was how much information could pass reliably through a channel disturbed by noise.

Noise might mean electrical interference on a wire, static in a radio receiver, or any other process that confuses one signal with another.

Shannon showed that a noisy channel has a capacity. Below that limit, suitable encoding can, in principle, make the error rate arbitrarily small, given sufficient coding length and complexity.

The promise had conditions. It did not mean that every message could survive any damage. Nor did Shannon hand engineers a convenient recipe for building every code his mathematics said could exist.

His work established that reliable communication did not require a perfectly reliable physical channel.

For engineers working with imperfect components, that was an important permission.

The next challenge was to turn the possibility into practical machinery.

In 1960, Irving Reed and Gustave Solomon, working at MIT's Lincoln Laboratory, published a different family of codes. These treated groups of digits as mathematical symbols and constructed relationships among them.

Their approach became particularly valuable when errors arrived in clumps.

A scratch across a compact disc, for example, can obscure a run of recorded information. Repeating a nearby digit would offer little protection if the same scratch destroyed both copies.

Disc systems therefore combine error correction with interleaving. Information that belongs together is distributed across different recorded positions. After reading, it is put back into order.

A concentrated scratch is thereby spread into smaller gaps across multiple protected groups, which the codes may be able to repair.

The music continues because the player reconstructs missing information within the code's limits. Beyond those limits, it must conceal the damage or fail audibly.

Related methods protect spacecraft transmissions, computer memory, storage drives, and the patterned squares of QR codes. The appropriate code depends on the expected damage, the available processing power, and how much extra information can be afforded.

There is always a budget.

What began with failed calculations became a way to build dependable systems from components and channels that sometimes misbehave.

Hamming's weekend frustration exposed a distinction that remains central to engineering. Detecting a failure tells a system to stop. Encoding enough structure in advance can sometimes tell it how to continue.

Behind an uninterrupted song or a readable message lies information placed there before anything went wrong, specifically for the moment when something would.

That is the origin of error correction. Thank you for listening to Origins.

Your Daily Knowledge Companion

Download the Treehorn mobile app

Scan to get the Treehorn appGet the app Get the app