Algorithm to find the irreducible polynomial. What algorithm can be used find an irreducible polynomial of degree n over the field GF(p) for prime p. The reason I ask is I want to make a program for finite field arithmetic, but creating a field GF(p^k) requires finding a irreducible polynomial. (I'm mostly interested in GF(2^k).)

Jefferson Booth

Jefferson Booth

Answered question

2022-11-08

Algorithm to find the irreducible polynomial
What algorithm can be used find an irreducible polynomial of degree n over the field GF(p) for prime p. The reason I ask is I want to make a program for finite field arithmetic, but creating a field G F ( p k ) requires finding a irreducible polynomial. (I'm mostly interested in G F ( 2 k ).)

Answer & Explanation

cismadmec

cismadmec

Beginner2022-11-09Added 22 answers

Step 1
The multiplicative group of F p k is cyclic of order m = p k 1. If α is a generator, then it is a root of the polynomial X m 1. We can use the Möbius principle to get rid of roots of lower degree and find that the minimal polynomial of α over F p is
d m ( X m / d 1 ) μ ( m / d )
Step 2
For example with F 64 and m = 63 = 3 2 7 we arrive at
( X 63 1 ) ( X 3 1 ) ( X 21 1 ) ( X 9 1 ) = X 36 X 33 + X 27 X 24 + X 18 X 12 + X 9 X 3 + 1
(Actually, the signs ± do not matter over F 2 )
Jenny Roberson

Jenny Roberson

Beginner2022-11-10Added 4 answers

Step 1
As others indicated, you can find irreducible polynomials of degree n by factoring x p n x modulo p, and throwing away factors that have too small a degree. The algorithms by Cantor-Zassenhaus and Berlekamp are useful to that end. Do note that the characteristic zero factor in Hagen's answer is very far from being irreducible modulo 2.
But, observe that factoring x p m x is not an option, when p m is too big. If that is a concern for you then the easiest to comprehend test I can imagine would be to generate random monic polynomials p(x) of degree m. The probability for such a polynomial to be irreducible is roughly 1/m (the exact number is given by a Möbius formula). You can then either
A) Proceed with Berlekamp or Cantor-Zassenhaus and try to factor your candidate. If none are found you know the polynomial is irreducible. Or,
B) For each positive integer d m / 2 calculate the greatest common divisor
gcd ( p ( x ) , x p d x ) .
Step 2
If no common divisors are found, then you know p(x) has no factors of degree d, so if no factors are found with d up to m/2, you know that p(x) must be irreducible. Observe that calculating gcd's like this is quite fast. Only in the first step of Euclid's algorithm will you have high degree polynomials. That high degree polynomial is a binomial, so calculating its remainder modulo p(x) is fast with the aid of square-and-multiply.
For small k there are tables. I use this table when p = 2, because it gives primitive polynomials, i.e. minimal polynomials of a generator of the multiplicative group of G F ( 2 k ). For other small p and small k Lidl & Niederreiter have more extensive tables. The book is a bit pricy (and also recommended for hardcore enthusiasts on finite fields only), so go to a university library near you rather than order one from Amazon. Also, they put more effort into listing all the irreducible polynomials rather than giving sample irreducibles of several degrees. Depending on what you want to do a given table may not be useful to you.

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?