kb/data/en.wikipedia.org/wiki/Berlekamp–Welch_algorithm-1.md

33 KiB
Raw Blame History

title chunk source category tags date_saved instance
BerlekampWelch algorithm 2/2 https://en.wikipedia.org/wiki/BerlekampWelch_algorithm reference science, encyclopedia 2026-05-05T14:40:01.393171+00:00 kb-cron
              q
              
                0
              
            
          
          
            
            +
          
          
            
              q
              
                1
              
            
          
          
            
            +
          
          
            
              q
              
                2
              
            
          
          
            
            
          
          
            4
            
              e
              
                0
              
            
          
          
            
            
          
          
            4
          
          
            
            =
          
          
            0
          
        
        
          
            
              q
              
                0
              
            
          
          
            
            +
          
          
            2
            
              q
              
                1
              
            
          
          
            
            +
          
          
            4
            
              q
              
                2
              
            
          
          
            
            
          
          
            3
            
              e
              
                0
              
            
          
          
            
            
          
          
            6
          
          
            
            =
          
          
            0
          
        
        
          
            
              q
              
                0
              
            
          
          
            
            +
          
          
            3
            
              q
              
                1
              
            
          
          
            
            +
          
          
            9
            
              q
              
                2
              
            
          
          
            
            
          
          
            4
            
              e
              
                0
              
            
          
          
            
            
          
          
            12
          
          
            
            =
          
          
            0
          
        
        
          
            
              q
              
                0
              
            
          
          
            
            +
          
          
            4
            
              q
              
                1
              
            
          
          
            
            +
          
          
            16
            
              q
              
                2
              
            
          
          
            
            
          
          
            
              e
              
                0
              
            
          
          
            
            
          
          
            4
          
          
            
            =
          
          
            0
          
        
      
    
  

{\displaystyle {\begin{alignedat}{10}q_{0}&+&q_{1}&+&q_{2}&-&4e_{0}&-&4&=&0\\q_{0}&+&2q_{1}&+&4q_{2}&-&3e_{0}&-&6&=&0\\q_{0}&+&3q_{1}&+&9q_{2}&-&4e_{0}&-&12&=&0\\q_{0}&+&4q_{1}&+&16q_{2}&-&e_{0}&-&4&=&0\end{alignedat}}}

This system can be solved through Gaussian elimination, and gives the values:

      q
      
        0
      
    
    =
    
    15
    ,
    
      q
      
        1
      
    
    =
    8
    ,
    
      q
      
        2
      
    
    =
    
    1
    ,
    
      e
      
        0
      
    
    =
    
    3
  

{\displaystyle q_{0}=-15,q_{1}=8,q_{2}=-1,e_{0}=-3}

Thus,

    Q
    (
    x
    )
    =
    
    
      x
      
        2
      
    
    +
    8
    x
    
    15
    ,
    E
    (
    x
    )
    =
    x
    
    3
  

{\displaystyle Q(x)=-x^{2}+8x-15,E(x)=x-3}

. Dividing the two gives:

          Q
          (
          x
          )
        
        
          E
          (
          x
          )
        
      
    
    =
    P
    (
    x
    )
    =
    5
    
    x
  

{\displaystyle {Q(x) \over E(x)}=P(x)=5-x}




  
    5
    
    x
  

{\displaystyle 5-x}

fits three of the four points given, so it is the most likely to be the original polynomial.

