Drag a key across the underside of an audio CD and the track it crosses loses a strip of data. A scratch 2.5 mm long passes under the laser in about 2.1 milliseconds at the disc’s linear speed of 1.2 metres per second. At 7350 frames per second, that is roughly 15 frames, and since each frame carries 32 bytes of audio and check data, the scratch wipes out about 15 × 32 × 8 ≈ 3900 consecutive bits. The disc keeps playing without a click. The reason is a pair of Reed-Solomon codes.

What are Reed-Solomon codes? They are error-correcting codes in which a block of kk message symbols is turned into a polynomial of degree less than kk over a finite field, and the sender transmits that polynomial’s values at n>kn > k points. Any kk correct values pin down the polynomial uniquely, so the n−kn - k extra values are pure redundancy. A Reed-Solomon code can repair up to t=⌊(n−k)/2⌋t = \lfloor (n-k)/2 \rfloor symbols that arrive wrong at unknown positions, or up to n−kn - k symbols that are missing at known positions. Everything else in this article explains why that works, how a receiver actually finds the errors, and where the parameters in real systems come from.

A line through four points

Start over the real numbers, where pictures help. A line y=a+bxy = a + bx is determined by two points. Suppose the message is the pair (a,b)=(1,2)(a, b) = (1, 2), and instead of sending the two coefficients we send the line’s values at x=0,1,2,3x = 0, 1, 2, 3:

(0,1),(1,3),(2,5),(3,7).(0, 1),\quad (1, 3),\quad (2, 5),\quad (3, 7).

That is four numbers for a two-number message, so two numbers of redundancy. Now let the channel corrupt the third value, so the receiver sees

(0,1),(1,3),(2,9),(3,7).(0, 1),\quad (1, 3),\quad (2, 9),\quad (3, 7).

There are six pairs of points, and each pair defines a line. The three pairs drawn from {(0,1),(1,3),(3,7)}\{(0,1), (1,3), (3,7)\} all give the same line y=1+2xy = 1 + 2x, which passes through three of the four received points. The pair (0,1),(2,9)(0,1), (2,9) gives y=1+4xy = 1 + 4x, which passes through those two and nothing else. Every line through the corrupted point fits exactly two points; the true line fits three. Majority wins, and the receiver recovers (a,b)=(1,2)(a, b) = (1, 2) and even learns that the value at x=2x = 2 was wrong.

This is the entire idea. A polynomial of low degree is rigid: it cannot bend to pass through many wrong points. Two distinct lines meet in at most one point, so a single corrupted value can never make a wrong line look as good as the right one when four values are sent. Our article on polynomial interpolation proves that kk points determine a unique polynomial of degree less than kk; a Reed-Solomon code is that theorem used in reverse, sending more points than needed so that the excess can outvote damage.

Real numbers are the wrong setting for doing this in practice, for two reasons. First, values grow without bound: a polynomial of degree 200 evaluated at x=255x = 255 produces numbers with hundreds of digits, and no fixed-width symbol can hold them. Second, real arithmetic on a computer is rounded. A received value that is off by 10−1210^{-12} might be a genuine error or might be rounding noise, and high-degree interpolation amplifies such noise enormously, as the Runge and Lebesgue-constant examples in the interpolation article show. What is needed is an arithmetic that is exact, closed, and finite, in which the algebra of polynomials still works. That is a finite field.

Finite fields, just enough

A field is a set with addition, subtraction, multiplication and division by non-zero elements, obeying the usual rules. The fact Reed-Solomon codes need is that over any field, a non-zero polynomial of degree dd has at most dd roots. That holds because a field has no zero divisors: if f(r)=0f(r) = 0 then f(x)=(x−r)g(x)f(x) = (x - r)g(x), and a product of non-zero elements is never zero.

