arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Lagrange's algorithm

hashtag
Overview

Lagrange's algorithm, often incorrectly called Gaussian reduction, is the 2D analouge to the Euclidean algorithm and is used for lattice reduction. Intuitively, lattice reduction is the idea of finding a new basis that consists of shorter vectors. Before going into Lagrange's algorithm, we first recap the Euclidean algorithm:

The algorithm primarily consists of two steps, a reduction step where the size of mmmis brought down by a multiple of nnnand a swapping step that ensures mmmis always the largest number. We can adapt this idea for lattices:

Here is actually the Gram-Schmidt coefficient and it turns out that this algorithm will always find the shortest possible basis! Using the basis

the Lagrange reduction looks like

and here we see it clearly gives the shortest vectors.

hashtag
Optimality proof

Let be a lattice. The basis is defined to be the shortest for any other basis , we have and . Note that this generally cannot be generalized to other dimensions, however in dimension 2, this is possible and is given by Lagrange's algorithm. The proof is a somewhat messy sequence of inequalities that eventually lead to the conclusion we want.

Let be the output of the Lagrange reduction for some lattice . To prove that Lagrange reduction gives the shortest basis, we first show that is the shortest vector in .

We know that from the algorithm directly. Let be any element in . We first show that :

Since , this quantity is only when and is a positive integer for all other cases, hence and is a shortest vector of . Note that we can have multiple vectors with the same norm as , for instance . So this is not a unique shortest vector.

Suppose there exists some basis for such that . We show that . Let .

If , then as must form a basis. This means that and by the inequality above, we must have or . The first case tells us that . By squaring the second case, we get

but since is the shortest vector, .

Otherwise, we have and , so

Hence proving Lagrange's algorithm indeed gives us the shortest basis vectors.

hashtag
Exercises

1) Show that the output of Lagrange's algorithm generate the same lattice as the input.

2) Find a case where . Notice that the vectors here is the equality case for the bound given in Exercise 4 of the introduction, this actually tells us that the optimal lattice circle packing in 2D is given by this precise lattice! It turns out that this is actually the optimal circle packing in 2D but the proof is significantly more involved. (See for the details)

3*) Let , show that

and show that for all steps in the algorithm except the first and last, hence decreases by at least at each loop and the algorithm runs in polynomial time.

def euclid(m,n):
    while n!=0:
        q = round(m/n)
        m -= q*n
        if abs(n) > abs(m):
            m, n = n, m
    return abs(m)
def lagrange(b1,b2):
    mu = 1
    while mu != 0:
        mu = round((b1*b2) / (b1*b1))
        b2 -= mu*b1
        if b1*b1 > b2*b2:
            b1, b2 = b2, b1
    return b1, b2
