Lagrangeda
Lagrangeda
SQUARES
AMIR TALEBI
1. Introduction
In this paper our main goal will be proving that every positive integer can be
represented as sum of four squares; known as the Lagranges theorem. We will
present the classic proof of this well known theorem; rst given by Lagrange himself
before 1770. Moreover we will state Jacobis theorem and sketch a proof of this
theorem which shows that r
4
(n) is always positive, and thus always exists.
As it appears, Diophantus was aware of Lagranges theorem and his commenta-
tors had veried it upto 325 but seemed to have no proof of it. Fermat claimed that
he had a proof to Lagranges theorem; and also remarked that Diophantus seemed
to have known it. Fermat, in a letter to Carcavi, indicated that he had a proof to
Lagranges theorem based on his well known method of descent. Euler, in a letter
of 1730 to Goldbach, had mentioned that he could not prove this theorem, the real
diculty being that he was not able to show numbers in the form a
2
+ 7 can be
written as sums of squares (Although its fair to note that soon after Lagranges
proof, Euler published two proofs of his own, simpler than Lagranges).
2. Background
For positive integers i and j, r
i
(j) represents the number of ways j can be
expressed as the sum of exactly i squares of integers, counting all permutation and
changes of sign as dierent representations. Let r
i
(0) = 1. For example we have
r
2
(5) = 8, because:
5 = (1)
2
+ (2)
2
= (2)
2
+ (1)
2
,
and the two signs are independent, which results in a total of 8 representations.
In this paper we will also prove the Jacobis theorem, which states:
r
4
(n) =
_
8(n) if n is odd,
24(m) if n is even and m is its largest odd divisor.
Here (n) =
d
n
d is the sum of all positive divisors of n. Since (n) > 0
for every positive integer n, we can conclude from Jacobis theorem that r
4
(n) is
always positive, that is, every positive integer is the sum of four squares of integers.
A brief sketch for the proof of this important theorem can be found in last section
of this paper.
3. Integer Representations via Sum of Four Squares
Theorem 3.1 (Lagranges Theorem). All natural integers are sums of four integral
squares, i.e., for ever n Z, n > 0, the Diophantine equation x
2
1
+x
2
2
+x
2
3
+x
2
4
= n
has solutions with x
i
Z (i = 1, 2, 3, 4).
1
2 AMIR TALEBI
To prove Lagranges theorem we will use the following lemma:
Lemma 3.2 (Euler). If p is an odd prime, then
1 + x
2
+ y
2
= mp
has integral solutions x, y, m, with 0 < m < p.
Proof. We will consider two cases:
Case 1: assume p 1 (mod 4). We know that 1 is a quadratic residue modulo
p, so x
2
+1 0 (mod p) has a solution. We have: mp = x
2
+1 for some integer m
and x such that |x| <
p
2
. We have:
0 < 1 + x
2
< 1 + (
p
2
)
2
mp < 1 +
p
2
4
, whence m <
p
2
Thus taking y = 0 makes the lemma always true.
Case 2: If p 3 (mod 4). Note that the
p+1
2
numbers
0
2
, 1
2
, . . . , (
p 1
2
)
2
are incongruent modulo p. Similarly the
p+1
2
numbers
1 0
2
, 1 1
2
, . . . , 1 (
p 1
2
)
2
are also incongruent modulo p.
Combining these two lists of integers we have p + 1 numbers, by pigeonhole
principle, some element from the rst list must be congruent to some element in
the other, modulo p. Therefore we conclude that there exists an x, y
p1
2
such
that
x
2
1 y
2
(mod p) 1 + x
2
+ y
2
= mp for some integer m.
Moreover we have:
1+x
2
+y
2
1+(
p 1
2
)
2
+(
p 1
2
)
2
=
(p 1)
2
+ 2
2
< p
2
0 < mp < p
2
0 < m < p.
This completes the proof.
Lemma 3.3. If m and n are two integers satisfying theorem 3.1, i.e., representable
as sum of four squares, then their product, mn, is also representable as sum of four
squares.
Proof. Given x =
4
i=1
x
2
i
and y =
4
j=1
y
2
j
, we have:
xy =
_
4
i=1
x
i
y
i
_
2
+ (x
1
y
2
x
2
y
1
+ x
3
y
4
x
4
y
3
)
2
+(x
1
y
3
x
3
y
1
+ x
4
y
2
x
2
y
4
)
2
+ (x
1
y
4
x
4
y
1
+ x
2
y
3
x
3
y
2
)
2
With lemma 3.3 we can reduce proving the Lagranges theorem for only primes.
We will restrict our attention to odd primes since 2 = 1
2
+1
2
+0
2
+0
2
. By lemma 3.2
we already know that for each odd prime, p, there exists some m with 0 < m < p,
such that mp = 0
2
+ 1
2
+ x
2
+ y
2
, and therefore, we can easily conclude that
there exists some multiple of p which can be represented as sum of four squares. It
REPRESENTATION OF INTEGERS AS SUMS OF FOUR SQUARES 3
remains to show that the least multiple of p, say m
0
p, which can be represented as
sum of four squares, is p itself.
Claim 1: m
0
must be odd.
Proof. For the sake of contradiction, assume m
0
is even. This implies
4
i=1
x
2
i
is even
and this implies that one of the following conditions must hold:
i) All x
i
are even
ii) All x
i
are odd
iii) Two of the terms are even and the other two are odd (we may assume x
1
and x
2
are even and x
3
and x
4
are odd).
In all three cases all of the following are even: x
1
+x
2
, x
1
x
2
, x
3
+x
4
, x
3
x
4
.
Hence we have:
1
2
m
0
p =
_
x
1
+ x
2
2
_
2
+
_
x
1
x
2
2
_
2
+
_
x
3
+ x
4
2
_
2
+
_
x
3
x
4
2
_
2
The RHS of the above equation is the sum of four integer squares; so
1
2
m
0
p is
also sum of four integral squares; but this is impossible since by our hypothesis m
0
was chosen to be minimal. So we conclude m
0
must be odd.
Claim 2: x
1
, x
2
, x
3
, x
4
are not all divisible by m
0
Proof. Again we argue by contradiction; if this was the case then we have:
m
2
0
x
2
i
m
2
0
x
2
1
+ x
2
2
+ x
2
3
+ x
2
4
= m
0
p m
0
p;
but this is impossible since m
0
lies strictly between 1 and p.
Let b
i
be the closest integer to
xi
m0
; then x
i
= m
0
b
i
+ y
i
, with |y
i
| Z <
m0
2
(note that not all y
i
can be zero; since that would contradict claim 2 given above).
Hence we have:
0 <
4
i=1
y
2
i
< 4
_
m
0
2
_
2
= m
2
0
.
Since by assumption y
i
x
i
(mod m
0
), it follows
4
i=1
y
2
i
4
i=1
x
2
i
= m
0
p 0 (mod m
0
)
Thus, we conclude that there exists some integer m
1
such that 0 < m
1
< m
0
,
4
i=1
y
2
i
=
m
0
m
1
. We now have the following two equations:
4
i=1
x
2
i
= m
0
p
4
i=1
y
2
i
= m
0
m
1
By lemma 3.3 it follows that:
(m
0
p)(m
0
m
1
) =
4
i=1
z
2
i
(3.1)
4 AMIR TALEBI
for some integers z
i
.
Using lemma 3.3 once again we obtain:
z
1
=
4
i=1
x
i
y
i
=
4
i=1
x
i
(x
i
b
i
m
0
)
4
i=1
x
2
i
m
0
p 0 (mod m
0
)
z
2
= x
1
y
2
x
2
y
1
+x
3
y
4
x
4
y
3
= x
1
(x
2
b
2
m
0
)x
2
(x
1
b
2
m
0
)+x
3
(x
4
b
4
m
0
)x
4
(x
3
b
3
m
0
)
= m
0
(x
2
b
1
x
1
b
2
+ x
3
b
3
x
3
b
4
) 0 (mod m
0
).
Applying the same argument by using lemma 3.3 and replacing y
i
by x
i
b
i
m
0
yields
that z
3
and z
4
are also congruent to 0 modulo m
0
. Hence we have m
0
divides each
z
i
, or equivalently z
i
= m
0
c
i
for some integer c
i
. This implies that equation (3.1)
can be rewritten as following:
m
2
0
m
1
p = m
2
0
(c
2
1
+ c
2
2
+ c
2
3
+ c
2
4
).
which implies m
1
p = c
2
1
+ c
2
2
+ c
2
3
+ c
2
4
. But this is impossible since m
1
< m
0
and
it contradicts the minimality assumption of m
0
. This result implies that m
0
must
be one which shows every prime can be expressed as sum of four squares, which, in
turn by lemma 3.3 implies every postive integer can be represented as sum of four
squares and this nally proves Lagranges theorem.
3.1. A result of Lagranges theorem.
Theorem 3.4. for every n N:
r
4
(2n) = r
4
(8n)
Proof. We can exhibit a 1 1 correspondance between represetations of 2n and
8n. Given 2n =
4
i=1
a
2
i
, then 8n =
4
i=1
(2a
i
)
2
. Conversely if 8n =
4
i=1
(b
i
)
2
implies
4
i=1
(2a
i
)
2
0 (mod 8), thus all b
i
must be even; say b
i
= 2a
i
. Then
8n =
4
i=1
(2a
i
)
2
= 4
4
i=1
(a
i
)
2
and 2n =
4
i=1
(a
i
)
2
,
as desired.
4. Jacobis Theorem
Theorem 4.1 (Jacobi). Let
(n) =
d|n,d0 (mod 4)
d. Then
r
4
(n) = 8
(n)
The proof of this theorem is more advanced than the scope of this paper. The
motivation for the more elegant proof of this theorem can be found in the theory
of elliptic functions.
Its worthwhile to mention that the most elementary proof of this theorem lies
mainly on the following two lemmas (which we will accept without going over the
proofs):
REPRESENTATION OF INTEGERS AS SUMS OF FOUR SQUARES 5
Lemma 4.2. Let u
r
= u
r
(x) =
x
r
1x
r
; then
_
1 + 2
n=1
x
n
2
_
2
=
_
n=
x
n
2
_
2
= 1 +
n=1
r
2
(n)x
n
= 1 + 4
r=1
(1)
r
u
2r+1
Lemma 4.3.
_
1 + 4
r=1
(1)
r
u
2r+1
_
2
= 1 + 8
n0 (mod 4)
nu
n
Accepting the above two lemmas one can obtain:
1 +
n=1
r
4
(n)x
n
=
_
1 + 4
r=1
(1)
r
u
2r+1
_
2
= 1 + 8
r0 (mod 4)
ru
r
= 1 + 8
r0 (mod 4)
rx
r
1 x
r
= 1 + 8
r0 (mod 4)
r
m=1
x
rm
= 1 + 8
n=1
x
n
r|n,r0 (mod 4)
r
= 1 + 8
n=1
(n)x
n
,
where the last equality follows from the denition of