The simplest finite fields come from modular arithmetic. For a prime pp, the integers modulo pp form the field Fp\mathbb{F}_p. In F11\mathbb{F}_{11}, for instance, 3⋅4=12≡13 \cdot 4 = 12 \equiv 1, so 3−1=43^{-1} = 4, and every non-zero element has an inverse in the same way. Modulo a composite number this breaks: in the integers modulo 256, the element 2 has no inverse, since 2y2y is always even and never congruent to 1.

Computers want symbols that are bytes, so they want a field with exactly 256 elements. Finite fields exist with pmp^m elements for every prime pp and every m≥1m \ge 1, and they are unique up to isomorphism, a result that sits naturally in the theory around Galois theory. To build F28\mathbb{F}_{2^8}, take polynomials with coefficients in F2={0,1}\mathbb{F}_2 = \{0, 1\} and reduce them modulo a fixed irreducible polynomial of degree 8. The choice that QR codes, DVB satellite television and the Linux RAID-6 driver all use is

p(x)=x8+x4+x3+x2+1,p(x) = x^8 + x^4 + x^3 + x^2 + 1,

written in hexadecimal as 0x11D. A short computation confirms it has no factor of degree 1 to 4, so it is irreducible, and the element xx (the byte 0x02) is primitive: its powers run through all 255 non-zero elements before returning to 1. A byte b7b6⋯b0b_7 b_6 \cdots b_0 stands for b7x7+⋯+b1x+b0b_7 x^7 + \cdots + b_1 x + b_0. Addition is coefficientwise modulo 2, which is bitwise exclusive-or, so addition and subtraction are the same operation.

One multiplication by hand: take 0xC3=x7+x6+x+1\texttt{0xC3} = x^7 + x^6 + x + 1 and 0x06=x2+x\texttt{0x06} = x^2 + x. Multiply out, cancelling equal terms in pairs because 1+1=01 + 1 = 0:

(x7+x6+x+1)(x2+x)=x9+x7+x3+x(0x28A).(x^7 + x^6 + x + 1)(x^2 + x) = x^9 + x^7 + x^3 + x \qquad (\texttt{0x28A}).

The degree is 9, so subtract (that is, XOR) x⋅p(x)=x9+x5+x4+x3+xx \cdot p(x) = x^9 + x^5 + x^4 + x^3 + x:

x7+x5+x4(0xB0).x^7 + x^5 + x^4 \qquad (\texttt{0xB0}).

So 0xC3⋅0x06=0xB0\texttt{0xC3} \cdot \texttt{0x06} = \texttt{0xB0} in this field. The modulus matters: AES uses a different degree-8 polynomial, 0x11B, and under it 0x53⋅0xCA=0x01\texttt{0x53} \cdot \texttt{0xCA} = \texttt{0x01}, whereas under 0x11D the same product is 0x8F. The QR code article walks through a longer multiplication and the logarithm tables used in practice; here it is enough to know that F256\mathbb{F}_{256} arithmetic is exact, one byte per symbol, and cheap.

A complete example over F₁₁, decoded by hand

To see every step, work in F11\mathbb{F}_{11} with k=2k = 2 and n=6n = 6. The message is two symbols, (4,3)(4, 3), read as the polynomial m(x)=4+3xm(x) = 4 + 3x. Evaluate at x=1,2,3,4,5,6x = 1, 2, 3, 4, 5, 6, reducing modulo 11:

m(1)=7, m(2)=10, m(3)=13≡2, m(4)=16≡5, m(5)=19≡8, m(6)=22≡0.m(1) = 7,\ m(2) = 10,\ m(3) = 13 \equiv 2,\ m(4) = 16 \equiv 5,\ m(5) = 19 \equiv 8,\ m(6) = 22 \equiv 0.

The codeword is (7,10,2,5,8,0)(7, 10, 2, 5, 8, 0). Here n−k=4n - k = 4, so the code should correct t=2t = 2 errors. Let the channel add 5 to the second symbol and 3 to the fifth, so the receiver sees

r=(7,4,2,5,0,0).r = (7, 4, 2, 5, 0, 0).