ΞΌ\muΞΌ
ΞΌ2,1\mu_{2,1}ΞΌ2,1​
b1=(βˆ’1.8,1.2)b2=(βˆ’3.6,2.3)\begin{matrix} b_1&=&(-1.8,1.2)\\ b_2&=&(-3.6,2.3) \end{matrix}b1​b2​​==​(βˆ’1.8,1.2)(βˆ’3.6,2.3)​
LLL
b1,b2b_1,b_2b1​,b2​
b1β€²,b2β€²,βˆ₯b1β€²βˆ₯≀βˆ₯b2β€²βˆ₯b_1',b_2',\left\lVert b_1'\right\rVert\leq\left\lVert b_2'\right\rVertb1′​,b2′​,βˆ₯b1′​βˆ₯≀βˆ₯b2′​βˆ₯
βˆ₯b1βˆ₯≀βˆ₯b1β€²βˆ₯\left\lVert b_1\right\rVert\leq\left\lVert b_1'\right\rVertβˆ₯b1​βˆ₯≀βˆ₯b1′​βˆ₯
βˆ₯b2βˆ₯≀βˆ₯b2β€²βˆ₯\left\lVert b_2\right\rVert\leq\left\lVert b_2'\right\rVertβˆ₯b2​βˆ₯≀βˆ₯b2′​βˆ₯
b1,b2b_1,b_2b1​,b2​
LLL
βˆ₯b1βˆ₯\left\lVert b_1\right\rVertβˆ₯b1​βˆ₯
LLL
∣⟨b1,b2⟩∣βˆ₯b1βˆ₯2≀12\frac{\left|\langle b_1,b_2\rangle\right|}{\left\lVert b_1\right\rVert^2}\le\frac12βˆ₯b1​βˆ₯2∣⟨b1​,b2β€‹βŸ©βˆ£β€‹β‰€21​
v=mb1+nb2∈Lv=mb_1+nb_2\in Lv=mb1​+nb2β€‹βˆˆL
LLL
βˆ₯b1βˆ₯≀βˆ₯vβˆ₯\left\lVert b_1\right\rVert\leq\left\lVert v\right\rVertβˆ₯b1​βˆ₯≀βˆ₯vβˆ₯
βˆ₯vβˆ₯2=βˆ₯mb1+nb2βˆ₯2=m2βˆ₯b1βˆ₯2+2mn⟨b1,b2⟩+n2βˆ₯b2βˆ₯2β‰₯m2βˆ₯b1βˆ₯2βˆ’βˆ£mn∣βˆ₯b1βˆ₯2+n2βˆ₯b1βˆ₯2=(m2βˆ’βˆ£mn∣+n2)βˆ₯b1βˆ₯2\begin{align*} \left\lVert v\right\rVert^2&=\left\lVert mb_1+nb_2\right\rVert^2\\ &=m^2\left\lVert b_1\right\rVert^2+2mn\langle b_1,b_2\rangle+n^2\left\lVert b_2\right\rVert^2\\ &\geq m^2\left\lVert b_1\right\rVert^2-|mn|\left\lVert b_1\right\rVert^2+n^2\left\lVert b_1\right\rVert^2\\ &=\left(m^2-|mn|+n^2\right)\left\lVert b_1\right\rVert^2\\ \end{align*}βˆ₯vβˆ₯2​=βˆ₯mb1​+nb2​βˆ₯2=m2βˆ₯b1​βˆ₯2+2mn⟨b1​,b2β€‹βŸ©+n2βˆ₯b2​βˆ₯2β‰₯m2βˆ₯b1​βˆ₯2βˆ’βˆ£mn∣βˆ₯b1​βˆ₯2+n2βˆ₯b1​βˆ₯2=(m2βˆ’βˆ£mn∣+n2)βˆ₯b1​βˆ₯2​
m2βˆ’mn+n2=(mβˆ’n2)2+34n2m^2-mn+n^2=\left(m-\frac n2\right)^2+\frac34n^2m2βˆ’mn+n2=(mβˆ’2n​)2+43​n2
000
m=n=0m=n=0m=n=0
βˆ₯vβˆ₯β‰₯βˆ₯b1βˆ₯\left\lVert v\right\rVert\geq\left\lVert b_1\right\rVertβˆ₯vβˆ₯β‰₯βˆ₯b1​βˆ₯
βˆ₯b1βˆ₯\left\lVert b_1\right\rVertβˆ₯b1​βˆ₯
LLL
b1b_1b1​
βˆ’b1-b_1βˆ’b1​
b1β€²,b2β€²b'_1,b'_2b1′​,b2′​
LLL
βˆ₯b1β€²βˆ₯≀βˆ₯b2β€²βˆ₯\left\lVert b_1'\right\rVert\leq\left\lVert b_2'\right\rVertβˆ₯b1′​βˆ₯≀βˆ₯b2′​βˆ₯
βˆ₯b2βˆ₯≀βˆ₯b2β€²βˆ₯\left\lVert b_2\right\rVert\leq\left\lVert b_2'\right\rVertβˆ₯b2​βˆ₯≀βˆ₯b2′​βˆ₯
b2β€²=mb1+nb2b_2'=mb_1+nb_2b2′​=mb1​+nb2​
n=0n=0n=0
b2β€²=Β±b1b_2'=\pm b_1b2′​=Β±b1​
b1β€²,b2β€²b_1',b_2'b1′​,b2′​
βˆ₯b1βˆ₯=βˆ₯b1β€²βˆ₯=βˆ₯b2β€²βˆ₯\left\lVert b_1\right\rVert=\left\lVert b_1'\right\rVert=\left\lVert b_2'\right\rVertβˆ₯b1​βˆ₯=βˆ₯b1′​βˆ₯=βˆ₯b2′​βˆ₯
Β±b1β€²=b2\pm b_1'=b_2Β±b1′​=b2​
Β±b1β€²=b1+b2\pm b_1'=b_1+b_2Β±b1′​=b1​+b2​
βˆ₯b1β€²βˆ₯=βˆ₯b2βˆ₯\left\lVert b'_1\right\rVert=\left\lVert b_2\right\rVertβˆ₯b1′​βˆ₯=βˆ₯b2​βˆ₯
βˆ₯b1β€²βˆ₯2=βˆ₯b1+b2βˆ₯2βˆ₯b1β€²βˆ₯2=βˆ₯b1βˆ₯2+2⟨b1,b2⟩+βˆ₯b2βˆ₯20=2⟨b1,b2⟩+βˆ₯b2βˆ₯2βˆ₯b1βˆ₯2≀βˆ₯b2βˆ₯2\begin{align*} \left\lVert b'_1\right\rVert^2&=\left\lVert b_1+b_2\right\rVert^2\\ \left\lVert b'_1\right\rVert^2&=\left\lVert b_1\right\rVert^2+2\langle b_1,b_2\rangle+\left\lVert b_2\right\rVert^2\\ 0&=2\langle b_1,b_2\rangle+\left\lVert b_2\right\rVert^2\\ \left\lVert b_1\right\rVert^2&\leq\left\lVert b_2\right\rVert^2\\ \end{align*}βˆ₯b1′​βˆ₯2βˆ₯b1′​βˆ₯20βˆ₯b1​βˆ₯2​=βˆ₯b1​+b2​βˆ₯2=βˆ₯b1​βˆ₯2+2⟨b1​,b2β€‹βŸ©+βˆ₯b2​βˆ₯2=2⟨b1​,b2β€‹βŸ©+βˆ₯b2​βˆ₯2≀βˆ₯b2​βˆ₯2​
βˆ₯b1βˆ₯\left\lVert b_1\right\rVertβˆ₯b1​βˆ₯
βˆ₯b1βˆ₯=βˆ₯b2βˆ₯\left\lVert b_1\right\rVert=\left\lVert b_2\right\rVertβˆ₯b1​βˆ₯=βˆ₯b2​βˆ₯
m,n≠0m,n\neq0m,n=0
m2βˆ’mn+n2β‰₯1m^2-mn+n^2\geq1m2βˆ’mn+n2β‰₯1
βˆ₯b2β€²βˆ₯2=m2βˆ₯b1βˆ₯2+2mn⟨b1,b2⟩+n2βˆ₯b2βˆ₯2β‰₯m2βˆ₯b1βˆ₯2βˆ’βˆ£mn∣βˆ₯b1βˆ₯2+n2βˆ₯b2βˆ₯2=n2(βˆ₯b2βˆ₯2βˆ’βˆ₯b1βˆ₯2)+(m2βˆ’βˆ£mn∣+n2)βˆ₯b1βˆ₯2β‰₯(n2βˆ’1)(βˆ₯b2βˆ₯2βˆ’βˆ₯b1βˆ₯2)+βˆ₯b2βˆ₯2β‰₯βˆ₯b2βˆ₯2\begin{align*} \left\lVert b'_2\right\rVert^2&=m^2\left\lVert b_1\right\rVert^2+2mn\langle b_1,b_2\rangle+n^2\left\lVert b_2\right\rVert^2\\ &\geq m^2\left\lVert b_1\right\rVert^2-|mn|\left\lVert b_1\right\rVert^2+n^2\left\lVert b_2\right\rVert^2\\ &=n^2\left(\left\lVert b_2\right\rVert^2-\left\lVert b_1\right\rVert^2\right)+\left(m^2-|mn|+n^2\right)\left\lVert b_1\right\rVert^2\\ &\geq\left(n^2-1\right)\left(\left\lVert b_2\right\rVert^2-\left\lVert b_1\right\rVert^2\right)+\left\lVert b_2\right\rVert^2\\ &\geq\left\lVert b_2\right\rVert^2 \end{align*}βˆ₯b2′​βˆ₯2​=m2βˆ₯b1​βˆ₯2+2mn⟨b1​,b2β€‹βŸ©+n2βˆ₯b2​βˆ₯2β‰₯m2βˆ₯b1​βˆ₯2βˆ’βˆ£mn∣βˆ₯b1​βˆ₯2+n2βˆ₯b2​βˆ₯2=n2(βˆ₯b2​βˆ₯2βˆ’βˆ₯b1​βˆ₯2)+(m2βˆ’βˆ£mn∣+n2)βˆ₯b1​βˆ₯2β‰₯(n2βˆ’1)(βˆ₯b2​βˆ₯2βˆ’βˆ₯b1​βˆ₯2)+βˆ₯b2​βˆ₯2β‰₯βˆ₯b2​βˆ₯2​
βˆ₯b1βˆ₯=βˆ₯b2βˆ₯=βˆ₯b1+b2βˆ₯\left\lVert b_1\right\rVert=\left\lVert b_2\right\rVert=\left\lVert b_1+b_2\right\rVertβˆ₯b1​βˆ₯=βˆ₯b2​βˆ₯=βˆ₯b1​+b2​βˆ₯
ΞΌ2,1=⌊μ2,1βŒ‰+Ξ΅=ΞΌ+Ο΅\mu_{2,1}=\lfloor\mu_{2,1}\rceil+\varepsilon=\mu+\epsilonΞΌ2,1​=⌊μ2,1β€‹βŒ‰+Ξ΅=ΞΌ+Ο΅
βˆ₯b2βˆ₯2β‰₯((βˆ£ΞΌβˆ£βˆ’12)2βˆ’Ξ΅2)βˆ₯b1βˆ₯2+βˆ₯b2βˆ’ΞΌb1βˆ₯\left\lVert b_2\right\rVert^2\geq\left(\left(|\mu|-\frac12\right)^2-\varepsilon^2\right)\left\lVert b_1\right\rVert^2+\left\lVert b_2-\mu b_1\right\rVertβˆ₯b2​βˆ₯2β‰₯((βˆ£ΞΌβˆ£βˆ’21​)2βˆ’Ξ΅2)βˆ₯b1​βˆ₯2+βˆ₯b2β€‹βˆ’ΞΌb1​βˆ₯
∣μ∣β‰₯2|\mu|\geq2∣μ∣β‰₯2
βˆ₯b1βˆ₯βˆ₯b2βˆ₯\left\lVert b_1\right\rVert\left\lVert b_2\right\rVertβˆ₯b1​βˆ₯βˆ₯b2​βˆ₯
3\sqrt33​
https://arxiv.org/abs/1009.4322arrow-up-right