Berlekamp's algorithm explained

In mathematics, particularly computational algebra, Berlekamp's algorithm is a well-known method for factoring polynomials over finite fields (also known as Galois fields). The algorithm consists mainly of matrix reduction and polynomial GCD computations. It was invented by Elwyn Berlekamp in 1967. It was the dominant algorithm for solving the problem until the Cantor–Zassenhaus algorithm of 1981. It is currently implemented in many well-known computer algebra systems.

Overview

f(x)

(i.e. one with no repeated factors) of degree

n

with coefficients in a finite field

Fq

and gives as output a polynomial

g(x)

with coefficients in the same field such that

g(x)

divides

f(x)

. The algorithm may then be applied recursively to these and subsequent divisors, until we find the decomposition of

f(x)

into powers of irreducible polynomials (recalling that the ring of polynomials over a finite field is a unique factorization domain).

All possible factors of

f(x)

are contained within the factor ring

R=

Fq[x]
\langlef(x)\rangle

.

The algorithm focuses on polynomials

g(x)\inR

which satisfy the congruence:

g(x)q\equivg(x)\pmod{f(x)}.

These polynomials form a subalgebra of R (which can be considered as an

n

-dimensional vector space over

Fq

), called the Berlekamp subalgebra. The Berlekamp subalgebra is of interest because the polynomials

g(x)

it contains satisfy

f(x)=

\prod
s\inFq

\gcd(f(x),g(x)-s).

In general, not every GCD in the above product will be a non-trivial factor of

f(x)

, but some are, providing the factors we seek.

Berlekamp's algorithm finds polynomials

g(x)

suitable for use with the above result by computing a basis for the Berlekamp subalgebra. This is achieved via the observation that Berlekamp subalgebra is in fact the kernel of a certain

n x n

matrix over

Fq

, which is derived from the so-called Berlekamp matrix of the polynomial, denoted

l{Q}

. If

l{Q}=[qi,j]

then

qi,j

is the coefficient of the

j

-th power term in the reduction of

xiq

modulo

f(x)

, i.e.:

xiq\equivqi,n-1xn-1+qi,n-2xn-2+\ldots+qi,0\pmod{f(x)}.

With a certain polynomial

g(x)\inR

, say:

g(x)=gn-1xn-1+gn-2xn-2+\ldots+g0,

we may associate the row vector:

g=(g0,g1,\ldots,gn-1).

It is relatively straightforward to see that the row vector

gl{Q}

corresponds, in the same way, to the reduction of

g(x)q

modulo

f(x)

. Consequently, a polynomial

g(x)\inR

is in the Berlekamp subalgebra if and only if

g(l{Q}-I)=0

(where

I

is the

n x n

identity matrix), i.e. if and only if it is in the null space of

l{Q}-I

.

By computing the matrix

l{Q}-I

and reducing it to reduced row echelon form and then easily reading off a basis for the null space, we may find a basis for the Berlekamp subalgebra and hence construct polynomials

g(x)

in it. We then need to successively compute GCDs of the form above until we find a non-trivial factor. Since the ring of polynomials over a field is a Euclidean domain, we may compute these GCDs using the Euclidean algorithm.

Conceptual algebraic explanation

With some abstract algebra, the idea behind Berlekamp's algorithm becomes conceptually clear. We represent a finite field \mathbb_q , where q = p^m for some prime p, as \mathbb_p[y]/(g(y)) . We can assume that f(x) \in \mathbb_q[x] is square free, by taking all possible pth roots and then computing the gcd with its derivative.

Now, suppose that f(x) = f_1(x) \ldots f_n(x) is the factorization into irreducibles. Then we have a ring isomorphism, \sigma: \mathbb_q[x]/(f(x)) \to \prod_i \mathbb_q[x]/(f_i(x)) , given by the Chinese remainder theorem. The crucial observation is that the Frobenius automorphism x \to x^p commutes with \sigma , so that if we denote \text_p(R) = \ , then \sigma restricts to an isomorphism \text_p(\mathbb_q[x]/(f(x))) \to \prod_^n \text_p(\mathbb_q[x]/(f_i(x))) . By finite field theory, \text_p(\mathbb_q[x]/(f_i(x))) is always the prime subfield of that field extension. Thus, \text_p(\mathbb_q[x]/(f(x))) has p elements if and only if f(x) is irreducible.

Moreover, we can use the fact that the Frobenius automorphism is \mathbb_p -linear to calculate the fixed set. That is, we note that \text_p(\mathbb_q[x]/(f(x))) is a \mathbb_p -subspace, and an explicit basis for it can be calculated in the polynomial ring \mathbb_p[x,y]/(f,g) by computing (x^i y^j)^p and establishing the linear equations on the coefficients of x,y polynomials that are satisfied iff it is fixed by Frobenius. We note that at this point we have an efficiently computable irreducibility criterion, and the remaining analysis shows how to use this to find factors.

The algorithm now breaks down into two cases:

For further details one can consult.[1]

Applications

One important application of Berlekamp's algorithm is in computing discrete logarithms over finite fields

F
pn
, where

p

is prime and

n\geq2

. Computing discrete logarithms is an important problem in public key cryptography and error-control coding. For a finite field, the fastest known method is the index calculus method, which involves the factorisation of field elements. If we represent the field
F
pn
in the usual way - that is, as polynomials over the base field

Fp

, reduced modulo an irreducible polynomial of degree

n

- then this is simply polynomial factorisation, as provided by Berlekamp's algorithm.

Implementation in computer algebra systems

Berlekamp's algorithm may be accessed in the PARI/GP package using the factormod command, and the WolframAlpha http://www.wolframalpha.com/input/?i=factor+x^5+%2B+x+mod+17 website.

See also

References

Notes and References

  1. Book: Theory of Computation - Dexter Kozen . Springer . 2020-09-19.