Decoding by consistency. With k=2k = 2 the brute-force method is still feasible. There are (62)=15\binom{6}{2} = 15 pairs of positions; each defines a line. Computing them all, the line 4+3x4 + 3x arises from 6 pairs and agrees with the received word at 4 positions (x=1,3,4,6x = 1, 3, 4, 6). A second line, 3+6x3 + 6x, arises from 3 pairs and agrees at 3 positions (x=2,4,5x = 2, 4, 5), since 3+6⋅2=15≡43 + 6 \cdot 2 = 15 \equiv 4, 3+6⋅4=27≡53 + 6 \cdot 4 = 27 \equiv 5 and 3+6⋅5=33≡03 + 6 \cdot 5 = 33 \equiv 0. Every other line agrees at only 2. The impostor comes close, which is a reminder that two errors is the limit here: a third error could have handed it the majority. The decoder outputs 4+3x4 + 3x.

Brute force scales badly, since there are (nk)\binom{n}{k} subsets to try. A cleverer method is due to Lloyd Welch and Elwyn Berlekamp, in a patent filed in 1983 and granted in 1986.

Decoding by Berlekamp–Welch. Suppose at most e=2e = 2 errors. Introduce an unknown error-locator polynomial E(x)E(x), monic of degree ee, whose roots are exactly the bad positions. Then at every point,

m(xi) E(xi)=ri E(xi),m(x_i)\,E(x_i) = r_i\,E(x_i),

because either ri=m(xi)r_i = m(x_i), or E(xi)=0E(x_i) = 0 and both sides vanish. The left side is a polynomial Q(x)=m(x)E(x)Q(x) = m(x)E(x) of degree at most k−1+e=3k - 1 + e = 3. Neither mm nor EE is known, but the equation Q(xi)=ri E(xi)Q(x_i) = r_i\,E(x_i) is linear in the unknown coefficients. Writing E(x)=x2+e1x+e0E(x) = x^2 + e_1 x + e_0 and Q(x)=q0+q1x+q2x2+q3x3Q(x) = q_0 + q_1 x + q_2 x^2 + q_3 x^3 gives six unknowns and six equations, one per received symbol. For x=1x = 1 with r1=7r_1 = 7 the equation reads

q0+q1+q2+q3−7e0−7e1=7,q_0 + q_1 + q_2 + q_3 - 7e_0 - 7e_1 = 7,

and the others follow the same pattern. Gaussian elimination modulo 11 gives

E(x)=x2+4x+10,Q(x)=3x3+5x2+2x+7.E(x) = x^2 + 4x + 10, \qquad Q(x) = 3x^3 + 5x^2 + 2x + 7.

Check the locator first: (x−2)(x−5)=x2−7x+10≡x2+4x+10(x - 2)(x - 5) = x^2 - 7x + 10 \equiv x^2 + 4x + 10, so the roots are x=2x = 2 and x=5x = 5, precisely the corrupted positions. Check one equation: at x=1x = 1, Q(1)=17≡6Q(1) = 17 \equiv 6 and r1E(1)=7⋅15=105≡6r_1 E(1) = 7 \cdot 15 = 105 \equiv 6. Now divide:

3x3+5x2+2x+7x2+4x+10=3x+4,\frac{3x^3 + 5x^2 + 2x + 7}{x^2 + 4x + 10} = 3x + 4,

with remainder zero, since (3x+4)(x2+4x+10)=3x3+16x2+46x+40≡3x3+5x2+2x+7(3x + 4)(x^2 + 4x + 10) = 3x^3 + 16x^2 + 46x + 40 \equiv 3x^3 + 5x^2 + 2x + 7. The message (4,3)(4, 3) is recovered. The trick deserves emphasis: a nonlinear problem (find a polynomial and an unknown set of positions) became linear by multiplying through by a polynomial that vanishes on the unknown set.

The Singleton bound, and why Reed–Solomon meets it

