April 19, 2021 
Math 302 Cryptography
Spring 2021

T. Ratliff, Wheaton College
ratliff_thomas@wheatoncollege.edu

Define the lattice L with basis v1 = { 2, 3 },  v2 = { 1, 5 }

The basic definitions

v1={2,3}
v2={1,5}
w1=3v1-v2
w2=-v1+2v2

Build the matrices A = (({{v1}, {v2}})), B = (({{w1}, {w2}})) and U A = B and verify that we’ve got everything right

Notice the “// MatrixForm” command for prettier printing

A={v1,v2}
B={w1,w2}
U={ {3,-1},{-1,2}}

A// MatrixForm
B//MatrixForm
U// MatrixForm

Let’s verify that U A = B
Matrix multiplication in Mathematica is done with the period

U.A

U.A //MatrixForm

Mathematica can also calculate determinants and matrix inverses

Since det(U) ≠ ± 1, we get that w1, w2 is not a basis for L

Det[U]

Inverse[U] // MatrixForm

Inverse[U].B // MatrixForm

Let’s start with our basis v1, v2 for L and build a skewed basis b

The easiest way to construct a matrix with determinant ±1 is to multiply upper and lower triangular matrices where allow ±1 on the diagonal.

u1={ {1, 3},{0,1}};
u2 = {{1,0},{-7,1}};
u3={{1,-4},{0,1}};
u4={{1,0},{5,1}};
u=u1.u2.u3.u4

u//MatrixForm

Det[u]

b=u.A

b//MatrixForm

Let’s call our new basis b1, b2

b1=b[[1]]
b2=b[[2]]

Let’s compute the Hadamard ratio of our two bases
The closer the ratio is to 1, the more orthogonal the basis is

For our original basis

Sqrt[ Abs[Det[A]]/ (Norm[v1]*Norm[v2])]

N[%]

For our skewed  basis

Notice Det[A] = Det[b] so we can use either for det(L) in the Hadamard ratio.

Sqrt[ Abs[Det[b]]/ (Norm[b1]*Norm[b2])]

N[%]