Mathwords logoMathwords

Reed-Solomon Error Correction — Definition, Formula & Example

Reed-Solomon error correction is a way to protect data by treating a message as the coefficients of a polynomial. You send that polynomial's values at more points than you need, so the receiver can rebuild the message even when some values are lost or corrupted.

Let Fq\mathbb{F}_q be a finite field, let α1,…,αn\alpha_1, \dots, \alpha_n be distinct elements of Fq\mathbb{F}_q (so n≤qn \le q), and let 1≤k≤n1 \le k \le n. The Reed-Solomon code RSq(n,k)\mathrm{RS}_q(n, k) is the set {(f(α1),…,f(αn)):f∈Fq[x], deg⁡f<k}\{(f(\alpha_1), \dots, f(\alpha_n)) : f \in \mathbb{F}_q[x],\ \deg f < k\}. It is an [n,k,n−k+1][n, k, n-k+1] linear code. Because it meets the Singleton bound d≤n−k+1d \le n - k + 1 with equality, it is maximum distance separable (MDS).

Key Formula

c=(f(α1),…,f(αn)),f(x)=m0+m1x+⋯+mk−1xk−1,d=n−k+1\mathbf{c} = \big(f(\alpha_1), \dots, f(\alpha_n)\big), \quad f(x) = m_0 + m_1 x + \cdots + m_{k-1}x^{k-1}, \quad d = n - k + 1
Where:
  • m0,…,mk−1m_0, \dots, m_{k-1} = The kk message symbols, which are elements of Fq\mathbb{F}_q
  • α1,…,αn\alpha_1, \dots, \alpha_n = Distinct evaluation points in Fq\mathbb{F}_q
  • c\mathbf{c} = The codeword of length nn that is transmitted
  • dd = Minimum distance. The code corrects up to ⌊(n−k)/2⌋\lfloor (n-k)/2 \rfloor errors or up to n−kn-k erasures.

Worked Example

Problem: Work over F7\mathbb{F}_7 (arithmetic mod 7) with n=6n = 6, k=2k = 2, and evaluation points 1,2,3,4,5,61, 2, 3, 4, 5, 6. Encode the message (m0,m1)=(3,2)(m_0, m_1) = (3, 2). Then find the code's minimum distance. Finally, suppose only the symbols at positions x=2x = 2 and x=5x = 5 arrive. Recover the message from them.
Step 1: The message gives f(x)=3+2xf(x) = 3 + 2x. Evaluate it at each point and reduce mod 7.
f(1),…,f(6)=5, 7, 9, 11, 13, 15≡5, 0, 2, 4, 6, 1(mod7)f(1), \dots, f(6) = 5,\ 7,\ 9,\ 11,\ 13,\ 15 \equiv 5,\ 0,\ 2,\ 4,\ 6,\ 1 \pmod 7
Step 2: Two different polynomials of degree at most 1 can agree at no more than 1 point. So any two codewords differ in at least 6−1=56 - 1 = 5 positions. This matches the formula and gives the number of correctable errors.
d=n−k+1=6−2+1=5,t=⌊6−22⌋=2d = n - k + 1 = 6 - 2 + 1 = 5, \qquad t = \left\lfloor \tfrac{6-2}{2} \right\rfloor = 2
Step 3: The received values are f(2)=0f(2) = 0 and f(5)=6f(5) = 6. A line is fixed by two points, so you can solve for it. Division mod 7 means multiplying by an inverse, and 3−1≡53^{-1} \equiv 5 because 3⋅5=15≡13 \cdot 5 = 15 \equiv 1.
m1=6−05−2=6⋅3−1≡6⋅5=30≡2,m0=0−2⋅2=−4≡3(mod7)m_1 = \frac{6 - 0}{5 - 2} = 6 \cdot 3^{-1} \equiv 6 \cdot 5 = 30 \equiv 2, \qquad m_0 = 0 - 2 \cdot 2 = -4 \equiv 3 \pmod 7
Answer: The codeword is (5,0,2,4,6,1)(5, 0, 2, 4, 6, 1). The code is a [6,2,5][6, 2, 5] code over F7\mathbb{F}_7, so it corrects any 2 symbol errors. From just 2 of the 6 symbols, the receiver recovers the message (3,2)(3, 2). That is 4 erasures repaired.

Why It Matters

Reed-Solomon codes protect QR codes, which work over GF(256)\mathrm{GF}(256) so that each symbol is one byte. This lets a QR code scan correctly even with part of it torn or covered. They also protect CDs and DVDs, RAID 6 disk arrays, and deep-space links such as Voyager's. They handle burst errors well because a whole corrupted byte counts as only one symbol error.

Common Mistakes

Mistake: Claiming that a Reed-Solomon code with n−kn - k redundant symbols can correct n−kn - k errors.
Correction: It can fill in n−kn - k erasures, which are lost symbols whose positions are known. It can correct only ⌊(n−k)/2⌋\lfloor (n-k)/2 \rfloor errors when their positions are unknown. Locating each unknown error uses up a second redundant symbol.

Related Terms

  • Coding Theory — The field that studies codes like Reed-Solomon
  • Linear Code — Reed-Solomon codes are linear codes meeting the Singleton bound
  • Generator Matrix — A Vandermonde matrix serves as Reed-Solomon's generator matrix
  • BCH Code — Cyclic Reed-Solomon codes are BCH codes with nonbinary symbols