Chapter 3Lattices and Learning With Errors

Exercises

August 25, 20265 min readbeginner

Answers follow each question. Try them before reading on, since the whole point of small parameters is that these are checkable by hand.

Answers follow each question. Try them before reading on, since the whole point of small parameters is that these are checkable by hand.

1. A second basis of Z2\mathbb{Z}^2

Let BB be the identity matrix and

B′=(1123).B' = \begin{pmatrix} 1 & 1 \\ 2 & 3 \end{pmatrix}.

Verify that B′B' generates the same lattice Z2\mathbb{Z}^2 by finding a unimodular UU with B′=BUB' = BU.

Answer. Since BB is the identity, U=B′U = B' itself. Its determinant is

det⁡U=1⋅3−1⋅2=1,\det U = 1 \cdot 3 - 1 \cdot 2 = 1 ,

which is ±1\pm 1, so UU is unimodular and L(B′)=L(B)=Z2\mathcal{L}(B') = \mathcal{L}(B) = \mathbb{Z}^2 by the rule in Good and Bad Bases.

Sanity-check it the other way. The columns (1,2)(1,2) and (1,3)(1,3) are both in Z2\mathbb{Z}^2, so L(B′)⊆Z2\mathcal{L}(B') \subseteq \mathbb{Z}^2. And (1,0)=3(1,2)−2(1,3)(1,0) = 3(1,2) - 2(1,3) while (0,1)=(1,3)−(1,2)(0,1) = (1,3) - (1,2), both integer combinations, so Z2⊆L(B′)\mathbb{Z}^2 \subseteq \mathcal{L}(B').

02.2. The shortest vectors of the running lattice

For b1=(3,1)b_1 = (3,1) and b2=(1,2)b_2 = (1,2), list the lattice points closest to the origin by norm. Confirm the shortest length and count how many points achieve it.

Answer. Ordered by Euclidean norm, the closest non-zero points are

(−2,1),  (−1,−2),  (1,2),  (2,−1)at 5≈2.236,(-2, 1),\; (-1,-2),\; (1,2),\; (2,-1) \quad \text{at } \sqrt{5} \approx 2.236,

then

(−3,−1),  (−1,3),  (1,−3),  (3,1)at 10≈3.162,(-3,-1),\; (-1,3),\; (1,-3),\; (3,1) \quad \text{at } \sqrt{10} \approx 3.162,

then (−4,2)(-4,2) and (−2,−4)(-2,-4) at 20≈4.472\sqrt{20} \approx 4.472.

So λ1=5\lambda_1 = \sqrt{5}, achieved by exactly four points. They are two vectors and their negations: ±(1,2)\pm(1,2) and ±(2,−1)\pm(2,-1).

Four rather than two because (1,2)(1,2) and (2,−1)(2,-1) are genuinely different lattice vectors that happen to share a length. That is a coincidence of this lattice, not a general rule.

03.3. A determinant-1 lattice with a long shortest vector

Construct L⊂R2\mathcal{L} \subset \mathbb{R}^2 with det⁡L=1\det \mathcal{L} = 1 whose shortest vector is longer than 11. How close can you get to Minkowski's bound of 2\sqrt{2}?

Answer. The best packing in the plane is the hexagonal lattice. Take

b1=( 31/4,  0 ),b2=(12⋅31/4,  32⋅31/4).b_1 = \left(\,3^{1/4},\; 0\,\right), \qquad b_2 = \left(\tfrac{1}{2} \cdot 3^{1/4},\; \tfrac{\sqrt{3}}{2} \cdot 3^{1/4}\right).

Both have length 31/4≈1.3163^{1/4} \approx 1.316, the angle between them is 60∘60^\circ, and the determinant is 31/4⋅32⋅31/4=323=323^{1/4} \cdot \frac{\sqrt{3}}{2} \cdot 3^{1/4} = \frac{\sqrt{3}}{2}\sqrt{3} = \frac{3}{2}. Rescale by 2/3\sqrt{2/3} to bring the determinant to 11, and the shortest vector becomes

31/42/3  =  (43)1/4  ≈  1.0746.3^{1/4}\sqrt{2/3} \;=\; \left(\tfrac{4}{3}\right)^{1/4} \;\approx\; 1.0746 .

Minkowski's bound at n=2n = 2, det⁡=1\det = 1 is 2≈1.414\sqrt{2} \approx 1.414, so the hexagonal lattice reaches about 76%76\% of it. That gap is not slack in your construction. The hexagonal lattice is provably optimal in two dimensions, so (4/3)1/4(4/3)^{1/4} is the true maximum and Minkowski's bound is simply not tight.

04.4. Why noise is not optional

Take the worked LWE instance with s=(5,11,2)s = (5, 11, 2) but set every error to zero. Recover ss.

Answer. With no noise the samples are exact, so b=(4,7,0)b = (4, 7, 0) and

A=(1432076912).A = \begin{pmatrix} 1 & 4 & 3 \\ 2 & 0 & 7 \\ 6 & 9 & 12 \end{pmatrix}.

The determinant of AA modulo 1717 is 1212, which is non-zero, so AA is invertible and

s=A−1b mod 17=(5,11,2).s = A^{-1} b \bmod 17 = (5, 11, 2).

Exact, in one step.

Compare with Noise Breaks Linear Algebra, where the same inversion on the noisy b′=(5,7,16)b' = (5, 7, 16) returned (13,14,7)(13, 14, 7). Three errors of magnitude at most one turned a one-step solve into an unrelated answer.

05.5. The variance of the centred binomial

Show that X∼CBDηX \sim \text{CBD}_\eta has variance η/2\eta/2.

Answer. Write X=∑i=1η(ai−bi)X = \sum_{i=1}^{\eta}(a_i - b_i) with all bits independent and uniform.

Each term ai−bia_i - b_i takes the value −1-1 with probability 1/41/4, 00 with probability 1/21/2, and +1+1 with probability 1/41/4. Its mean is zero by symmetry, and its variance is

E[(ai−bi)2]  =  14(1)+12(0)+14(1)  =  12.\mathbb{E}[(a_i - b_i)^2] \;=\; \tfrac{1}{4}(1) + \tfrac{1}{2}(0) + \tfrac{1}{4}(1) \;=\; \tfrac{1}{2}.

The η\eta terms are independent, and variances of independent variables add, so

Var⁡(X)  =  η⋅12  =  η2.\operatorname{Var}(X) \;=\; \eta \cdot \tfrac{1}{2} \;=\; \tfrac{\eta}{2}.

Checking directly: η=2\eta = 2 gives variance 1.01.0, and η=3\eta = 3 gives 1.51.5. Both match.

6. Why a larger qq makes LWE easier

Argue why raising qq while holding the error distribution fixed weakens LWE. What is the role of σ/q\sigma/q?

Answer. What matters is not the absolute size of the noise but its size relative to the modulus, the ratio σ/q\sigma/q.

The noise hides the secret by making each equation ambiguous. If σ\sigma stays fixed while qq grows, each error covers a smaller fraction of Zq\mathbb{Z}_q, so each sample pins the secret down more tightly. In the extreme, qq enormous against σ\sigma means the noise barely perturbs anything and the system is nearly exact, which is solvable.

Geometrically, from The Learning With Errors Problem: the observed bb sits at distance ∥e∥\|e\| from a lattice point, and the lattice spacing scales with qq. Larger qq with fixed σ\sigma means the target sits proportionally closer to its lattice point, and bounded-distance decoding gets easier as that ratio shrinks.

This is why ML-KEM's small q=3329q = 3329 is a security-conscious choice rather than only an efficiency one. It keeps σ/q\sigma/q comfortably large while also keeping coefficients at 12 bits.

7. The lattice D3D_3

Let D3={(x1,x2,x3)∈Z3:x1+x2+x3 even}D_3 = \{(x_1,x_2,x_3) \in \mathbb{Z}^3 : x_1 + x_2 + x_3 \text{ even}\}. Exhibit a basis and compute the determinant.

Answer. A basis is

(1,−1,0),(1,1,0),(0,1,−1).(1,-1,0), \qquad (1,1,0), \qquad (0,1,-1).

Each has an even coordinate sum, so each is in D3D_3, and integer combinations preserve that parity, so the lattice they generate is inside D3D_3.

The determinant of the matrix with those rows is 22.

That value is the sanity check on completeness. D3D_3 is exactly half of Z3\mathbb{Z}^3, keeping one parity class out of two, and Z3\mathbb{Z}^3 has determinant 11. A sublattice of index 22 has determinant 22, which is what came out, so the three vectors generate all of D3D_3 and not a smaller piece of it.

FeedbackBook mode
post-quantum-cryptographycryptographymathematics