A 2-error Correcting Code
Basic Idea We will now try to generalize the idea used in Hamming decoding to obtain a linear code that is 2-error correcting. In the Hamming decoding scheme, the parity check matrix's columns were arranged in such a way that the syndrome of a received word (which is a column of this matrix if only one error occurs) is the number corresponding to the position of the error. When two errors occur a syndrome would be the sum of two columns of the parity check matrix. The task would be to construct a matrix so that knowing only the sum of two columns, we can determine which two columns were added to obtain this sum. In other words, we want to select columns so that the sums of any two are all distinct.
A Length 15 Example To achieve our aim we must have all columns distinct (so that single errors can be corrected) and we can not use the all zero column (a double error involving such a column could not be distinquished from a single error). We will use the field GF(16) to construct our example, but the code will be a binary code. The elements of GF(16) will therefore be identified with binary 4-tuples (written as columns). The parity check matrix we will construct will be an 8 x 15 0-1 matrix. Each of the 15 columns can be thought of a top 4-tuple and a bottom 4-tuple, each of which represents an element of GF(16). Using a generator a of GF(16) we can represent the parity check matrix in a condensed form having only two rows of elements of GF(16).
A Length 15 Example Our sought for parity check matrix H would thus look like: H = 1 a a2 a 3 a 4 a 14 f 1 f a f a 2 f a 3 f a 4 f a 14 Where f is an as yet undetermined function on GF(16). The first row ensures that all the columns are distinct and non-zero. We must now determine a function f that gives us the distinct sum property. The syndrome that we obtain if errors occur in the (i+1) and (j+1) positions is: s 1 s 2 = a i a j f a i f a. j.
The cubing function Investigating linear and quadratic functions shows that these won't have the required properties. We look then at the simplest cubic function, f(x) = x 3. Over a field of characteristic 2, we have: x 3 + y 3 = (x + y) (x 2 + xy + y 2 ). In our application we have s 1 = x + y, s 2 = x 3 + y 3 and s 1 2 = x 2 + y 2. Thus, s 2 /s 1 + s 1 2 = xy. (Note that s 1 0) And from this we can determine x and y, since these will be the roots of the quadratic equation (a + x)(a + y) = a 2 + (x+y)a + xy = a 2 + s 1 a + (s 2 /s 1 + s 1 2 ) = 0.
Solving Quadratics While there is a systematic way to solve quadratic equations in fields of characteristic 2 (note that the familiar quadratic formula can not be applied) we will not develop that approach. Instead, we will solve these equations by inspection. If we represent the non-zero elements of the field as powers of a primitive element, a, then the quadratic equation: x 2 + a s x + a t = 0, will have roots a i and a j if and only if i + j t mod (q-1) and a i + a j = a s. Thus, to find the roots (if they exist) we check the sums of the elements a i and a j only for the pairs i and j which satisfy the first condition.
GF(16) To be specific we need to work in a given field. GF(16) can be constructed from the primitive polynomial x 4 + x 3 + 1with primitive root a giving: a a 8 = a 3 + a 2 + a a 2 a 9 = a 2 + 1 a 3 a 10 = a 3 + a a 4 = a 3 + 1 a 11 = a 3 + a 2 + 1 a 5 = a 3 + a + 1 a 12 = a + 1 a 6 = a 3 + a 2 + a + 1 a 13 = a 2 + a a 7 = a 2 + a + 1 a 14 = a 3 + a 2
Solving Quadratics a a 2 a 3 a 4 = a 3 + 1 a 5 = a 3 + a + 1 a 6 = a 3 + a 2 + a + 1 a 7 = a 2 + a + 1 a 8 = a 3 + a 2 + a a 9 = a 2 + 1 a 10 = a 3 + a a 11 = a 3 + a 2 + 1 a 12 = a + 1 a 13 = a 2 + a a 14 = a 3 + a 2 To solve x 2 + a 2 x + a 11 = 0 we look at the sums: a 0 + a 11 = a 14 a 1 + a 10 = a 3 a 2 + a 9 = 1 a 3 + a 8 = a 13 a 4 + a 7 = a 8 a 5 + a 6 = a 2 Thus the roots of this equation are a 5 and a 6.
Decoding We can now state the decoding algorithm when we use the function f(x) = x 3 for our function. We calculate the syndrome of the received word and write it in the form (s 1 s 2 ) T, where s 1 and s 2 are interpreted as elements of GF(16). Then, If s 1 = 0 and s 2 = 0, we assume that no error has occurred. Calculate (s 2 /s 1 + s 12 ). If this equals 0, then one error has occurred in position i+1 where s 1 = a i. (Note: s 2 = s 1 3 ). Find the roots of x 2 + s 1 x + (s 2 /s 1 + s 1 2 ) = 0. If the roots are a i and a j then the two errors occur in positions i+1 and j+1. If the quadratic has no roots, more than two errors have occurred.
BCH Codes This example is a special case of a family of codes known as BCH codes named after their discoverers, R.C. Bose and D.K. Ray- Chaudhuri (1960) and independently by A. Hocquenghem (1959). BCH codes belong to a larger family of cyclic codes which we will investigate next before returning to the BCH codes.