Communications Toolbox    

Polynomials over Galois Fields

You can use Galois vectors to represent polynomials in an indeterminate quantity x, with coefficients in a Galois field. Form the representation by listing the coefficients of the polynomial in a vector in order of descending powers of x. For example, the vector

represents the polynomial Ax3 + 1x2 + 0x + (A+1), where

You can then use such a Galois vector to perform arithmetic with, evaluate, and find roots of polynomials. You can also find minimal polynomials of elements of a Galois field.

Addition and Subtraction of Polynomials

To add and subtract polynomials, use the ordinary + and - operators on equal-length Galois vectors that represent the polynomials. If one polynomial has lower degree than the other, then you must pad the shorter vector with zeros at the beginning so that the two vectors have the same length. The example below shows how to add a degree-one polynomial in x to a degree-two polynomial in x.

Multiplication and Division of Polynomials

To multiply and divide polynomials, use the conv and deconv functions on Galois vectors that represent the polynomials. Multiplication and division of polynomials is equivalent to convolution and deconvolution of vectors. The deconv function returns the quotient of the two polynomials as well as the remainder polynomial. Examples are below.

Note that the multiplication and division operators described in Arithmetic in Galois Fields multiply elements or matrices, but not polynomials.

Evaluating Polynomials

To evaluate a polynomial at an element of a Galois field, use the polyval function. It behaves like the ordinary MATLAB polyval function when given exactly two input arguments. The example below illustrates how to evaluate a polynomial at several elements in a field. It also checks the results using the operators .^ and .* in the field.

The first element of y evaluates the polynomial at 0 and, therefore, returns the polynomial's constant term of 3.

Roots of Polynomials

To find the roots of a polynomial in a Galois field, use the roots function on a Galois vector that represents the polynomial. This function finds roots that are in the same field that the Galois vector is in. The number of times an entry appears in the output vector from roots is exactly its multiplicity as a root of the polynomial.

The examples below find roots of cubic polynomials in GF(8).

Roots of Binary Polynomials

In the special case of a polynomial having binary coefficients, it is also easy to find roots that exist in an extension field. This because the elements 0 and 1 have the same unambiguous representation in all fields of characteristic two. To find roots of a binary polynomial in an extension field, apply the roots function to a Galois vector in the extension field whose array elements are the binary coefficients of the polynomial.

The example below seeks roots of a binary polynomial in various fields.

The roots of the polynomial do not exist in GF(2), so noroots is an empty array. However, the roots of the polynomial exist in GF(4) as well as in GF(16), so roots4 and roots16 are nonempty.

Notice that roots4 and roots16 are not equal to each other. They differ in these ways:

Minimal Polynomials

The minimal polynomial of an element of GF(2m) is the smallest-degree nonzero binary-coefficient polynomial having that element as a root in GF(2m). To find the minimal polynomial of an element or a column vector of elements, use the minpol function.

The code below finds that the minimal polynomial of gf(6,4) is D2 + D + 1 and then checks that gf(6,4) is indeed among the roots of that polynomial in the field GF(16).

To find out which elements of a Galois field share the same minimal polynomial, use the cosets function.


  Signal Processing Operations in Galois Fields Manipulating Galois Variables