Some identities do much more than simplify algebra. They let us construct new solutions to number-theory problems from solutions we already know. Euler’s four-square identity is a particularly beautiful example: multiply two numbers that are each sums of four integer squares, and the product is again a sum of four integer squares. Better still, the identity tells us exactly how to find the four new integers.
Start with two sums of four squares
Suppose we know that
A=a^2+b^2+c^2+d^2,\qquad B=e^2+f^2+g^2+h^2,where all eight letters represent integers. Can we express AB as a sum of just four squares, rather than the sixteen squares that appear when we expand the product?
Euler’s four-square identity gives the answer:
\begin{aligned}(a^2+b^2+c^2+d^2)(e^2+f^2+g^2+h^2)={}&(ae-bf-cg-dh)^2\\&+(af+be+ch-dg)^2\\&+(ag-bh+ce+df)^2\\&+(ah+bg-cf+de)^2.\end{aligned}Every expression inside a square on the right is an integer. Thus the identity provides an explicit recipe for representing the product as four integer squares. Some of those integers may be zero, which is allowed.
Example: Multiply 5 and 13
Begin with the representations
5=1^2+2^2+0^2+0^2,\qquad 13=2^2+3^2+0^2+0^2.Use (a,b,c,d)=(1,2,0,0) and (e,f,g,h)=(2,3,0,0). The four new numbers are
\begin{aligned}ae-bf-cg-dh&=2-6=-4,\\af+be+ch-dg&=3+4=7,\\ag-bh+ce+df&=0,\\ah+bg-cf+de&=0.\end{aligned}Therefore
\boxed{65=4^2+7^2+0^2+0^2.}This first example uses only two nonzero squares. The next one shows all four at work.
Example: Generate four nonzero squares
Consider
30=1^2+2^2+3^2+4^2,\qquad 15=1^2+1^2+2^2+3^2.Euler’s formula produces
\begin{aligned}x_1&=1-2-6-12=-19,\\x_2&=1+2+9-8=4,\\x_3&=2-6+3+4=3,\\x_4&=3+4-3+4=8.\end{aligned}Hence
\boxed{450=19^2+4^2+3^2+8^2}Check: 361+16+9+64=450.
Why does the identity work?
At first sight, the formula looks like a clever guess. Its secret is that the cross terms cancel. If we expand the four squares on the right, the terms involving products such as abef occur with opposite signs and disappear. The remaining terms are precisely the sixteen products a^2e^2,a^2f^2,\ldots,d^2h^2 from the left side.
There is also a compact way to check the calculation. Define the matrix
M=\begin{pmatrix}a&-b&-c&-d\\b&a&-d&c\\c&d&a&-b\\d&-c&b&a\end{pmatrix}.Its columns are perpendicular to one another, and every column has squared length A=a^2+b^2+c^2+d^2. Consequently,
M^{\mathsf T}M=A I_4.For v=(e,f,g,h)^{\mathsf T}, the four entries of Mv are exactly the four expressions in Euler’s identity (with the displayed sign convention). Therefore
\|Mv\|^2=v^{\mathsf T}M^{\mathsf T}Mv=A\,v^{\mathsf T}v=AB.This proves the identity without expanding sixteen terms individually.
Keep multiplying: a construction method
Once we have a four-square representation of a positive integer N, we can multiply it by another number with a known four-square representation and immediately obtain one for the product. We can repeat this as many times as we like.
For instance, begin with
3=1^2+1^2+1^2+0^2.Applying Euler’s identity to two copies of this representation gives
9=(-1)^2+2^2+2^2+0^2.Multiply that representation by the original representation of 3 once more. The identity gives
27=(-5)^2+1^2+1^2+0^2.So the identity is not merely an existence statement: it is an algorithm for producing representations of powers and products.
A useful arithmetic consequence
Let S be the set of positive integers that can be expressed as sums of four integer squares. Euler’s identity proves that
A,B\in S\quad\Longrightarrow\quad AB\in S.In other words, S is closed under multiplication. The same argument shows that multiplying any finite collection of numbers in S gives another number in S.
Does this prove that every nonnegative integer is a sum of four squares? Not by itself. That stronger statement is Lagrange’s four-square theorem. Euler’s identity supplies an important multiplicative tool, but a proof of Lagrange’s theorem needs additional reasoning to establish representations for all integers.
Try it yourself
The following exercises move from direct calculation to a small proof. Open each solution after making your own attempt.
Exercise 1
Use Euler’s identity to find a four-square representation of 10\cdot17, starting with 10=1^2+3^2 and 17=1^2+4^2.
Show solution
Use (1,3,0,0) and (1,4,0,0). The result is (-11,7,0,0), so 170=11^2+7^2.
Exercise 2
Use 2=1^2+1^2 twice to produce a representation of 4.
Show solution
Euler’s formula gives (0,2,0,0), hence 4=0^2+2^2+0^2+0^2.
Exercise 3
Apply the identity to 6=1^2+1^2+2^2+0^2 and 7=1^2+1^2+1^2+2^2.
Show solution
The four coordinates are (-2,6,1,1). Therefore 42=(-2)^2+(6)^2+(1)^2+(1)^2=4+36+1+1.
Exercise 4
Explain why the product of any three positive integers, each representable as a sum of four squares, is also a sum of four squares.
Show solution
Apply Euler’s identity to the first two integers, obtaining a four-square representation of their product. Then apply the identity again to this product and the third integer.
Exercise 5 — Challenge
Show that Euler’s identity remains valid if any of the eight input integers are negative. Why does the resulting four-square representation still use integers?
Show solution
The identity is a polynomial identity, so it holds for all real values of the variables, including negative integers. Each new coordinate is a sum or difference of products of integers, hence is an integer.
Further reading
For a broader view of why sums-of-squares identities appear in special dimensions, see our related article Why Are 1, 2, 4, and 8 Special?
Historical and mathematical background: Olga Taussky, “Sums of Squares,” The American Mathematical Monthly 77 (1970), 805–830.
Takeaway: Euler’s identity turns a pair of four-square representations into a new one using only addition, subtraction, and multiplication. It is a remarkable bridge between algebraic identities and constructive number theory.

Leave a Reply