Purpose: Factor a polynomial over a finite field in — deterministic for small , and the classical answer to “factor this polynomial mod ”.

The Idea: the Berlekamp subalgebra

Suppose with distinct irreducible factors. By CRT,

Consider the Frobenius map . It is -linear, and its kernel — the Berlekamp subalgebra — consists exactly of the elements that are constant in each CRT component. Its dimension is therefore , the number of irreducible factors.

That gives two things at once:

  1. The number of factors, for free, as ;
  2. A way to split: for any non-constant in the kernel and any , is a product of exactly those whose component of equals — a non-trivial factor whenever is non-constant.

Algorithm

  1. Square-free part. Replace by and handle repeated factors separately (square-free decomposition).
  2. Build the Berlekamp matrix , whose -th row is expressed in the basis . Computing each row costs a modular exponentiation.
  3. Null space of by Gaussian elimination — this gives a basis of the kernel, and is the factor count.
  4. Split. For each non-trivial and each , take . Repeat on the pieces until factors are isolated.

Complexity

  • Building : field operations
  • Null space:
  • Splitting: deterministic — linear in , which is fine for small primes and hopeless for large ones
  • Randomized splitting (Cantor-Zassenhaus style) removes the dependence

Berlekamp vs Cantor-Zassenhaus

BerlekampCantor-Zassenhaus
Typedeterministic (small )randomized (Las Vegas)
Cost expected
Best when is small (e.g. ) is large
Gives factor count firstyesno
Used in practicesmall fields, coding theorygeneral, most CAS implementations

Uses beyond factorisation

  • Root finding mod . The roots of are the linear factors; computing first isolates them, then splitting finds them. This is the standard way to solve a polynomial congruence.
  • Irreducibility testing. is irreducible iff the Berlekamp subalgebra has dimension 1 — one rank computation, no factorisation needed.
  • Coding theory. Berlekamp designed this while working on error-correcting codes; the same author’s Berlekamp-Massey algorithm decodes BCH and Reed-Solomon codes.

Variants / Use Cases