← LibrarySquare-Free Decomposition of PolynomialsEngineering · MathematicsLesson 195/385← PrevNext →
ArticlePublished 7 Aug 20263 min readBy Kevin Jogin

Engineering  /  Mathematics  — Finite Fields

Square-Free Decomposition of Polynomials

Removing repeated factors using gcds with the derivative, and the characteristic p complication.

Page KV-MATH-0467Reading time 4 minReviewed 2026-08-07Author Kevin Jogin

Executive summary

Squarefree decomposition splits a polynomial into parts with no repeated factors, recording the multiplicities. It uses gcds with the formal derivative and is deterministic.

In characteristic p the derivative can vanish on a non-constant polynomial, which requires a separate branch.

Learning objectives

  1. State the derivative-based method.
  2. Handle the vanishing derivative case.
  3. Explain why it precedes the other factorisation stages.

01The derivative criterion

Theorem

Repeated factors and the derivative

An irreducible g divides gcd(f, f') to one power less than it divides f. In particular f is squarefree if and only if gcd(f, f') = 1, provided no factor has vanishing derivative.

The mechanism is the product rule: if f = g^k h then f' = k g^{k−1} g' h + g^k h', so g^{k−1} divides the derivative but g^k generally does not.

Algorithm

Squarefree decomposition, characteristic 0 or p not dividing exponents

Inputmonic f over a field
Outputsquarefree parts with their multiplicities
  1. Compute g = gcd(f, f').
  2. Set w = f/g, the product of the distinct irreducible factors.
  3. For i = 1, 2, ...:
  4.   Compute y = gcd(w, g), and record w/y as the product of factors of multiplicity exactly i.
  5.   Set w = y and g = g/y.
  6. Continue until g is constant.
Cost  O(n²) field operations

02The characteristic p complication

Theorem

Vanishing derivative

Over F_q of characteristic p, f' = 0 if and only if f(X) = g(X^p) for some polynomial g.

In that case every exponent is a multiple of p, and because Frobenius is surjective on a finite field, f is a perfect p-th power: taking p-th roots of the coefficients gives f = h^p.

  1. Detect the vanishing derivative

    Check whether f' is the zero polynomial.

  2. Extract the p-th root

    Take the p-th root of each coefficient — possible because Frobenius is surjective — and divide exponents by p.

  3. Recurse

    Decompose the root, then raise every multiplicity by a factor of p.

03Why it comes first

The later stages assume a squarefree input and misbehave otherwise.

Squarefree as a precondition
StageRequires squarefree?Failure if not
Distinct degreeYesGcd degrees are wrong; separation unreliable
Equal degreeYesQuotient algebra has nilpotents; not a product of fields
BerlekampYesKernel dimension no longer counts distinct factors

The structural reason is uniform. A repeated factor makes the quotient algebra non-reduced, introducing nilpotent elements, so it is no longer a product of fields — and every later stage relies on that product structure.

Squarefree decomposition is cheap relative to the stages that follow, so running it unconditionally costs little and removes an entire class of failure.

04Frequently asked questions

Is squarefree the same as having distinct roots?

Over a perfect field, yes — squarefree means no repeated irreducible factor, which for a finite field means no repeated root in the algebraic closure. Over imperfect fields the notions can separate.

Why can a p-th root always be extracted over a finite field?

Because Frobenius is surjective there, so every coefficient has a unique p-th root. Over an infinite field of characteristic p this fails and the decomposition needs more care.

Does the algorithm find the multiplicities?

Yes, that is its output: each squarefree part is tagged with the multiplicity at which its factors occur, so the original polynomial is the product of the parts raised to those powers.

Sources and method

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

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

Analysis of the Cantor-Zassenhaus AlgorithmArticle · MathematicsNEXT LESSON →Berlekamp's Factorization AlgorithmArticle · MathematicsEqual Degree FactorizationArticle · MathematicsAnalysis of Berlekamp's AlgorithmArticle · Mathematics