The Hamming codes article explains why a code of minimum distance dd corrects ⌊(d−1)/2⌋\lfloor (d-1)/2 \rfloor errors. So the question for any code is how large dd can be.

The Singleton bound. For any code of length nn over an alphabet of size qq with qkq^k codewords, d≤n−k+1d \le n - k + 1. Proof: delete the last d−1d - 1 coordinates of every codeword. Two distinct codewords differ in at least dd positions, so they still differ after deleting d−1d - 1; the shortened words are therefore all distinct. There are qkq^k of them, inside a space of qn−d+1q^{n-d+1} possible words, so qk≤qn−d+1q^k \le q^{n-d+1} and d≤n−k+1d \le n - k + 1. The argument uses nothing about linearity or fields; it is pure counting.

Reed–Solomon distance. Two distinct message polynomials f≠gf \ne g of degree less than kk differ by f−gf - g, a non-zero polynomial of degree at most k−1k - 1. It has at most k−1k - 1 roots, so ff and gg agree on at most k−1k - 1 of the nn evaluation points, and their codewords differ in at least n−k+1n - k + 1 positions. Hence d=n−k+1d = n - k + 1 exactly.

Codes meeting the Singleton bound with equality are called maximum distance separable, or MDS. For a given amount of redundancy, no code can have larger distance. In the example above, n=6n = 6, k=2k = 2 and d=5d = 5: any two codewords differ in at least five of six places, which is why two errors could be corrected. The price of MDS is that the alphabet must be large. Reed–Solomon needs nn distinct evaluation points, so n≤qn \le q (or n≤q−1n \le q - 1 when using the non-zero powers of a primitive element), which is why byte-oriented codes have blocks of at most 255 or 256 symbols.

How decoders actually work: syndromes, Berlekamp–Massey, Chien, Forney

Berlekamp–Welch costs a Gaussian elimination, roughly n3n^3 operations. Production decoders use a different pipeline that is much cheaper and is the one implemented in hardware. It relies on an equivalent description of the code. When the evaluation points are the powers α0,α1,…,αn−1\alpha^0, \alpha^1, \ldots, \alpha^{n-1} of a primitive element and n=q−1n = q - 1, the codewords are exactly the polynomials c(x)=c0+c1x+⋯+cn−1xn−1c(x) = c_0 + c_1 x + \cdots + c_{n-1}x^{n-1} that vanish at α1,α2,…,αn−k\alpha^1, \alpha^2, \ldots, \alpha^{n-k}. Encoding by evaluation and encoding by multiplication with the generator g(x)=∏j=1n−k(x−αj)g(x) = \prod_{j=1}^{n-k}(x - \alpha^j) give the same code. (The evaluation map at all nn-th roots of unity is a discrete Fourier transform over the finite field, the same transform that the fast Fourier transform computes over the complex numbers.)

To make the pipeline concrete, take F7\mathbb{F}_7, where α=3\alpha = 3 is primitive: its powers are 1,3,2,6,4,51, 3, 2, 6, 4, 5. Use n=6n = 6, k=2k = 2, so four check conditions. The constant polynomial 1 evaluates to (1,1,1,1,1,1)(1, 1, 1, 1, 1, 1), which is therefore a codeword; it is the word we send.

Step 1: syndromes. The received word is r(x)=c(x)+e(x)r(x) = c(x) + e(x), where e(x)e(x) is the error pattern. Evaluate at the check points:

Sj=r(αj)=c(αj)+e(αj)=e(αj),j=1,…,n−k.S_j = r(\alpha^j) = c(\alpha^j) + e(\alpha^j) = e(\alpha^j), \qquad j = 1, \ldots, n-k.

The codeword drops out entirely; the syndromes depend only on the errors, and they are all zero exactly when no error is detectable. Suppose errors of size Y1Y_1 and Y2Y_2 hit positions i1i_1 and i2i_2, and write X1=αi1X_1 = \alpha^{i_1}, X2=αi2X_2 = \alpha^{i_2} for the error locators. Then

