Lagrange’s four-square theorem

The four-square theorem states that every nonnegative integer can be written as a sum of four integer squares:

\displaystyle n=x_1^2+x_2^2+x_3^2+x_4^2.

For instance, 7=2^2+1^2+1^2+1^2, ~ 237=15^2+3^2+2^2+1^2. At first this is surprising. Squares are sparse, and there are genuine congruence obstructions to representing every integer by two or three squares. Yet four squares suffice for every nonnegative integer. The proof combines two ideas that at first look unrelated. Algebra says that a sum of four squares remains a sum of four squares after multiplication. Geometry says that, for every prime p , one can construct a lattice in \mathbb R^4 whose vectors have squared length divisible by p , and whose density forces a nonzero vector of squared length strictly below 2p . A positive multiple of p smaller than 2p can only be p itself.

The guiding principle is therefore simple: first make divisibility automatic by putting integer vectors into the right lattice; then make the vector small by volume. The exact representation p=x^2+y^2+z^2+w^2 is forced by combining those two pieces of information.

The first ingredient is the four-square identity. If A=a^2+b^2+c^2+d^2 and B=e^2+f^2+g^2+h^2 , then their product is again a sum of four squares:

\displaystyle AB=(ae-bf-cg-dh)^2+(af+be+ch-dg)^2 \\+(ag-bh+ce+df)^2+(ah+bg-cf+de)^2.

This identity is most naturally understood through quaternions. Write q=a+bi+cj+dk , where i^2=j^2=k^2=ijk=-1 . Its norm is N(q)=q\overline q=a^2+b^2+c^2+d^2 , and quaternion multiplication satisfies N(qr)=N(q)N(r) . Expanding the coordinates of qr gives the displayed identity. Thus it is not an isolated algebraic trick: it is the multiplicativity of Euclidean squared length in the quaternion algebra.

Every positive integer has a prime factorization n=p_1^{e_1}\cdots p_r^{e_r} . Consequently, once every prime is known to be a sum of four squares, the four-square identity shows that every prime power, and hence every positive integer, is a sum of four squares. The theorem therefore reduces to the claim that every prime is a sum of four squares. The prime 2 is immediate, since 2=1^2+1^2+0^2+0^2 ; we now fix an odd prime p .

Congruence Solution

The exact equation x^2+y^2+z^2+w^2=p is difficult to solve directly. Instead, we first seek the weaker congruence

\displaystyle x^2+y^2+z^2+w^2\equiv0\pmod p.

This alone is easy to arrange. The decisive issue is size. If we can also find a nonzero vector satisfying 0<x^2+y^2+z^2+w^2<2p , then its squared length is a positive multiple of p in an interval containing only one such multiple. It must therefore equal p . Thus the proof has an arithmetic half and a geometric half: build a lattice in which the squared norm is always divisible by p , then use geometry to force a sufficiently short nonzero lattice vector.

We first need integers a,b satisfying \displaystyle a^2+b^2\equiv-1\pmod p.

Let S=\{t^2:t\in\mathbb F_p\} be the set of quadratic residues, including 0 . Since each nonzero square has two square roots, |S|=(p+1)/2 . The translated set -1-S={-1-s:s\in S} has the same size. Together these two subsets have total cardinality p+1 , greater than the size of \mathbb F_p , so they overlap. Hence there are a^2,b^2\in S with a^2=-1-b^2 modulo p , which gives the desired relation.

This little pigeonhole argument gives a two-by-two matrix which reverses squared length modulo p :

\displaystyle M=\begin{pmatrix}a&b\\ b&-a\end{pmatrix},\quad M^{\mathsf T}M=(a^2+b^2)I\equiv-I\pmod p.

Equivalently, M^2\equiv-I\pmod p .

Lattice

Use the chosen a,b to define a sublattice \Lambda\subset\mathbb Z^4 by

\displaystyle \Lambda:= \{(x,y,z,w)\in\mathbb Z^4 \mid x\equiv az+bw\pmod p, y\equiv bz-aw\pmod p \}.

The choice is designed so that the first two coordinates contribute the negative of the squared length of the last two coordinates modulo p :

x^2+y^2 \equiv(az+bw)^2+(bz-aw)^2 =(a^2+b^2)(z^2+w^2)\equiv-(z^2+w^2)\pmod p.

Therefore every lattice vector satisfies \displaystyle p\mid x^2+y^2+z^2+w^2. Rather than finding a single modular solution, we have created an entire lattice all of whose points satisfy the desired divisibility condition.