== Example == Consider RS(7,3) (n = 7, k = 3) defined in GF(7) with α = 3 and input values: ai = i-1 : {0,1,2,3,4,5,6}. The message to be systematically encoded is {1,6,3}. Using Lagrange interpolation, F(ai) = 3 x2 + 2 x + 1, and applying F(ai) for a4 = 3 to a7 = 6, results in the code word {1,6,3,6,1,2,2}. Assume errors occur at c2 and c5 resulting in the received code word {1,5,3,6,3,2,2}. Start off with e = 2 and solve the linear equations:

        [
        
          
            
              
                b
                
                  1
                
              
            
            
              
                b
                
                  1
                
              
              
                a
                
                  1
                
              
            
            
              
              1
            
            
              
              
                a
                
                  1
                
              
            
            
              
              
                a
                
                  1
                
                
                  2
                
              
            
            
              
              
                a
                
                  1
                
                
                  3
                
              
            
            
              
              
                a
                
                  1
                
                
                  4
                
              
            
          
          
            
              
                b
                
                  2
                
              
            
            
              
                b
                
                  2
                
              
              
                a
                
                  2
                
              
            
            
              
              1
            
            
              
              
                a
                
                  2
                
              
            
            
              
              
                a
                
                  2
                
                
                  2
                
              
            
            
              
              
                a
                
                  2
                
                
                  3
                
              
            
            
              
              
                a
                
                  2
                
                
                  4
                
              
            
          
          
            
              
                b
                
                  3
                
              
            
            
              
                b
                
                  3
                
              
              
                a
                
                  3
                
              
            
            
              
              1
            
            
              
              
                a
                
                  3
                
              
            
            
              
              
                a
                
                  3
                
                
                  2
                
              
            
            
              
              
                a
                
                  3
                
                
                  3
                
              
            
            
              
              
                a
                
                  3
                
                
                  4
                
              
            
          
          
            
              
                b
                
                  4
                
              
            
            
              
                b
                
                  4
                
              
              
                a
                
                  4
                
              
            
            
              
              1
            
            
              
              
                a
                
                  4
                
              
            
            
              
              
                a
                
                  4
                
                
                  2
                
              
            
            
              
              
                a
                
                  4
                
                
                  3
                
              
            
            
              
              
                a
                
                  4
                
                
                  4
                
              
            
          
          
            
              
                b
                
                  5
                
              
            
            
              
                b
                
                  5
                
              
              
                a
                
                  5
                
              
            
            
              
              1
            
            
              
              
                a
                
                  5
                
              
            
            
              
              
                a
                
                  5
                
                
                  2
                
              
            
            
              
              
                a
                
                  5
                
                
                  3
                
              
            
            
              
              
                a
                
                  5
                
                
                  4
                
              
            
          
          
            
              
                b
                
                  6
                
              
            
            
              
                b
                
                  6
                
              
              
                a
                
                  6
                
              
            
            
              
              1
            
            
              
              
                a
                
                  6
                
              
            
            
              
              
                a
                
                  6
                
                
                  2
                
              
            
            
              
              
                a
                
                  6
                
                
                  3
                
              
            
            
              
              
                a
                
                  6
                
                
                  4
                
              
            
          
          
            
              
                b
                
                  7
                
              
            
            
              
                b
                
                  7
                
              
              
                a
                
                  7
                
              
            
            
              
              1
            
            
              
              
                a
                
                  7
                
              
            
            
              
              
                a
                
                  7
                
                
                  2
                
              
            
            
              
              
                a
                
                  7
                
                
                  3
                
              
            
            
              
              
                a
                
                  7
                
                
                  4
                
              
            
          
        
        ]
      
    
    
      
        [
        
          
            
              
                e
                
                  0
                
              
            
          
          
            
              
                e
                
                  1
                
              
            
          
          
            
              q
              0
            
          
          
            
              q
              1
            
          
          
            
              q
              2
            
          
          
            
              q
              3
            
          
          
            
              q
              4
            
          
        
        ]
      
    
    =
    
      
        [
        
          
            
              
              
                b
                
                  1
                
              
              
                a
                
                  1
                
                
                  2
                
              
            
          
          
            
              
              
                b
                
                  2
                
              
              
                a
                
                  2
                
                
                  2
                
              
            
          
          
            
              
              
                b
                
                  3
                
              
              
                a
                
                  3
                
                
                  2
                
              
            
          
          
            
              
              
                b
                
                  4
                
              
              
                a
                
                  4
                
                
                  2
                
              
            
          
          
            
              
              
                b
                
                  5
                
              
              
                a
                
                  5
                
                
                  2
                
              
            
          
          
            
              
              
                b
                
                  6
                
              
              
                a
                
                  6
                
                
                  2
                
              
            
          
          
            
              
              
                b
                
                  7
                
              
              
                a
                
                  7
                
                
                  2
                
              
            
          
        
        ]
      
    
  

