Girish Mahajan (Editor)

Berlekamp's algorithm

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

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.

Contents

Overview

Berlekamp's algorithm takes as input a square-free polynomial f ( x ) (i.e. one with no repeated factors) of degree n with coefficients in a finite field F q 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 = F q [ x ] f ( x ) .

The algorithm focuses on polynomials g ( x ) R which satisfy the congruence:

g ( x ) q g ( x ) ( mod f ( x ) ) .

These polynomials form a subalgebra of R (which can be considered as an n -dimensional vector space over F q ), called the Berlekamp subalgebra. The Berlekamp subalgebra is of interest because the polynomials g ( x ) it contains satisfy

f ( x ) = s F q 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 × n matrix over F q , which is derived from the so-called Berlekamp matrix of the polynomial, denoted Q . If Q = [ q i , j ] then q i , j is the coefficient of the j -th power term in the reduction of x i q modulo f ( x ) , i.e.:

x i q q i , n 1 x n 1 + q i , n 2 x n 2 + + q i , 0 ( mod f ( x ) ) .

With a certain polynomial g ( x ) R , say:

g ( x ) = g n 1 x n 1 + g n 2 x n 2 + + g 0 ,

we may associate the row vector:

g = ( g 0 , g 1 , , g n 1 ) .

It is relatively straightforward to see that the row vector g Q corresponds, in the same way, to the reduction of g ( x ) q modulo f ( x ) . Consequently a polynomial g ( x ) R is in the Berlekamp subalgebra if and only if g ( Q I ) = 0 (where I is the n × n identity matrix), i.e. if and only if it is in the null space of Q I .

By computing the matrix 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.

Applications

One important application of Berlekamp's algorithm is in computing discrete logarithms over finite fields F p n , where p is prime and n 2 . 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 p n in the usual way - that is, as polynomials over the base field F p , 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 [1] website.

References

Berlekamp's algorithm Wikipedia