Sj=Y1X1 j+Y2X2 j.S_j = Y_1 X_1^{\,j} + Y_2 X_2^{\,j}.

In the example, add 3 to position 1 and 5 to position 4, so r=(1,4,1,1,6,1)r = (1, 4, 1, 1, 6, 1). The syndromes are S1,S2,S3,S4=1,2,2,4S_1, S_2, S_3, S_4 = 1, 2, 2, 4.

With a single error the syndromes give the answer at once: Sj+1/Sj=XS_{j+1}/S_j = X and Y=S1/XY = S_1/X. (Had only position 4 been hit, by 5, the syndromes would be 6,3,5,66, 3, 5, 6, giving X=3/6=3⋅6=18≡4=α4X = 3/6 = 3 \cdot 6 = 18 \equiv 4 = \alpha^4 and Y=6/4=6⋅2≡5Y = 6/4 = 6 \cdot 2 \equiv 5.)

Step 2: the error locator. Define Λ(x)=(1−X1x)(1−X2x)=1+Λ1x+Λ2x2\Lambda(x) = (1 - X_1 x)(1 - X_2 x) = 1 + \Lambda_1 x + \Lambda_2 x^2, whose roots are the inverses of the locators. Because the syndromes are sums of geometric sequences, they satisfy a linear recurrence with Λ\Lambda as its characteristic polynomial:

Sj+2+Λ1Sj+1+Λ2Sj=0.S_{j+2} + \Lambda_1 S_{j+1} + \Lambda_2 S_j = 0.

With j=1,2j = 1, 2 this is two equations, 2+2Λ1+Λ2=02 + 2\Lambda_1 + \Lambda_2 = 0 and 4+2Λ1+2Λ2=04 + 2\Lambda_1 + 2\Lambda_2 = 0, whose solution in F7\mathbb{F}_7 is Λ1=0\Lambda_1 = 0, Λ2=5\Lambda_2 = 5. So Λ(x)=1+5x2\Lambda(x) = 1 + 5x^2. Check: 2+0+5=7≡02 + 0 + 5 = 7 \equiv 0 and 4+0+10=14≡04 + 0 + 10 = 14 \equiv 0.

Solving that linear system directly is Peterson’s method, and it costs a cubic amount of work as tt grows. The Berlekamp–Massey algorithm finds the same Λ\Lambda by processing the syndromes one at a time, maintaining the shortest recurrence consistent with everything seen so far and correcting it whenever a new syndrome disagrees. Elwyn Berlekamp gave the iterative algorithm in his 1968 book Algebraic Coding Theory; James Massey showed in 1969, in “Shift-register synthesis and BCH decoding” (IEEE Transactions on Information Theory, vol. IT-15), that it solves the general problem of finding the shortest linear-feedback shift register generating a sequence. It needs on the order of t2t^2 field operations. Run on 1,2,2,41, 2, 2, 4 it returns 1+5x21 + 5x^2 with recurrence length 2. An equivalent route uses the extended Euclidean algorithm on polynomials.

Step 3: Chien search. The roots of Λ\Lambda must be among the nn field elements, so test them all. Chien’s 1964 method evaluates Λ(α−i)\Lambda(\alpha^{-i}) for i=0,…,n−1i = 0, \ldots, n-1, updating each term by a constant multiplication from one ii to the next, which suits hardware well. Here the values are 6,0,4,6,0,46, 0, 4, 6, 0, 4 for i=0,…,5i = 0, \ldots, 5: zeros at i=1i = 1 and i=4i = 4. The errors are in positions 1 and 4.

Step 4: Forney’s formula. Knowing where the errors are, find how large they are. Form the syndrome polynomial S(x)=S1+S2x+S3x2+S4x3S(x) = S_1 + S_2 x + S_3 x^2 + S_4 x^3 and the error evaluator Ω(x)=S(x)Λ(x) mod x4\Omega(x) = S(x)\Lambda(x) \bmod x^{4}. Here Ω(x)=1+2x\Omega(x) = 1 + 2x. Forney’s formula, from his 1965 paper “On decoding BCH codes”, gives each error value as

