← LibraryThe LLL Lattice Basis Reduction AlgorithmEngineering · MathematicsLesson 248/385← PrevNext →
ArticlePublished 7 Aug 20263 min readBy Kevin JoginLLLlattice reductionLovasz conditionshort vectors

Lattices and LLL Reduction

The LLL Lattice Basis Reduction Algorithm

The LLL algorithm: size reduction interleaved with swaps under the Lovasz condition, and the guarantees it provides in polynomial time.

Engineering / MathematicsLattices and LLL Reduction3 min readKV-MATH-0546

LLL produces a basis that is short and nearly orthogonal, in polynomial time, for a lattice of any rank. It is the single most important algorithm in this collection outside the factoring methods, and it appears in polynomial factorisation, number field computation and normal form control alike.

The two operations

LLL alternates between size reduction, which bounds the Gram-Schmidt coefficients, and swapping adjacent basis vectors when doing so shortens the basis.

Lovasz condition: ||b_k||^2 >= (delta - mu_{k,k-1}^2) ||b_{k-1}||^2delta is a parameter strictly between one quarter and one, conventionally three quarters.

The LLL algorithm

  1. Size reduceReduce the current vector against all preceding ones, rounding each coefficient.
  2. Test LovaszCheck whether the current vector is long enough relative to its predecessor.
  3. Swap or advanceIf the condition fails, swap with the predecessor and step back; otherwise advance.
  4. RepeatContinue until the condition holds at every index.

What it guarantees

The first vector of an LLL-reduced basis is within an exponential factor of the shortest — but the factor depends only on the rank, not on the entries.

||b_1|| <= 2^((n-1)/2) * (shortest vector length)For the conventional parameter value; n is the rank.

Termination and cost

Termination is proved by a potential function built from the Gram-Schmidt lengths, which strictly decreases at every swap and is bounded below. The number of swaps is therefore polynomial.

O(n^4 log B) arithmetic operations on integers of size O(n log B)n is the rank, B bounds the input entries.

Why it is everywhere

LLL applications in this collection
ApplicationWhat LLL provides
Polynomial factoringRecovers a true factor from a p-adic approximation
Normal formsControls coefficient growth
Polynomial reductionFinds a small defining polynomial for a number field
Dependence detectionRecovers exact relations from numerical approximations
Ideal reductionFinds a small representative in an ideal class

Frequently Asked Questions

What does the delta parameter do?
It trades reduction quality against running time. Values closer to one give shorter bases and more swaps; three quarters is the conventional compromise. Values at or below one quarter break the termination proof.
Does LLL find the shortest vector?
Not guaranteed — only within an exponential factor in the rank. In practice it frequently does, and enumeration methods can certify the shortest vector for small ranks.

Source. Henri Cohen, A Course in Computational Algebraic Number Theory, Springer GTM 138 — 2.6.1. Structural reference unverified: the source file was not available during authoring; chapter and section numbers are taken from the published edition and have not been checked against a physical copy.

Continue learning

NEXT LESSON →The LLL Lattice Basis Reduction AlgorithmArticle · MathematicsLattice Determinant and the Hadamard BoundArticle · MathematicsLLL Reduction Quality and Proof SketchArticle · MathematicsThe Gram-Schmidt Orthogonalisation ProcedureArticle · Mathematics