# Lattice reduction Lattice reduction in two dimensions: the black vectors are the given basis for the lattice (represented by blue dots), the red vectors are the reduced basis

In mathematics, the goal of lattice basis reduction is given an integer lattice basis as input, to find a basis with short, nearly orthogonal vectors. This is realized using different algorithms, whose running time is usually at least exponential in the dimension of the lattice.

## Nearly Orthogonal

One measure of nearly orthogonal is the orthogonality defect. This compares the product of the lengths of the basis vectors with the volume of the parallelepiped they define. For perfectly orthogonal basis vectors, these quantities would be the same.

Any particular basis of $n$ vectors may be represented by a matrix $B$ , whose columns are the basis vectors $b_{i},i=1,\ldots ,n$ . In the fully dimensional case where the number of basis vectors is equal to the dimension of the space they occupy, this matrix is square, and the volume of the fundamental parallelepiped is simply the absolute value of the determinant of this matrix $\det(B)$ . If the number of vectors is less than the dimension of the underlying space, then volume is ${\sqrt {\det(B^{T}B)}}$ . For a given lattice $\Lambda$ , this volume is the same (up to sign) for any basis, and hence is referred to as the determinant of the lattice $\det(\Lambda )$ or lattice constant $d(\Lambda )$ .

The orthogonality defect is the product of the basis vector lengths divided by the parallelepiped volume;

$\delta (B)={\frac {\Pi _{i=1}^{n}\|b_{i}\|}{\sqrt {\det(B^{T}B)}}}={\frac {\Pi _{i=1}^{n}\|b_{i}\|}{d(\Lambda )}}$ From the geometric definition it may be appreciated that $\delta (B)\geq 1$ with equality if and only if the basis is orthogonal.

If the lattice reduction problem is defined as finding the basis with the smallest possible defect, then the problem is NP-hard. However, there exist polynomial time algorithms to find a basis with defect $\delta (B)\leq c$ where c is some constant depending only on the number of basis vectors and the dimension of the underlying space (if different). This is a good enough solution in many practical applications.

## In two dimensions

For a basis consisting of just two vectors, there is a simple and efficient method of reduction closely analogous to the Euclidean algorithm for the greatest common divisor of two integers. As with the Euclidean algorithm, the method is iterative; at each step the larger of the two vectors is reduced by adding or subtracting an integer multiple of the smaller vector.

## Applications

Lattice reduction algorithms are used in a number of modern number theoretical applications, including in the discovery of a spigot algorithm for $\pi$ . Although determining the shortest basis is possibly an NP-complete problem, algorithms such as the LLL algorithm can find a short (not necessarily shortest) basis in polynomial time with guaranteed worst-case performance. LLL is widely used in the cryptanalysis of public key cryptosystems.

When used to find integer relations, a typical input to the algorithm consists of an augmented $n$ x $n$ identity matrix with the entries in the last column consisting of the $n$ elements (multiplied by a large positive constant $w$ to penalize vectors that do not sum to zero) between which the relation is sought.

The LLL algorithm for computing a nearly-orthogonal basis was used to show that integer programming in any fixed dimension can be done in polynomial time.

## Algorithms

The following algorithms reduce lattice bases; several public implementations of these algorithms are also listed.

Year Algorithm Implementation
1773 Lagrange/Gauss reduction for 2D lattices
1982 Lenstra–Lenstra–Lovász reduction NTL, fplll (GitHub link)
1987 Block Korkine Zolotarev NTL, fplll (GitHub link)
1993 Seysen Reduction
{"ft_lang_label":"__label__en","ft_lang_prob":0.86294526,"math_prob":0.9980055,"size":4229,"snap":"2020-34-2020-40","text_gpt3_token_len":992,"char_repetition_ratio":0.13822486,"word_repetition_ratio":0.009404388,"special_character_ratio":0.23551667,"punctuation_ratio":0.14321926,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99973375,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"im_url_duplicate_count":[null,6,null,null,null,null,null,2,null,6,null,2,null,null,null,2,null,2,null,2,null,2,null,2,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-08-05T00:07:55Z\",\"WARC-Record-ID\":\"<urn:uuid:1402c6fb-de71-4d87-9d68-b2b60d2b04f7>\",\"Content-Length\":\"60545\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:7fa4fcc4-233d-45a6-bb8b-23507e80eb93>\",\"WARC-Concurrent-To\":\"<urn:uuid:0946c0d3-0da5-4612-9d42-d59adc6b8895>\",\"WARC-IP-Address\":\"208.80.154.224\",\"WARC-Target-URI\":\"https://en.wikipedia.org/wiki/Lattice_reduction\",\"WARC-Payload-Digest\":\"sha1:UE4SXPYUDBRMKBXIJ64BXVQM5IDRPCXD\",\"WARC-Block-Digest\":\"sha1:7QF5C74GBNEB5ISLP6E7CWCBXVMP4QVJ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-34/CC-MAIN-2020-34_segments_1596439735885.72_warc_CC-MAIN-20200804220455-20200805010455-00042.warc.gz\"}"}