{\displaystyle {\begin{bmatrix}b_{1}&b_{1}a_{1}&-1&-a_{1}&-a_{1}^{2}&-a_{1}^{3}&-a_{1}^{4}\\b_{2}&b_{2}a_{2}&-1&-a_{2}&-a_{2}^{2}&-a_{2}^{3}&-a_{2}^{4}\\b_{3}&b_{3}a_{3}&-1&-a_{3}&-a_{3}^{2}&-a_{3}^{3}&-a_{3}^{4}\\b_{4}&b_{4}a_{4}&-1&-a_{4}&-a_{4}^{2}&-a_{4}^{3}&-a_{4}^{4}\\b_{5}&b_{5}a_{5}&-1&-a_{5}&-a_{5}^{2}&-a_{5}^{3}&-a_{5}^{4}\\b_{6}&b_{6}a_{6}&-1&-a_{6}&-a_{6}^{2}&-a_{6}^{3}&-a_{6}^{4}\\b_{7}&b_{7}a_{7}&-1&-a_{7}&-a_{7}^{2}&-a_{7}^{3}&-a_{7}^{4}\\\end{bmatrix}}{\begin{bmatrix}e_{0}\\e_{1}\\q0\\q1\\q2\\q3\\q4\\\end{bmatrix}}={\begin{bmatrix}-b_{1}a_{1}^{2}\\-b_{2}a_{2}^{2}\\-b_{3}a_{3}^{2}\\-b_{4}a_{4}^{2}\\-b_{5}a_{5}^{2}\\-b_{6}a_{6}^{2}\\-b_{7}a_{7}^{2}\\\end{bmatrix}}}




  
    
      
        [
        
          
            
              1
            
            
              0
            
            
              6
            
            
              0
            
            
              0
            
            
              0
            
            
              0
            
          
          
            
              5
            
            
              5
            
            
              6
            
            
              6
            
            
              6
            
            
              6
            
            
              6
            
          
          
            
              3
            
            
              6
            
            
              6
            
            
              5
            
            
              3
            
            
              6
            
            
              5
            
          
          
            
              6
            
            
              4
            
            
              6
            
            
              4
            
            
              5
            
            
              1
            
            
              3
            
          
          
            
              3
            
            
              5
            
            
              6
            
            
              3
            
            
              5
            
            
              6
            
            
              3
            
          
          
            
              2
            
            
              3
            
            
              6
            
            
              2
            
            
              3
            
            
              1
            
            
              5
            
          
          
            
              2
            
            
              5
            
            
              6
            
            
              1
            
            
              6
            
            
              1
            
            
              6
            
          
        
        ]
      
    
    
      
        [
        
          
            
              
                e
                
                  0
                
              
            
          
          
            
              
                e
                
                  1
                
              
            
          
          
            
              q
              0
            
          
          
            
              q
              1
            
          
          
            
              q
              2
            
          
          
            
              q
              3
            
          
          
            
              q
              4
            
          
        
        ]
      
    
    =
    
      
        [
        
          
            
              0
            
          
          
            
              2
            
          
          
            
              2
            
          
          
            
              2
            
          
          
            
              1
            
          
          
            
              6
            
          
          
            
              5
            
          
        
        ]
      
    
  

