Polynomial code

From HandWiki

In coding theory, a polynomial code is a type of linear code whose set of valid code words consists of those polynomials (usually of some fixed length) that are divisible by a given fixed polynomial (of shorter length, called the generator polynomial).

Definition

Fix a finite field [math]\displaystyle{ GF(q) }[/math], whose elements we call symbols. For the purposes of constructing polynomial codes, we identify a string of [math]\displaystyle{ n }[/math] symbols [math]\displaystyle{ a_{n-1}\ldots a_0 }[/math] with the polynomial

[math]\displaystyle{ a_{n-1}x^{n-1} + \cdots + a_1x + a_0.\, }[/math]

Fix integers [math]\displaystyle{ m \leq n }[/math] and let [math]\displaystyle{ g(x) }[/math] be some fixed polynomial of degree [math]\displaystyle{ m }[/math], called the generator polynomial. The polynomial code generated by [math]\displaystyle{ g(x) }[/math] is the code whose code words are precisely the polynomials of degree less than [math]\displaystyle{ n }[/math] that are divisible (without remainder) by [math]\displaystyle{ g(x) }[/math].

Example

Consider the polynomial code over [math]\displaystyle{ GF(2)=\{0,1\} }[/math] with [math]\displaystyle{ n=5 }[/math], [math]\displaystyle{ m=2 }[/math], and generator polynomial [math]\displaystyle{ g(x)=x^2+x+1 }[/math]. This code consists of the following code words:

[math]\displaystyle{ 0\cdot g(x),\quad 1\cdot g(x),\quad x\cdot g(x), \quad (x+1) \cdot g(x), }[/math]
[math]\displaystyle{ x^2 \cdot g(x),\quad (x^2+1)\cdot g(x),\quad (x^2+x)\cdot g(x), \quad (x^2+x+1) \cdot g(x). }[/math]

Or written explicitly:

[math]\displaystyle{ 0,\quad x^2+x+1,\quad x^3+x^2+x,\quad x^3+2x^2+2x+1, }[/math]
[math]\displaystyle{ x^4+x^3+x^2,\quad x^4+x^3+2x^2+x+1,\quad x^4+2x^3+2x^2+x,\quad x^4+2x^3+3x^2+2x+1. }[/math]

Since the polynomial code is defined over the Binary Galois Field [math]\displaystyle{ GF(2)=\{0,1\} }[/math], polynomial elements are represented as a modulo-2 sum and the final polynomials are:

[math]\displaystyle{ 0,\quad x^2+x+1,\quad x^3+x^2+x,\quad x^3+1, }[/math]
[math]\displaystyle{ x^4+x^3+x^2,\quad x^4+x^3+x+1,\quad x^4+x,\quad x^4+x^2+1. }[/math]

Equivalently, expressed as strings of binary digits, the codewords are:

[math]\displaystyle{ 00000,\quad 00111,\quad 01110,\quad 01001, }[/math]
[math]\displaystyle{ 11100,\quad 11011,\quad 10010,\quad 10101. }[/math]

This, as every polynomial code, is indeed a linear code, i.e., linear combinations of code words are again code words. In a case like this where the field is GF(2), linear combinations are found by taking the XOR of the codewords expressed in binary form (e.g. 00111 XOR 10010 = 10101).

Encoding

In a polynomial code over [math]\displaystyle{ GF(q) }[/math] with code length [math]\displaystyle{ n }[/math] and generator polynomial [math]\displaystyle{ g(x) }[/math] of degree [math]\displaystyle{ m }[/math], there will be exactly [math]\displaystyle{ q^{n-m} }[/math] code words. Indeed, by definition, [math]\displaystyle{ p(x) }[/math] is a code word if and only if it is of the form [math]\displaystyle{ p(x) = g(x)\cdot q(x) }[/math], where [math]\displaystyle{ q(x) }[/math] (the quotient) is of degree less than [math]\displaystyle{ n-m }[/math]. Since there are [math]\displaystyle{ q^{n-m} }[/math] such quotients available, there are the same number of possible code words. Plain (unencoded) data words should therefore be of length [math]\displaystyle{ n-m }[/math]

Some authors, such as (Lidl & Pilz, 1999), only discuss the mapping [math]\displaystyle{ q(x) \mapsto g(x)\cdot q(x) }[/math] as the assignment from data words to code words. However, this has the disadvantage that the data word does not appear as part of the code word.

