← LibraryHensel Lifting and Factorisation over the IntegersEngineering · MathematicsLesson 4/5← PrevNext →
GuidePublished 6 Aug 20265 min readBy Kevin JoginComputational Number TheoryPolynomial AlgorithmsHensel LiftingHensel Lemma
Skip to the main content

MathematicsPolynomial Algorithms

Hensel Lifting and Factorisation over the Integers

Lifting a factorisation from mod p to mod pk, and the recombination problem that LLL finally solved.

Executive summary

Factor modulo a small prime, lift, then recombine — the last step is the hard one

A factorisation modulo p lifts to a factorisation modulo any power of p, provided the factors are coprime modulo p. Lifting far enough that the coefficients exceed Mignotte's bound means the true integer factors can be read off — if the correct grouping of modular factors is known. Finding that grouping is the recombination problem, and its naive solution is exponential. The Lenstra–Lenstra–Lovász paper solved it, which is why LLL exists at all.

Learning objectives

  • State Hensel's lemma and its coprimality hypothesis.
  • Implement quadratic lifting and state its cost.
  • Use Mignotte's bound to determine the required lifting height.
  • Explain why recombination is the bottleneck.
  • Outline the LLL and van Hoeij approaches to recombination.

Section 01Hensel's lemma

Suppose f ≡ gh (mod p) with gh coprime modulo p. Then the factorisation lifts uniquely to modulo pk for every k.

AlgorithmQuadratic Hensel liftingin: f, factors mod p, target height  →  out: factors mod pk
  1. Compute s, t with sg + th ≡ 1 (mod p) by the extended Euclidean algorithm in Fp[x]. Coprimality is exactly what makes this possible.
  2. Given g, h correct modulo pk, set e ← f − gh, which is divisible by pk.
  3. Solve for corrections: δg ← te mod g and δh ← se mod h, both reduced modulo pk.
  4. Set g ← g + δg and h ← h + δh; the factorisation is now correct modulo p2k. The exponent doubles each round.
  5. Update s and t to the new modulus and repeat until pk exceeds the target.
Doubling the exponent each round means O(log k) iterations. Linear lifting, which advances one power at a time, is simpler but needs O(k) rounds.
Coprimality is the whole hypothesis

If the modular factors share a root, the lift is not unique and the algorithm fails. This is why f must be squarefree and why p must not divide the discriminant — and why the choice of p includes a check that the factorisation modulo p is squarefree.

Section 02How far to lift: Mignotte's bound

The coefficients of any divisor of f over ℤ are bounded in terms of the degree and the norm of f:

g ≤ 2deg gf2

Lifting until pk exceeds twice this bound guarantees that each true factor is determined by its residue modulo pk, taken in the symmetric range.

The bound is pessimistic and the cost is real

Mignotte's bound is worst-case and usually far above the actual coefficient sizes, so the lifting height — and therefore the cost of every subsequent operation — is larger than strictly necessary. Practical implementations lift incrementally, attempt recombination early, and lift further only if it fails.

Section 03The recombination problem

Suppose f factors into r irreducible factors modulo pk. Each true factor over ℤ is a product of some subset of them. Testing all subsets costs 2r trial divisions.

2rsubsets in the naive search
Polynomialcost of the LLL-based method
≈ r²typical lattice dimension in van Hoeij's method
Where the difficulty actually is

The hard case is a polynomial that is irreducible over ℤ but splits into many factors modulo every prime — the Swinnerton-Dyer polynomials are the standard family. Every subset must be rejected, so the naive search runs its full exponential course before concluding that no factorisation exists.

Recombination strategies
StrategyCostNotes
Exhaustive subsets (Zassenhaus)O(2r)Fast when r is small, which is the common case in practice
LLL on a coefficient latticePolynomialThe original polynomial-time result; the lattice dimension makes it slow in practice
van Hoeij's knapsack methodPolynomial, and fastReduces a much smaller lattice built from power sums — the current standard
Multiple primesHeuristicFactor modulo several primes; the true degrees must be consistent across all of them

Section 04The complete pipeline

  1. Stage 01PreprocessRemove content, make primitive, take the squarefree part. Handle degree 0 and 1 directly.
  2. Stage 02Choose a primeSelect p not dividing the leading coefficient or the discriminant, so that f stays squarefree modulo p. Try several and keep the one giving the fewest factors.
  3. Stage 03Factor modulo pApply the finite-field pipeline: squarefree, distinct-degree, equal-degree.
  4. Stage 04Hensel liftLift to pk beyond Mignotte's bound, using quadratic lifting.
  5. Stage 05RecombineFind the subsets of modular factors forming true integer factors; verify each by exact division.
Choosing the prime is worth effort

The number of modular factors varies substantially with p, and recombination cost depends on it directly. Trying several candidate primes and keeping the one with the fewest factors is cheap and frequently pays for itself several times over.

ReferenceFrequently asked questions

Why lift quadratically rather than linearly?

Because the number of rounds drops from O(k) to O(log k). Each quadratic round is more expensive, but the reduction in round count dominates once the target height is more than a few powers of p.

Does this extend to multivariate polynomials?

Yes — lift with respect to one variable, treating the others as parameters, using the ideal generated by (y − a) in place of p. The recombination problem reappears in the same form, and the same techniques apply.

Is factoring over a number field similar?

Structurally yes: reduce modulo a prime ideal of good reduction, factor over the residue field, lift and recombine. The extra difficulty is choosing a prime ideal of degree 1 that does not divide the relevant discriminants, and handling the denominators introduced by the integral basis.

NavigateContinue in this stream

Curated next steps from this page. The site also surfaces algorithmically related reading below.

ProvenanceSources and further reading

This page is an original KEVOS explanatory article. It presents the underlying mathematics — definitions, algorithms, complexity results and selection criteria — in KEVOS editorial voice. No text is reproduced from any copyrighted source. Where numerical tables are relevant, KEVOS links to live authoritative databases rather than republishing static values.

Page ID
KV-MATH-0022
Taxonomy
ENG-MATH — Engineering / Mathematics
Collection
COL-CANT-001
Topic stream
CANT-POLYNOMIALS
Version
1.1.0 / content 2026.08
Last reviewed
2026-08-06

Continue learning

Factorisation of Polynomials Modulo a PrimeGuide · MathematicsNEXT LESSON →Root Finding over the Complex NumbersGuide · MathematicsThe Subresultant Algorithm, Resultants and DiscriminantsGuide · MathematicsPolynomial Arithmetic and GCD in Unique Factorisation DomainsGuide · Mathematics