← Back to section · Foundations of Cryptography
Linear Algebra: Why Lattices Speak in Vectors and Matrices
Every object in lattice-based cryptography — lattices, bases, closest vectors — is stated in linear algebra. From the mathematical side, this article explains vector spaces and basis changes, determinants as volume, «good» and «bad» lattice bases, dual lattices and orthogonalisation intuition, and why changing the basis of the same lattice changes the difficulty completely.
The workhorse of post-quantum cryptography — lattice-based cryptography — speaks linear algebra from start to finish: vectors, matrices, bases, determinants. This site’s PQC section explains how lattice schemes work from the algorithmic side; this article steps back and stays purely on the mathematical side, clarifying the language itself: what a lattice is, why the same lattice can have good and bad bases, and why the seemingly mundane operation of “changing the basis” can serve as a cryptographic trapdoor. The abstract concepts of a linear algebra course each find a job here.
Vectors, bases and basis changes
Start with the familiar: in the n-dimensional real vector space R^n, vectors can be added coordinate-wise and scaled by real numbers. A set of linearly independent vectors spanning the whole space is a basis; the same vector has different coordinates in different bases, and bases are related by invertible matrices — basis changes. Two points to note. First, the choice of basis is free; the space itself does not depend on it. Second, the lengths and angles of the basis vectors decide how “usable” the coordinates are: a nearly orthogonal basis of comparable lengths gives intuitive coordinates, while a long, skewed basis disguises the same vector beyond recognition. Transplanted to lattices, these two points are the seeds of the entire story.
Lattices: integer coefficients only
The definition of a lattice adds one restriction to vector spaces: take n linearly independent vectors b_1, …, b_n (a lattice basis); the set of all their integer linear combinations {Σ z_i b_i : z_i ∈ Z} is a lattice. The coefficients must be integers — so a lattice is not a continuous space but a discrete array of points spread through R^n, like the integer grid Z^n viewed at a slant. The same lattice has infinitely many bases: any two are related by an integer matrix of determinant ±1 (a unimodular matrix), which preserves integrality and leaves the point set unchanged. The volume of the fundamental parallelepiped is the same for every basis — the absolute value of the basis matrix’s determinant — called the determinant of the lattice; it is a quantity of the lattice itself, independent of the basis. Intuitively, the smaller the determinant, the denser the lattice points.
Good and bad bases: the prototype of a lattice trapdoor
Given a lattice, ask: which lattice point is closest to some target point (the closest vector problem, CVP), or how long is the shortest non-zero lattice vector (the shortest vector problem, SVP)? How hard these problems are depends, remarkably, on which basis you hold. With short, nearly orthogonal basis vectors — a good basis — one can express the target in real coefficients of the basis and round coordinate by coordinate (Babai’s rounding method) to reach a very close lattice point. With only a long, skewed bad basis, the same rounding produces exploding errors, and the lattice points seem hidden in a maze. There is no contradiction: the intrinsic difficulty of the problem is unchanged; what changes is how much the representation helps the solver.
Lattice trapdoors exploit exactly this asymmetry: the public key publishes a bad basis (defining the lattice and the public operations), the private key holds a good basis (solving CVP-type problems efficiently), and the attacker, holding only the bad basis, has no way in. Straightforward early schemes (such as GGH) were broken when information about the good basis leaked; modern lattice schemes use more indirect constructions (LWE, SIS), but the good-basis/bad-basis picture remains the most useful intuitive prototype of a lattice trapdoor.
A small two-dimensional example pins the intuition down. The integer lattice Z² has a perfect good basis: (1, 0) and (0, 1), short and orthogonal. But (1, 0) and (1000, 1) generate the same Z² (determinant 1), and that is a bad basis: one vector is extremely long and points almost in the same direction as the other. Rounding coordinates in the bad basis, moving the target point even slightly can make the rounded result jump to a far-away lattice point — the basis is so “skewed” that small coordinate errors are magnified by the long vector into large positional errors. In high dimensions this magnification worsens dramatically, and rounding in a bad basis is little better than guessing. This small example is a thumbnail of every lattice trapdoor: the lattice is the same lattice; all the difficulty sits in the coordinate system.
Orthogonalisation and duality: two yardsticks
How can “badness” of a basis be measured quantitatively? The tool is Gram–Schmidt orthogonalisation: subtract from each basis vector its projections onto the previous ones, producing a list of mutually orthogonal vectors. The distribution of their lengths characterises basis quality — wildly unequal orthogonalised lengths signal a badly skewed basis. The famous LLL basis reduction algorithm systematically “straightens” a basis under this yardstick: in polynomial time it improves any basis to a nearly usable one, but the improvement has a ceiling — which traces the peculiar terrain of lattice problems, “approximately solvable, exactly hard”, and is the starting point for setting lattice security parameters.
The other tool is the dual lattice: all vectors whose inner products with every lattice vector are integers. Dual and primal are mirror images — the denser the primal, the sparser the dual, and their determinants are reciprocal. Many lattice theorems (such as Banaszczyk’s bounds) are proved by moving to the dual when the primal resists, and sampling and Fourier-style analysis naturally live on the dual side. Think of the dual lattice as the “frequency domain” of the lattice: time and frequency as mutual translations is the old trick for periodic structures, replayed for lattices.
The practical consequence of this terrain deserves emphasis: what cryptography needs is never the bare sentence “exact SVP is hard”, but a quantitative approximation account — LLL and the stronger BKZ reduction approximate the shortest vector within some factor, and the cost of lattice attacks is estimated from that approximation factor together with the dimension. When the dimension is taken high enough, even “approximating within a usable factor” becomes infeasibly expensive, and only then is a scheme safe. That is why lattice parameter tables always list the dimension alongside the reduction block size: together they mark “how far linear algebra can carry the attacker”.
The welding point: from lattices to noisy linear equations
Finally, one welding point connects this language to modern lattice cryptography. A system of linear equations Ax = b is normally solved by Gaussian elimination; but if the equations hold only modulo q and the right-hand side carries a small error e — Ax + e ≡ b (mod q) — elimination fails at once: errors are amplified and diffused by the modular arithmetic. This is the shape of the LWE problem: superficially linear algebra, in substance the closest vector problem on a lattice hidden inside noisy linear equations. Mastering bases, determinants, orthogonalisation and duality amounts to holding the dictionary for all lattice-cryptography literature; what remains is applying that dictionary to concrete schemes — the PQC section’s job.
Tags: Linear AlgebraLatticesVector Spaces