To apply Minkowski’s theorem we need its covolume. A basis of \Lambda is

\displaystyle (p,0,0,0),\quad(0,p,0,0),\quad(a,b,1,0),\quad(b,-a,0,1).

Indeed, the congruences say that any vector in \Lambda can be written as (x,y,z,w)=r(p,0,0,0)+s(0,p,0,0)+z(a,b,1,0)+w(b,-a,0,1) for integers r,s,z,w . The basis matrix is block upper triangular, hence its determinant is p^2 . Thus

\displaystyle \det(\Lambda)=p^2.

Equivalently, the two independent congruences modulo p impose index p^2 inside \mathbb Z^4 .

Minkowski Theorem

We now use a continuous version of the pigeonhole principle. If \Lambda\subset\mathbb R^n is a full-rank lattice with covolume \det(\Lambda) , and if a convex centrally symmetric body K satisfies

\displaystyle {\text{vol}}(K)>2^n\det(\Lambda),

then K contains a nonzero point of \Lambda . This is Minkowski’s convex body theorem. One proof starts from Blichfeldt’s lemma: a measurable set of volume greater than \det(\Lambda) contains two distinct points differing by a lattice vector, because otherwise their reductions modulo \Lambda would fit disjointly inside a fundamental domain. Apply this to \tfrac12K . The volume hypothesis produces distinct u,v\in\tfrac12K with u-v\in\Lambda\setminus{0} . Since K is symmetric and convex, 2u,-2v\in K , and hence

\displaystyle u-v=\frac12(2u)+\frac12(-2v)\in K.

Thus K contains a nonzero lattice point.

Let \displaystyle B_R={(x,y,z,w)\in\mathbb R^4:x^2+y^2+z^2+w^2\le R^2}. Its volume is \displaystyle {\text{vol}}(B_R)=\frac{\pi^2}{2}R^4. Since \det(\Lambda)=p^2 , Minkowski’s theorem applies as soon as \frac{\pi^2}{2}R^4>16p^2 , or equivalently

\displaystyle R^2>\frac{4\sqrt2}{\pi}p.

At the same time, we want R^2<2p , so that any nonzero lattice point in the ball has squared length strictly below 2p . These requirements are compatible because 4\sqrt2/\pi<2 . Choose R with

\displaystyle \frac{4\sqrt2}{\pi}p<R^2<2p.

Minkowski now supplies a nonzero vector (x,y,z,w)\in\Lambda\cap B_R . Its squared length is positive, divisible by p , and bounded by R^2<2p . Thus

\displaystyle x^2+y^2+z^2+w^2=p.

We have proved that every odd prime is a sum of four squares. Together with the case p=2 and the four-square identity, this proves Lagrange’s theorem: Every nonnegative integer is a sum of four integer squares

Conclusion

The sum of four squares is the quadratic form Q(x,y,z,w)=x^2+y^2+z^2+w^2 . For a prime p , the proof first solves the weaker congruence Q\equiv0\pmod p on an entire lattice. It then uses the fact that the lattice has covolume p^2 to force a nonzero point in a ball whose squared radius has size comparable with p . Finally, divisibility and smallness collapse all possibilities:

\displaystyle p\mid Q(v),\quad 0<Q(v)<2p\quad\Longrightarrow\qquad Q(v)=p.

This “congruence plus size” mechanism appears repeatedly in number theory. One constructs an object constrained modulo some integer, then uses geometry, approximation, or an inequality to trap it in an interval so short that only one allowed multiple can occur.

There is also a dimensional reason that four squares fit this proof so well. The lattice has covolume p^2 , because two congruence conditions have been imposed. A four-dimensional ball has volume proportional to R^4 . To overcome a covolume of order p^2 , one needs R^4 of order p^2 , hence R^2 of order p . But the squared radius is exactly the value of the four-square form. Dimension four is therefore quantitatively aligned with the desired equation.

Here is the summary of the argument:

For an odd prime p , choose a,b with a^2+b^2\equiv-1\pmod p , and define

\displaystyle \Lambda={(x,y,z,w)\in\mathbb Z^4:x\equiv az+bw,\ y\equiv bz-aw\pmod p}.

Then p\mid Q(v) for every v\in\Lambda , while \det(\Lambda)=p^2 . A four-ball with \frac{4\sqrt2}{\pi}p<R^2<2p has volume greater than 16p^2 , so Minkowski gives a nonzero lattice vector inside it. Its value of Q is a positive multiple of p smaller than 2p , and therefore equals p . Quaternionic norm multiplicativity then extends prime representations to all positive integers.

Leave a comment