← LibraryDistinct Degree FactorizationEngineering · MathematicsLesson 192/385← PrevNext →
ArticlePublished 7 Aug 20263 min readBy Kevin Jogin

Engineering  /  Mathematics  — Finite Fields

Distinct Degree Factorization

Separating the irreducible factors of a polynomial by degree using gcds with Frobenius powers.

Page KV-MATH-0464Reading time 3 minReviewed 2026-08-07Author Kevin Jogin

Executive summary

Distinct degree factorisation splits a squarefree polynomial into parts, each the product of all irreducible factors of a given degree, using the identity for X to the q to the d minus X.

It is deterministic and is the first stage of the Cantor-Zassenhaus algorithm.

Learning objectives

  1. State the identity underlying the method.
  2. Give the algorithm and its cost.
  3. Explain the early termination condition.

01The identity

Theorem

Product of irreducibles by degree

Over F_q,

X^{q^d} − X = ∏ (all monic irreducible polynomials whose degree divides d).

This follows from the subfield characterisation: the roots of X^{q^d} − X are exactly the elements of F_{q^d}, and an element lies there exactly when its minimal polynomial has degree dividing d.

Taking a gcd with a target polynomial therefore extracts precisely the factors of degree dividing d. Sweeping d upwards and dividing out at each stage separates the factors by degree.

02The algorithm

Algorithm

Distinct degree factorisation

Inputsquarefree monic f over F_q
Outputfor each d, the product of all irreducible factors of degree d
  1. Given squarefree monic f. Set h = X and d = 0.
  2. While deg f > 0:
  3.   Increment d and set h = h^q mod f, by applying Frobenius.
  4.   Compute g = gcd(h − X, f).
  5.   If g ≠ 1, record g as the product of all degree-d factors, and set f = f/g.
  6.   If d > deg(f)/2, record the remaining f as irreducible and stop.
  7. Return the list of (degree, product) pairs.
Cost  O(n² log q) field operations with a Frobenius matrix

The early termination is important and easy to omit. Once d exceeds half the remaining degree, no factor of degree d can be accompanied by another, so what remains must be irreducible.

03What it does and does not do

  1. Squarefree decomposition

    Remove repeated factors, so the input is squarefree.

  2. Distinct degree factorisation

    Separate by degree; deterministic.

  3. Equal degree factorisation

    Split each same-degree group into individual factors; randomised.

The three stages of factorisation
StageDeterministic?Output
Squarefree decompositionYesSquarefree parts with multiplicities
Distinct degreeYesProducts grouped by factor degree
Equal degreeNoIndividual irreducible factors

Only the third stage requires randomness, and only when a degree group contains more than one factor. Many polynomials factor completely after the deterministic stages, which is why implementations check after each stage rather than always running all three.

04Frequently asked questions

Why compute h^q by Frobenius rather than exponentiation?

Because Frobenius is a linear map with a precomputable matrix, so applying it is a matrix-vector product. General exponentiation to the q-th power would cost a factor of log q more.

What if the input is not squarefree?

The gcd computations misbehave and the degree separation is unreliable. Squarefree decomposition must run first, which is why it is the documented precondition.

Why is the early termination correct?

Because a polynomial of degree m with all factors of degree greater than m/2 can have only one factor. Once d passes that threshold, the remaining polynomial cannot decompose further.

Sources and method

Structural reference: Victor Shoup, A Computational Introduction to Number Theory and Algebra, Version 1, Cambridge University Press, 2005 — book pages 467-471.

This page carries the durable method layer only: definitions, constructions, algorithms, complexity results and selection criteria, authored originally for KEVOS. No text is transcribed or paraphrased from the source, and no numeric tables or benchmark data are reproduced — these are routed to live authoritative sources instead.

Author: Kevin Jogin. Last reviewed 2026-08-07.

Continue learning

Computing Minimal Polynomials over Finite FieldsArticle · MathematicsNEXT LESSON →Equal Degree FactorizationArticle · MathematicsTesting and Constructing Irreducible PolynomialsArticle · MathematicsAnalysis of the Cantor-Zassenhaus AlgorithmArticle · Mathematics