The Lenstra–Lenstra–Lovász (LLL) lattice basis reduction algorithm is a polynomial time lattice reduction algorithm invented by Arjen Lenstra, Hendrik Lenstra and László Lovász in 1982. Given a basis with n-dimensional integer coordinates, for a lattice L (a discrete subgroup of Rn) with , the LLL algorithm calculates an LLL-reduced (short, nearly orthogonal) lattice basis in time
where B is the largest length of under the Euclidean norm.
The original applications were to give polynomial-time algorithms for factorizing polynomials with rational coefficients, for finding simultaneous rational approximations to real numbers, and for solving the integer linear programming problem in fixed dimensions.
The precise definition of LLL-reduced is as follows: Given a basis
define its Gram–Schmidt process orthogonal basis
and the Gram-Schmidt coefficients
- , for any .
Then the basis is LLL-reduced if there exists a parameter in (0.25,1] such that the following holds:
- (size-reduced) For . By definition, this property guarantees the length reduction of the ordered basis.
- (Lovász condition) For k = 1,2,..,n .
Here, estimating the value of the parameter, we can conclude how well the basis is reduced. Greater values of lead to stronger reductions of the basis.
Initially, A. Lenstra, H. Lenstra and L. Lovász demonstrated the LLL-reduction algorithm for .
Note that although LLL-reduction is well-defined for , the polynomial-time complexity is guaranteed only
for in .
The LLL algorithm computes LLL-reduced bases. There is no known efficient algorithm to compute a basis in which the basis vectors are as short as possible for lattices of dimensions greater than 4. such that the first basis vector is no more than times as long as a shortest vector in the lattice,
the second basis vector is likewise within of the second successive minimum, and so on.
However, an LLL-reduced basis is nearly as short as possible, in the sense that there are absolute bounds
The following description is based on (Hoffstein, Pipher & Silverman 2008, Theorem 6.68), with the corrections from the errata.
- a lattice basis ,
- parameter with , most commonly
Perform Gram-Schmidt, but do not normalize:
Define , which must always use the most current values of .
for j from to 0 do
Update ortho entries and related 's as needed.
(The naive method is to recompute whenever a changes.)
Swap and .
Update ortho entries and related 's as needed. (See above comment.)
OUTPUT: LLL reduced basis
The following presents an example due to W. Bosma.
Let a lattice basis , be given by the columns of
Then according to the LLL algorithm we obtain the following:
- For DO:
- For set
- Here the step 4 of the LLL algorithm is skipped as size-reduced property holds for
- For and for calculate and :
- While DO
- Length reduce and correct and
according to reduction subroutine in step 4:
For EXECUTE reduction subroutine RED(3,1):
For EXECUTE reduction subroutine RED(3,2):
- As takes place, then
Apply a SWAP, continue algorithm with the lattice basis, which is given by columns
Implement the algorithm steps again.
- For EXECUTE reduction subroutine RED(2,1):
- As takes place,
- Exchange and
OUTPUT: LLL reduced basis
The LLL algorithm has found numerous other applications in MIMO detection algorithms  and cryptanalysis of public-key encryption schemes: knapsack cryptosystems, RSA with particular settings, NTRUEncrypt, and so forth. The algorithm can be used to find integer solutions to many problems.
In particular, the LLL algorithm forms a core of one of the integer relation algorithms. For example, if it is believed that r=1.618034 is a (slightly rounded) root to an unknown quadratic equation with integer coefficients, one may apply LLL reduction to the lattice in spanned by and . The first vector in the reduced basis will be an integer linear combination of these three, thus necessarily of the form ; but such a vector is "short" only if a, b, c are small and is even smaller. Thus the first three entries of this short vector are likely to be the coefficients of the integral quadratic polynomial which has r as a root. In this example the LLL algorithm finds the shortest vector to be [1, -1, -1, 0.00025] and indeed has a root equal to the golden ratio, 1.6180339887….
LLL is implemented in
- Arageli as the function
- fpLLL as a stand-alone implementation
- GAP as the function
- Macaulay2 as the function
LLL in the package
- Magma as the functions
LLLGram (taking a gram matrix)
- Maple as the function
- Mathematica as the function
- Number Theory Library (NTL) as the function
- PARI/GP as the function
- Pymatgen as the function
- SageMath as the method
LLL driven by fpLLL and NTL
- ^ Lenstra, A. K.; Lenstra, H. W., Jr.; Lovász, L. (1982). "Factoring polynomials with rational coefficients". Mathematische Annalen. 261 (4): 515–534. doi:10.1007/BF01457454. hdl:1887/3810. MR 0682664.
- ^ Silverman, Joseph. "Introduction to Mathematical Cryptography Errata" (PDF). Brown University Mathematics Dept. Retrieved 5 May 2015.
- ^ Bosma, Wieb. "4. LLL" (PDF). Lecture notes. Retrieved 28 February 2010.
- ^ Shahabuddin, Shahriar et al., "A Customized Lattice Reduction Multiprocessor for MIMO Detection", in Arxiv preprint, January 2015.
- ^ D. Simon (2007). "Selected applications of LLL in number theory" (PDF). LLL+25 Conference. Caen, France.