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:
- The number of factors, for free, as ;
- 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
- Square-free part. Replace by and handle repeated factors separately (square-free decomposition).
- Build the Berlekamp matrix , whose -th row is expressed in the basis . Computing each row costs a modular exponentiation.
- Null space of by Gaussian elimination — this gives a basis of the kernel, and is the factor count.
- 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
| Berlekamp | Cantor-Zassenhaus | |
|---|---|---|
| Type | deterministic (small ) | randomized (Las Vegas) |
| Cost | expected | |
| Best when | is small (e.g. ) | is large |
| Gives factor count first | yes | no |
| Used in practice | small fields, coding theory | general, 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
- Cantor-Zassenhaus — the randomized standard for large fields
- Hensel lifting — lift a factorisation mod to mod , then to
- Polynomial Factorization — the topic page
- Berlekamp-Massey — same author, different problem (finding linear recurrences)