4. Reed-Solomon Codes

Polynomial magic for burst error recovery

Hamming codes are elegant, but they correct only single-bit errors. Real-world corruption rarely strikes one isolated bit. A scratch on a CD wipes out thousands of adjacent bits. A burst of radio noise garbles a whole chunk of a satellite signal. A smudge on a QR code obliterates an entire region at once.

In 1960, Irving Reed and Gustave Solomon published a code that operates on multi-bit symbols rather than individual bits, correcting multiple symbol errors in a row. Reed-Solomon codes became one of the most widely deployed error-correction schemes in history: CDs, DVDs, QR codes, deep-space probes, RAID 6, satellite TV, and digital broadcasting all rely on them.

Symbols, Not Bits

A Hamming code sees data as individual bits. A Reed-Solomon code sees symbols — typically bytes (8-bit values, 0–255). The notation RS(n, k) means n total symbols, k data symbols, n−k check symbols, correcting up to t = (n−k)/2 symbol errors.

RS(255, 223) — a common real-world code

Total symbols:  255 (each = 1 byte)    Data: 223    Check: 32
Correctable:    32/2 = 16 symbol errors
Up to 16 corrupted bytes — anywhere in the codeword — fully
corrected. Each bad byte can have any number of flipped bits.
Why burst errors don't matter: A scratch destroys 8 consecutive bits? That's at most 2 byte-symbols. RS(255,223) corrects 16 — a 2-symbol burst is trivial. A Hamming code would be overwhelmed by 8 simultaneous bit errors.

Hamming Code

  • Works on individual bits
  • Corrects 1 bit error per block
  • Detects 2 bit errors (SECDED)
  • Burst of 8 bad bits → uncorrectable

Reed-Solomon Code

  • Works on multi-bit symbols (bytes)
  • Corrects multiple symbol errors
  • RS(255,223) corrects up to 16 bad bytes
  • Burst of 8 bad bits → 1–2 symbols, easily fixed

The Polynomial Idea

The mathematical heart of RS codes: represent data as a polynomial, then oversample it. Take k data symbols as coefficients of a degree-(k−1) polynomial:

Data as a polynomial

Data symbols: [3, 1, 4]  (k = 3)
Polynomial:   P(x) = 3x² + 1x + 4   (degree k-1 = 2)

Key fact: a polynomial of degree k−1 is uniquely determined by k points. Evaluate it at n > k points and you have redundancy. Even if some points are corrupted, the receiver can reconstruct the original polynomial from the remaining correct points.

The line analogy: Two points define a line. A third point overdetermines it — if it doesn't lie on the line, you know it's wrong and can identify the outlier. With enough extra points, you tolerate multiple corrupted values and still recover the original. RS codes apply this logic to higher-degree polynomials over finite fields.

Finite Fields (Galois Fields)

Normal integer arithmetic can overflow when multiplying polynomials. We need a number system where all operations stay within a fixed range. That system is a Galois Field, written GF(q). RS codes use GF(28) = GF(256) — 256 elements (0–255), one per byte.

  • Addition / Subtraction: XOR. 5 + 3 = 5 XOR 3 = 6.
  • Multiplication: Polynomial multiplication mod an irreducible polynomial: x⁸+x⁴+x³+x²+1 (0x11D).
  • Division: Multiply by the multiplicative inverse.

GF(256) operations — a taste

Addition:       37 + 22 = 37 XOR 22 = 51
                (00100101 XOR 00010110 = 00110011)
Subtraction:    37 - 22 = 37 XOR 22 = 51  (same as addition!)
Multiplication: 7 * 3 in GF(256):
  7 = x²+x+1,  3 = x+1
  (x²+x+1)(x+1) = x³+x²+x+x²+x+1 = x³+1 = 9
  So 7 * 3 = 9.  Every result fits in one byte.

Encoding: Worked Example

We'll use GF(23) = GF(8) (8 elements, 0–7) to keep numbers small. Code: RS(7, 3) — 7 symbols, 3 data, 4 check, corrects up to 2 errors.

Setup: GF(8) uses irreducible polynomial x³+x+1. Primitive element α satisfies α³=α+1 (decimal 3). Powers of α: α⁰=1, α¹=2, α²=4, α³=3, α⁴=6, α⁵=7, α⁶=5.

Step 1: Data polynomial

Data symbols: [5, 3, 6]

D(x) = 5x² + 3x + 6

Step 2: Generator polynomial

Roots at α¹ through α⁴ (2t = 4 check symbols):

g(x) = (x+2)(x+4)(x+3)(x+6)   [subtraction = XOR = addition]
  (x+2)(x+4) = x² + 6x + 3    [4 XOR 2=6; 2*4=3 in GF(8)]
  (x+3)(x+6) = x² + 5x + 7    [6 XOR 3=5; 3*6=7 in GF(8)]
  g(x) = (x²+6x+3)(x²+5x+7) = x⁴ + 3x³ + x² + 2x + 2

Step 3: Shift data up by 4 positions

D(x) · x⁴ = 5x⁶ + 3x⁵ + 6x⁴    (room for 4 check symbols below)

Step 4: Divide to find check symbols

