jerry.systems
← archive

Losing Pieces, Keeping the Whole: Reed-Solomon Codes

How Reed-Solomon codes let a scratched CD keep playing, from polynomials and parity to the shuffle that makes burst errors easy to fix.

Introduction: Planning for Loss

Imagine mailing a friend a long letter, knowing the postal service sometimes loses pages. So you add a few extra pages that carry no new story. They are built cleverly from the pages you already wrote. Now your friend can lose a few sheets along the way and still reconstruct the entire letter. That, in spirit, is a Reed-Solomon code.

The Idea Behind Reed-Solomon

Irving Reed and Gustave Solomon published the idea in 1960, working at MIT’s Lincoln Laboratory. It rests on something you may remember from school: two points define exactly one straight line, three points define exactly one parabola, and in general, a certain number of points pin down exactly one polynomial.

Reed-Solomon treats your data as points on such a curve. Then it computes extra points on the same curve and sends everything together. Since the curve is fixed by any sufficient subset of its points, you can lose some of them, as long as enough survive, and the curve can be rebuilt. The data rides along with it.

Erasures vs. Errors

There is a subtle gift in this. If the receiver knows which pieces went missing, each loss costs one extra point to repair. If the damage is hidden, the code must also work out where it happened, which costs two. So a code with four spare points can recover four known gaps, or two unknown corruptions.

It is a bit like a teacher who can fix a smudged word easily when she can see the smudge, but has to detect the mistake first when it looks like a perfectly normal word.

How a Scratched CD Still Plays

Now think of a compact disc. Music is stored as microscopic pits, and a scratch or fingerprint does not politely damage one bit. It wipes out a whole stretch. Engineers at Philips and Sony knew a single Reed-Solomon code would choke on that, so they added a shuffle.

Data is scrambled across the disc before writing, so that one long scratch ends up nicking a few bytes from many different codewords rather than destroying one completely. When the player reads the disc, it unshuffles everything, and the damage looks like small, scattered gaps. Those are exactly what Reed-Solomon fixes best.

Two Reed-Solomon layers, with the shuffling in between, form the system called CIRC. It can repair a burst of roughly 2.5 millimeters of damage. Beyond that, the player estimates the missing audio from the samples around it, and you might never notice.

Beyond the Music Collection

This same idea travels far beyond your CDs. Reed-Solomon helped Voyager send photographs across billions of kilometers of noisy emptiness. It is why a QR code still scans after a coffee stain or with a logo stamped in the middle. It protects DVDs, Blu-rays, and the storage systems of data centers, where whole drives are expected to fail and the data must survive anyway.

Conclusion: Resilience by Design

What I find lovely about it is the attitude. It does not pretend the world is clean. Scratches happen, signals fade, disks die. Instead of demanding perfection, Reed-Solomon plans for loss with a little humility and a little extra, and the result is something that feels almost like resilience.

So the next time a battered disc plays without a hiccup, you are hearing a 1960s idea quietly refusing to give up.