Instead, the following method is often used to create a systematic code: given a data word [math]\displaystyle{ d(x) }[/math] of length [math]\displaystyle{ n-m }[/math], first multiply [math]\displaystyle{ d(x) }[/math] by [math]\displaystyle{ x^m }[/math], which has the effect of shifting [math]\displaystyle{ d(x) }[/math] by [math]\displaystyle{ m }[/math] places to the left. In general, [math]\displaystyle{ x^md(x) }[/math] will not be divisible by [math]\displaystyle{ g(x) }[/math], i.e., it will not be a valid code word. However, there is a unique code word that can be obtained by adjusting the rightmost [math]\displaystyle{ m }[/math] symbols of [math]\displaystyle{ x^md(x) }[/math]. To calculate it, compute the remainder of dividing [math]\displaystyle{ x^md(x) }[/math] by [math]\displaystyle{ g(x) }[/math]:

[math]\displaystyle{ x^md(x) = g(x)\cdot q(x) + r(x),\, }[/math]

where [math]\displaystyle{ r(x) }[/math] is of degree less than [math]\displaystyle{ m }[/math]. The code word corresponding to the data word [math]\displaystyle{ d(x) }[/math] is then defined to be

[math]\displaystyle{ p(x) := x^md(x) - r(x),\, }[/math]

Note the following properties:

  1. [math]\displaystyle{ p(x) = g(x)\cdot q(x) }[/math], which is divisible by [math]\displaystyle{ g(x) }[/math]. In particular, [math]\displaystyle{ p(x) }[/math] is a valid code word.
  2. Since [math]\displaystyle{ r(x) }[/math] is of degree less than [math]\displaystyle{ m }[/math], the leftmost [math]\displaystyle{ n-m }[/math] symbols of [math]\displaystyle{ p(x) }[/math] agree with the corresponding symbols of [math]\displaystyle{ x^md(x) }[/math]. In other words, the first [math]\displaystyle{ n-m }[/math] symbols of the code word are the same as the original data word. The remaining [math]\displaystyle{ m }[/math] symbols are called checksum digits or check bits.

Example

For the above code with [math]\displaystyle{ n=5 }[/math], [math]\displaystyle{ m=2 }[/math], and generator polynomial [math]\displaystyle{ g(x)=x^2+x+1 }[/math], we obtain the following assignment from data words to codewords:

  • 000 ↦ 00000
  • 001 ↦ 00111
  • 010 ↦ 01001
  • 011 ↦ 01110
  • 100 ↦ 10010
  • 101 ↦ 10101
  • 110 ↦ 11011
  • 111 ↦ 11100

Decoding

An erroneous message can be detected in a straightforward way through polynomial division by the generator polynomial resulting in a non-zero remainder.

Assuming that the code word is free of errors, a systematic code can be decoded simply by stripping away the [math]\displaystyle{ m }[/math] checksum digits.

If there are errors, then error correction should be performed before decoding. Efficient decoding algorithms exist for specific polynomial codes, such as BCH codes.

Properties of polynomial codes

As for all digital codes, the error detection and correction abilities of polynomial codes are determined by the minimum Hamming distance of the code. Since polynomial codes are linear codes, the minimum Hamming distance is equal to the minimum weight of any non-zero codeword. In the example above, the minimum Hamming distance is 2, since 01001 is a codeword, and there is no nonzero codeword with only one bit set.

More specific properties of a polynomial code often depend on particular algebraic properties of its generator polynomial. Here are some examples of such properties:

  • A polynomial code is cyclic if and only if the generator polynomial divides [math]\displaystyle{ x^n-1 }[/math].
  • If the generator polynomial is primitive, then the resulting code has Hamming distance at least 3, provided that [math]\displaystyle{ n\leq 2^m-1 }[/math].
  • In BCH codes, the generator polynomial is chosen to have specific roots in an extension field, in a way that achieves high Hamming distance.

The algebraic nature of polynomial codes, with cleverly chosen generator polynomials, can also often be exploited to find efficient error correction algorithms. This is the case for BCH codes.

Specific families of polynomial codes

  • Cyclic codes – every cyclic code is also a polynomial code; a popular example is the CRC code.
  • BCH codes – a family of cyclic codes with high Hamming distance and efficient algebraic error correction algorithms.
  • Reed–Solomon codes – an important subset of BCH codes with particularly efficient structure.

References

  • W.J. Gilbert and W.K. Nicholson: Modern Algebra with Applications, 2nd edition, Wiley, 2004.
  • R. Lidl and G. Pilz. Applied Abstract Algebra, 2nd edition. Wiley, 1999.