D(x)·x⁴ ÷ g(x): polynomial long division in GF(8)...
Remainder r(x) = 4x³ + 3x² + 2x + 5

Step 5: Final codeword

C(x) = D(x)·x⁴ + r(x) = 5x⁶+3x⁵+6x⁴+4x³+3x²+2x+5
Symbols: [5, 3, 6, 4, 3, 2, 5]
          -------  -----------
           data     check symbols
Divisible by g(x) with zero remainder. Any corruption → nonzero remainder.

How Decoding Works (Conceptual)

The full math is graduate-level algebra, but the conceptual flow is clear:

Step 1: Compute syndromes

Evaluate received polynomial at the generator's roots. All zero = no errors.

Step 2: Find error locator polynomial

From the syndromes, compute Λ(x) whose roots reveal error positions. Algorithms: Berlekamp-Massey or Euclidean.

Step 3: Find error positions (Chien search)

Evaluate Λ(x) at every position α⁰..αn-1. Zeros mark error locations. Fast because n ≤ 255.

Step 4: Find error values (Forney algorithm)

Compute how much each symbol was corrupted — the exact value to XOR.

Step 5: Correct

XOR error values into the received word. Original codeword restored.

Syndromes are the key: The 2t syndrome values carry enough information to identify up to t error positions and t error values — exactly 2t unknowns from 2t equations.

QR Codes: RS in Action

Every QR code uses RS over GF(256). Four error-correction levels trade capacity for resilience:

QR Code error correction levels

Level  Recovery  Use case
-----  --------  ------------------------------------
  L      ~7%     Max capacity; clean environments
  M     ~15%     Standard; moderate handling (default)
  Q     ~25%     Durable; packages, outdoor signage
  H     ~30%     Max resilience; logos in code, heavy wear

Higher levels use more check symbols, leaving less room for data.

This is why QR codes scan even when partially covered by a logo or damaged. The RS layer recovers missing data from surviving symbols.

Compact Discs: Surviving Scratches

CDs use a two-layer RS scheme called Cross-Interleaved Reed-Solomon Coding (CIRC):

CIRC: two RS layers with interleaving

Inner code:    RS(32, 28)  — corrects up to 2 symbol errors
Interleaving:  spreads symbols across ~109 frames
Outer code:    RS(28, 24)  — corrects up to 2 symbol errors
Result: a ~2.5 mm scratch (~4,000 bits) is fully correctable.
Why two layers with interleaving? Interleaving spreads adjacent symbols far apart, so a physical scratch becomes many isolated errors across different codewords after de-interleaving. Each codeword sees only 1–2 errors. The two layers provide defense in depth: what the inner code misses, the outer code catches.

Deep Space: Voyager to Mars

When a spacecraft is billions of kilometers away, retransmission is impractical. A round-trip to Mars: 6–44 minutes. To Voyager: over 40 hours. Data must arrive correct on the first try.

  • Voyager (1977): RS(255,223) + rate-1/2 convolutional code. Reliable communication from beyond Neptune.
  • Mars rovers: RS codes in every downlink — Spirit, Opportunity, Curiosity, Perseverance.
  • James Webb Space Telescope: RS-based FEC for science data from 1.5 million km away at L2.

Reed-Solomon in the Wild

Where RS codes are used today

Application           RS variant / details
-------------------   ----------------------------------
CD / DVD / Blu-ray    CIRC (Cross-Interleaved RS)
QR codes              RS over GF(256), 4 EC levels
RAID 6                RS-based dual parity (2 disk failures)
DVB / Satellite TV    RS(204,188) in DVB-T/S/C
DSL / ADSL            RS(255,239) in DMT modulation
Deep space (NASA)     RS(255,223) + convolutional code
Data Matrix barcodes  RS over GF(256)
Distributed storage   Erasure coding in HDFS, Ceph, Azure

Try It Yourself — RS(7,3) over GF(8)

Part 1 — Encoding

Choose three data symbols (0–7). The encoder builds a degree-2 polynomial, divides by the generator, and appends four check symbols.

Part 2 — Error Simulation & Decoding

Click any symbol below to corrupt it with a random value. RS(7,3) can correct up to 2 symbol errors. Try introducing 1, 2, or 3 errors to see what happens.

What's Next

We've mentioned interleaving several times — the technique that turns one long burst error into many small, scattered errors that individual codewords can handle. Next, we'll see exactly how interleaving works, why symbol order matters, and how it combines with Reed-Solomon to create correction systems far more powerful than any single code alone.

Key Takeaways

  • RS codes operate on multi-bit symbols (bytes), not bits — naturally resilient to burst errors.
  • RS(n,k) corrects up to (n−k)/2 symbol errors, regardless of how many bits within each symbol are wrong.
  • Encoding treats data as a polynomial over GF(28), keeping all values within byte range.
  • Decoding uses syndromes, error-locator polynomials, and the Forney algorithm — no retransmission needed.
  • RS codes are the backbone of CDs, QR codes, RAID 6, deep-space links, satellite TV, and more.
  • Combined with interleaving, RS codes handle bursts far larger than a single codeword's capacity — as CIRC demonstrates.