1.2 Lattice Basis: Vectors & Matrices
How you describe a lattice — and why the same lattice can look easy or impossibly hard depending on how you describe it.
What Is a Lattice Basis?
A lattice basis is a linearly independent set of vectors whose integer combinations generate every point in a lattice. The basis is not unique: infinitely many different bases can describe exactly the same lattice. A short, nearly orthogonal basis is called good because it makes geometric problems easier to solve.
A lattice is built from a set of directions called basis vectors. Think of them like the axes on a map: once you have your directions, every location on the map can be described by how many steps you take along each axis. Change the axes, and the same locations now have different coordinates — but the terrain itself hasn’t changed.
This is the key idea of this section: the same lattice can be described by many different sets of basis vectors. Some descriptions make the lattice easy to work with. Others make it look completely intractable. That gap is the foundation of lattice cryptography.
Intuition
Imagine giving someone walking directions that reach every intersection in Manhattan. The simplest way is two basic steps: “walk 1 block north” and “walk 1 block east”. These basic steps are your basis vectors.
You could instead give two very different steps: “walk 100 blocks north and 99 east” and “walk 101 blocks north and 100 east”. By combining these forwards and backwards you still reach exactly the same intersections, because 100·100 − 99·101 = 1. Not every pair of big steps works: with “99 north and 100 east” as the second step the determinant would be 199, and most intersections would be missed.
In lattice language, the simple steps are a good basis and the long ones a bad basis. The grid of intersections, the lattice, never changes; only its description does.
The Basis Matrix
Rather than listing basis vectors one at a time, we stack them as columns of a single matrix. This matrix compactly encodes the entire shape of the lattice. Any lattice point is obtained by multiplying by a column vector of integers.
Definition 2 — Basis Matrix
Write the basis vectors as the columns of a matrix . Then the lattice is:
In plain English: take any column of integers , multiply it by , and you get a lattice point. When the number of basis vectors equals the ambient dimension (a square matrix), we call the lattice full-rank.
Many Bases, One Lattice
Here is something surprising: a lattice has infinitely many valid bases. Consider a 2D lattice built from two vectors. You can swap one basis vector for the sum of both and get a completely different-looking pair of arrows — yet they generate exactly the same infinite grid of points.
The transformations that turn one valid basis into another are called unimodular matrices. They are integer matrices whose determinant is exactly +1 or −1. Multiplying a basis by a unimodular matrix reshuffles the basis vectors without adding or removing any lattice points.
Definition 3 — Equivalent Bases
Two bases and generate the same lattice if and only if for some integer matrix with . Such matrices are called unimodular.
Intuition: tells you how to mix the old basis vectors (with integer coefficients, no fractions) to get the new ones. The lattice points don’t move — only the labels change.
Good Bases and Bad Bases
Not all bases are equally useful. A good basis has short, nearly perpendicular vectors. Given such a basis, you can quickly find nearby lattice points, estimate the shortest vector, and solve geometric problems efficiently. A bad basis has long, nearly parallel vectors that are highly skewed. The lattice is identical — but working with a bad basis feels like navigating with a wildly distorted map.
Some lattice trapdoor schemes use this asymmetry: a secret, well-behaved basis makes decoding practical, while the public description does not reveal that useful basis. This is one way to build lattice cryptography. ML-KEM and ML-DSA instead use noisy modular equations and short secrets; their public keys are not simply bad bases of a secret lattice.
Gram–Schmidt Orthogonalization
To measure how “skewed” a basis is, we use a classical tool from linear algebra called Gram–Schmidt orthogonalization. The idea: given your basis vectors, iteratively subtract off their projections onto each other to produce a new set of perpendicular vectors. These perpendicular vectors are not a lattice basis (they’re generally not integer combinations of the originals), but they reveal the underlying geometry of the basis.
Definition 4 — Gram–Schmidt Vectors
Start with . For each subsequent vector, subtract its projection onto all previous orthogonal vectors:
The resulting vectors are mutually perpendicular. Their lengths measure how much each basis vector contributes in a “fresh” direction not already covered by previous vectors. Short Gram–Schmidt vectors mean a skewed basis; long ones mean a well-spread basis.
An important fact: the product of all Gram–Schmidt lengths always equals , the volume of the fundamental cell of the lattice. So the total volume is fixed — what changes between bases is how evenly that volume is distributed across the Gram–Schmidt vectors.
The LLL Algorithm: Taming a Bad Basis
If you are given a bad basis, can you find a better one? Yes — the LLL algorithm (named after Lenstra, Lenstra, and Lovász, 1982) does exactly this in polynomial time. It won’t find the best possible basis (that problem is as hard as SVP), but it finds one that is provably pretty good — short enough to be useful, efficient enough to run on large inputs.
What LLL guarantees
After running LLL, the first basis vector satisfies (for the standard parameter ), where is the true shortest vector length. In dimension 100, this worst-case bound allows an output about × longer than the true shortest vector. In practice LLL does far better, typically finding a vector only about × longer than — good enough for many applications, not good enough to break well-designed lattice cryptography.
BKZ: stronger reduction
Block Korkine-Zolotarev (BKZ) is a family of algorithms that improve on LLL by solving SVP inside overlapping blocks of the basis. Larger block size gives shorter output vectors but runs exponentially slower in . BKZ with a large block size is the main tool in lattice cryptanalysis — used to estimate how hard a lattice problem actually is.
The trapdoor construction
In GPV signatures and similar schemes, the signer holds a short basis (the trapdoor). The public key is a related long basis . Signing uses to solve CVP efficiently; verification only needs the public . Without , solving CVP under is believed computationally infeasible.
The Dual Lattice
Every lattice has a companion called its dual lattice. The dual contains all vectors that have integer inner products with every vector in the original lattice. If the original lattice is “big” (coarsely spaced), the dual is “small” (finely spaced), and vice versa. The dual lattice appears in the security proofs of LWE and in the analysis of Gaussian distributions over lattices, which we will encounter in §2.2.
Definition 5 — Dual Lattice
If is a basis for , then is a basis for . The determinant of the dual is — confirming that a denser lattice has a sparser dual, and vice versa.
For a complete calculation of the inverse-transpose basis and a two-dimensional example, see the dual lattice guide.
The Gram Matrix
Given a basis matrix , the Gram matrix is the symmetric positive definite matrix . Its entries are all pairwise inner products of the basis vectors: the diagonal entry is the squared length of the -th basis vector, and the off-diagonal entry measures how much vectors and point in the same direction.
The Gram matrix encodes the complete metric geometry of the basis — all lengths and angles — in a single object. If for all , the basis is perfectly orthogonal. The determinant of the Gram matrix gives the squared volume of the fundamental parallelepiped:
Gram Matrix — Key Formula
For a basis matrix with columns :
The angle between basis vectors satisfies . A basis is orthogonal if and only if is diagonal. Two bases and generate the same lattice if and only if their Gram matrices are related by for a unimodular integer matrix .
Volume of a Lattice
The volume (or determinant) of a lattice is one of its most fundamental invariants. It measures the “density” of lattice points: a small volume means points are close together; a large volume means they are sparsely distributed. Crucially, the volume does not depend on which basis you choose — it is an intrinsic property of the lattice itself.
Lattice Volume — Definition and Properties
For any basis matrix of :
This equals the volume of the fundamental parallelepiped spanned by the basis vectors. It is invariant under basis change: if with , then .
For the integer lattice : .
For a scaled lattice : .
For the dual: .
The product of Gram–Schmidt norms also equals the volume: , which is how the volume is efficiently computed in practice.
Change of Basis and Unimodular Matrices
Since a lattice has infinitely many valid bases, it is important to characterize precisely when two matrices and generate the same lattice. The answer is short: they are related by a unimodular matrix — an integer matrix with determinant .
Unimodular Matrices and Basis Equivalence
An integer matrix is unimodular if . Equivalently, is invertible over the integers — its inverse also has integer entries.
The set of all unimodular matrices forms a group under multiplication, denoted . The elementary row and column operations over integers — adding an integer multiple of one row to another, or swapping two rows — all produce unimodular matrices.
In cryptography, a trapdoor consists of a short basis and a unimodular matrix such that is a bad (long, skewed) public basis. Anyone who sees only cannot recover without solving the lattice reduction problem.
Check Your Understanding
Q1. You replace basis vector b₂ with b₁ + b₂ and keep b₁. What happens to the lattice?
Q2. In a basis-based trapdoor scheme, why keep a “good” basis private?
Q3. Which quantity is the same no matter which basis you use to describe a lattice?
Q4. A lattice is spread out, with points far apart (large volume). What does its dual lattice look like?