Yℓ=−Ω(Xℓ−1)Λ′(Xℓ−1),Y_\ell = -\frac{\Omega(X_\ell^{-1})}{\Lambda'(X_\ell^{-1})},

where Λ′(x)=10x≡3x\Lambda'(x) = 10x \equiv 3x is the formal derivative. For position 4, X−1=4−1=2X^{-1} = 4^{-1} = 2, so Y=−Ω(2)/Λ′(2)=−5/6=−5⋅6=−30≡5Y = -\Omega(2)/\Lambda'(2) = -5/6 = -5 \cdot 6 = -30 \equiv 5. For position 1, X−1=3−1=5X^{-1} = 3^{-1} = 5, so Y=−Ω(5)/Λ′(5)=−4/1≡3Y = -\Omega(5)/\Lambda'(5) = -4/1 \equiv 3. Both match the errors we introduced. Subtracting them restores (1,1,1,1,1,1)(1, 1, 1, 1, 1, 1).

Complexity. Syndromes cost about n(n−k)n(n-k) multiplications, Berlekamp–Massey about t2t^2, Chien search about ntnt, Forney about t2t^2. The total is O(nt)O(nt) in the big-O sense, small enough that a (255,223) decoder runs at line rate in modest hardware.

Beyond half the distance. All of the above is unique decoding, guaranteed up to t=⌊(n−k)/2⌋t = \lfloor (n-k)/2 \rfloor errors. Venkatesan Guruswami and Madhu Sudan showed in 1999 (IEEE Transactions on Information Theory, vol. 45, building on Sudan’s 1997 algorithm) that Reed–Solomon codes can be list decoded in polynomial time from any number of errors below n−n(k−1)n - \sqrt{n(k-1)}: the decoder returns a short list of every codeword within that distance, usually containing just one. The gain is largest at low rate. For a (255,32) code the unique radius is 111 errors and the Guruswami–Sudan radius is 166; for (255,223) the gain is from 16 to 17.

Erasures versus errors

An erasure is a symbol known to be unreliable: a CD’s front-end detects that a frame failed its inner check, or a storage node simply does not answer. An error is a wrong symbol at an unknown position. The two have different costs.

Suppose ss symbols are erased. Throw those positions away. What remains is the evaluation of the same polynomial at n−sn - s points, which is itself a Reed–Solomon code of length n−sn - s, dimension kk and distance n−s−k+1n - s - k + 1. That shorter code corrects ee errors provided 2e≤n−s−k2e \le n - s - k, that is,

2e+s≤n−k.2e + s \le n - k.

Each erasure costs one unit of redundancy and each error costs two. An error costs double because the decoder must find both its position and its value; an erasure arrives with its position already known. In the F11\mathbb{F}_{11} example with n−k=4n - k = 4, the decoder can handle two errors, or one error plus two erasures, or four erasures. In the extreme case of s=n−ks = n - k erasures and no errors, decoding is plain interpolation through the kk surviving values.

This asymmetry shapes system design. Wherever possible, a lower layer is arranged to flag bad symbols rather than pass them on silently, so that the Reed–Solomon layer can treat them as erasures and repair twice as many.

Where Reed–Solomon codes are used

Audio CDs (CIRC). The CD uses cross-interleaved Reed–Solomon coding: an outer (28,24) code, called C2, and an inner (32,28) code, called C1, both over F256\mathbb{F}_{256} and both shortened from (255,251) codes. Each has four check bytes, so distance 5. Between them sits an interleaver with delays reaching 108 frames. On playback, C1 typically corrects small random errors and, when it sees more than it can safely fix, marks its whole frame as erasures; after de-interleaving, those erasures are scattered across many C2 words, each of which can fill in up to four. The commonly quoted figure is that CIRC fully corrects bursts of about 4000 bits, roughly 2.5 mm of track, consistent with the arithmetic in the opening paragraph, and can conceal (by interpolating audio samples) bursts about three times longer.

Interleaving. The physical channel produces bursts, while Reed–Solomon budgets are per codeword. If one codeword occupied a contiguous stretch of disc, a scratch could destroy ten of its symbols while neighbouring codewords sat untouched. Interleaving writes symbol 1 of many codewords, then symbol 2 of each, and so on, so physically adjacent symbols belong to different codewords. A burst of length bb spread over an interleaving depth DD costs each codeword only about b/Db/D symbols. The burst becomes scattered errors, which is what the code is good at. Reed–Solomon is already burst-tolerant at the bit level, since 8 corrupted bits in one byte cost one symbol; interleaving extends that to bursts many bytes long.

QR codes. QR symbols use Reed–Solomon over F256\mathbb{F}_{256} with the 0x11D polynomial and four error-correction levels, L, M, Q and H, rated to recover about 7, 15, 25 and 30 percent of codewords respectively. Larger symbols split data into several blocks and interleave them across the grid, so a torn corner damages a few codewords in each block rather than many in one. The QR code article works through the block structure and an encoding example in detail.

Voyager. For the Uranus and Neptune encounters, the Voyager probes used a concatenated code: an outer (255,223) Reed–Solomon code over 8-bit symbols, correcting 16 symbol errors per block, wrapped around an inner rate-1/2, constraint-length-7 convolutional code decoded by the Viterbi algorithm. When the Viterbi decoder fails it produces short bursts of wrong bits, which the byte-oriented outer code absorbs.

Digital television. DVB-S satellite broadcasting (ETSI EN 300 421) protects each 188-byte MPEG-2 transport packet with a (204,188) code correcting T=8T = 8 bytes, shortened from a (255,239) code by prepending 51 zero bytes that are never transmitted, with field polynomial x8+x4+x3+x2+1x^8 + x^4 + x^3 + x^2 + 1 and a convolutional interleaver of depth 12, again ahead of an inner convolutional code.

RAID-6. A RAID-6 array survives the loss of any two disks. It stores two parity blocks per stripe: P=D0+D1+⋯+Dm−1P = D_0 + D_1 + \cdots + D_{m-1}, which is ordinary XOR parity, and Q=g0D0+g1D1+⋯+gm−1Dm−1Q = g^0 D_0 + g^1 D_1 + \cdots + g^{m-1} D_{m-1} computed byte-wise in F256\mathbb{F}_{256} with g=0x02g = \texttt{0x02}. A failed disk is a known position, so this is pure erasure decoding: two equations, two unknowns. H. Peter Anvin’s description of the Linux implementation uses the 0x11D field.

Distributed storage. Large storage systems split a file into kk data blocks, compute n−kn - k parity blocks, and place them on different machines; any kk of the nn suffice to rebuild. Apache Hadoop’s HDFS ships erasure-coding policies including RS-6-3 and RS-10-4. A (10,4) layout, in the HDFS naming of 10 data plus 4 parity blocks, survives any four lost blocks at 1.4 times the raw storage, against 3 times for triple replication, which survives only two. The cost is repair traffic: rebuilding one lost block means reading ten others.

A code ahead of its algorithm

Irving S. Reed and Gustave Solomon, then staff members at MIT Lincoln Laboratory, published “Polynomial Codes over Certain Finite Fields” in the Journal of the Society for Industrial and Applied Mathematics, volume 8, number 2, June 1960, pages 300 to 304. The paper is five pages long. It defines the code by evaluating message polynomials over F2m\mathbb{F}_{2^m} and observes its distance property. It gives no efficient decoder; the method it suggests amounts to trying subsets, the brute force of our F11\mathbb{F}_{11} example, which is hopeless at real block lengths.

Practical decoding came in stages. Peterson’s 1960 algorithm for binary BCH codes was extended to non-binary codes by Gorenstein and Zierler in 1961, giving a syndrome decoder with cubic cost. Chien’s root search appeared in 1964 and Forney’s error-value formula in 1965. The decisive step was Berlekamp’s iterative algorithm, published in 1968, and Massey’s 1969 reformulation of it as shift-register synthesis. Only then did Reed–Solomon decoding become cheap enough for hardware, and it took further years of integrated-circuit progress before it reached consumer products with the compact disc in 1982. Guruswami and Sudan’s list decoder arrived nearly forty years after the original paper. The code was right from the start; the algorithms took decades to catch up with it.

Interpolation run in reverse

Strip away the fields, the syndromes and the hardware, and one fact remains: a polynomial of degree less than kk is determined by any kk of its values, and two different such polynomials cannot agree in more than k−1k - 1 places. Interpolation uses the first half of that sentence to build a curve from data. Reed–Solomon coding uses the second half to protect data with a curve. Send the curve at more points than it needs, and a handful of wrong values cannot fake a different low-degree polynomial; the true one is the only candidate that fits nearly everything. The finite field keeps the arithmetic exact, the decoding algorithms make the search fast, and interleaving shapes physical damage into the scattered form the code handles best. Everything else is bookkeeping around the rigidity of polynomials, one of the oldest facts in algebra and, through information theory, one of the most heavily used.


Related topics: Polynomial Interpolation: Why Does Adding More Points Make Interpolation Worse?, Hamming Codes: How Computers Catch and Fix Their Own Mistakes, How Do QR Codes Work? Finite Fields, Reed-Solomon Codes and Damage You Never Notice, Modular Arithmetic: The Mathematics of Clocks and Cryptography, Galois Theory: Why You Can’t Solve the Quintic, The Fast Fourier Transform: How a Clever Trick Made an Old Algorithm Run the World

Frequently asked

What are Reed-Solomon codes?

Reed-Solomon codes are error-correcting codes built from polynomials over a finite field. A block of k message symbols defines a polynomial of degree less than k, and the sender transmits that polynomial's values at n points, with n larger than k. Because any k correct values determine the polynomial, the n minus k extra values act as redundancy that lets the receiver find and repair corrupted symbols.

How does Reed-Solomon error correction work?

The receiver looks for the unique low-degree polynomial that agrees with as many received values as possible. In practice it computes syndromes, which are zero exactly when no error occurred, uses the Berlekamp-Massey algorithm to find an error-locator polynomial whose roots mark the bad positions, finds those roots by Chien search, and computes the size of each error with Forney's formula. Subtracting the errors restores the codeword.

How many errors can a Reed-Solomon code correct?

A Reed-Solomon code with n symbols per block and k message symbols has minimum distance n minus k plus 1. It can correct up to the floor of (n minus k)/2 symbol errors at unknown positions, or up to n minus k erasures at known positions, and in general any combination with twice the errors plus the erasures at most n minus k. A symbol is usually a byte, so a burst that corrupts eight bits of one byte costs only one symbol.

Why do Reed-Solomon codes use finite fields?

The decoder must add, multiply and divide symbols exactly, with no rounding and no overflow. Over the real numbers, values grow without bound and rounding noise is indistinguishable from genuine errors. A finite field has a fixed number of elements, every non-zero element has an inverse, and a polynomial of degree d still has at most d roots, which is the fact the whole code depends on. The field with 256 elements makes one symbol exactly one byte.

Where are Reed-Solomon codes used?

They protect audio CDs through cross-interleaved (32,28) and (28,24) codes, QR codes at four error-correction levels, DVB satellite television through a shortened (204,188) code, the Voyager probes through a (255,223) outer code, RAID-6 disk arrays through a second parity disk, and distributed storage systems such as HDFS, which offers (6,3) and (10,4) erasure-coding policies.