{\displaystyle {\begin{bmatrix}1&0&6&0&0&0&0\\5&5&6&6&6&6&6\\3&6&6&5&3&6&5\\6&4&6&4&5&1&3\\3&5&6&3&5&6&3\\2&3&6&2&3&1&5\\2&5&6&1&6&1&6\\\end{bmatrix}}{\begin{bmatrix}e_{0}\\e_{1}\\q0\\q1\\q2\\q3\\q4\\\end{bmatrix}}={\begin{bmatrix}0\\2\\2\\2\\1\\6\\5\\\end{bmatrix}}}




  
    
      
        [
        
          
            
              1
            
            
              0
            
            
              0
            
            
              0
            
            
              0
            
            
              0
            
            
              0
            
          
          
            
              0
            
            
              1
            
            
              0
            
            
              0
            
            
              0
            
            
              0
            
            
              0
            
          
          
            
              0
            
            
              0
            
            
              1
            
            
              0
            
            
              0
            
            
              0
            
            
              0
            
          
          
            
              0
            
            
              0
            
            
              0
            
            
              1
            
            
              0
            
            
              0
            
            
              0
            
          
          
            
              0
            
            
              0
            
            
              0
            
            
              0
            
            
              1
            
            
              0
            
            
              0
            
          
          
            
              0
            
            
              0
            
            
              0
            
            
              0
            
            
              0
            
            
              1
            
            
              0
            
          
          
            
              0
            
            
              0
            
            
              0
            
            
              0
            
            
              0
            
            
              0
            
            
              1
            
          
        
        ]
      
    
    
      
        [
        
          
            
              
                e
                
                  0
                
              
            
          
          
            
              
                e
                
                  1
                
              
            
          
          
            
              q
              0
            
          
          
            
              q
              1
            
          
          
            
              q
              2
            
          
          
            
              q
              3
            
          
          
            
              q
              4
            
          
        
        ]
      
    
    =
    
      
        [
        
          
            
              4
            
          
          
            
              2
            
          
          
            
              4
            
          
          
            
              3
            
          
          
            
              3
            
          
          
            
              1
            
          
          
            
              3
            
          
        
        ]
      
    
  

{\displaystyle {\begin{bmatrix}1&0&0&0&0&0&0\\0&1&0&0&0&0&0\\0&0&1&0&0&0&0\\0&0&0&1&0&0&0\\0&0&0&0&1&0&0\\0&0&0&0&0&1&0\\0&0&0&0&0&0&1\\\end{bmatrix}}{\begin{bmatrix}e_{0}\\e_{1}\\q0\\q1\\q2\\q3\\q4\\\end{bmatrix}}={\begin{bmatrix}4\\2\\4\\3\\3\\1\\3\\\end{bmatrix}}}

Starting from the bottom of the right matrix, and the constraint e2 = 1:

    Q
    (
    
      a
      
        i
      
    
    )
    =
    3
    
      x
      
        4
      
    
    +
    1
    
      x
      
        3
      
    
    +
    3
    
      x
      
        2
      
    
    +
    3
    x
    +
    4
  

{\displaystyle Q(a_{i})=3x^{4}+1x^{3}+3x^{2}+3x+4}




  
    E
    (
    
      a
      
        i
      
    
    )
    =
    1
    
      x
      
        2
      
    
    +
    2
    x
    +
    4
  

{\displaystyle E(a_{i})=1x^{2}+2x+4}




  
    F
    (
    
      a
      
        i
      
    
    )
    =
    Q
    (
    
      a
      
        i
      
    
    )
    
      /
    
    E
    (
    
      a
      
        i
      
    
    )
    =
    3
    
      x
      
        2
      
    
    +
    2
    x
    +
    1
  

{\displaystyle F(a_{i})=Q(a_{i})/E(a_{i})=3x^{2}+2x+1}

with remainder = 0. E(ai) = 0 at a2 = 1 and a5 = 4 Calculate F(a2 = 1) = 6 and F(a5 = 4) = 1 to produce corrected code word {1,6,3,6,1,2,2}.

== See also == ReedSolomon error correction

== External links == MIT Lecture Notes on Essential Coding Theory Dr. Madhu Sudan University at Buffalo Lecture Notes on Coding Theory Dr. Atri Rudra Algebraic Codes on Lines, Planes and Curves, An Engineering Approach Richard E. Blahut Welch Berlekamp Decoding of ReedSolomon Codes L. R. Welch US 4,633,470, Welch, Lloyd R. & Berlekamp, Elwyn R., "Error Correction for Algebraic Block Codes", published September 27, 1983, issued December 30, 1986 The patent by Lloyd R. Welch and Elewyn R. Berlekamp