Introduction
We began class by stating that our topic falls under the topic of Diophantine equations.
Definition: A diophantine equation is any equation with one or more variable to be solved in the integers.
We then explained that integers can be written as sums of two squares, three squares, and even four squares. One of the most famous equation is the Pythagorean Theorem, which says
. Before we begin, we will show some examples.
Example: Express 18 as a sum of two squares.

Example: Express 8 as a sum of two squares.

Example: Express 7 as a sum of two squares.
, but 3 cannot be expressed as a perfect square. Therefore, there is no solution.
Sums of Two Squares
Proposition: Let
with
. If
and
are expressible as the sums of two squares of integers, then
is expressible as the sum of two squares of integers.
Proof: Let
be such that
and
. Then


This can be expanded and seen as desired. 
Example: Express 144 as a sum of two squares.

From earlier examples,
and
. Therefore,




Proof: Since
, we know the legrende
. Thus exists
,
such that
. Then
, giving us
, for some
. Thus we know there is a solution to
, by setting
.
Also
, implying
as desired. 
Proposition: If
is a prime number such that
, then
is expressible as the sum of two squares of integers.
Proof: This will be a proof by contradiction. We are going to assume
. By the lemma above, we know there exists an
such that
, when
. We want
, so we are going to assume
. So we can write


Then we can say
.
Also by above lemma, we can say there exists a
such that
. So we can perform a multiplication by one trick:
.
By an earlier proposition, we can distribute and get
. We can substitute from earlier and get the following:


Substituting back we get that
. Since we know
, we know that
. Using equation above,
, so that means
which contradicts the minimality of
. 
Example: Express 23 as a sum of two squares.
Since
, by proposition,
is not expressible as a sum of two squares.
Example: Express 29 as a sum of two squares.
Notice
. Therefore, by proposition,
is expressible as the sum of two squares. With a little calculation, we get that
.
Now we are finally able to express these ideas as a theorem.
Theorem: Let
with
. Then
is expressible as the sums of two squares of integers if and only if every prime factor congruent to
occurs to an even power in the prime factorization of
.
Proof: (=>) Assume
is an odd prime, and that
, occurs in the prime factorization of
. We will show that
. Since
is expressible as the sum of two squares, there exists
such that
.
Let
, thus
. And
.
Let
, be the largest power of
dividing
. Then
since
, we have
. Now
cannot divide
because if
, then
, and
.
By Theorem 2.6, there exists
such that
then



Since
, we know that
And since
cannot divide
as stated above,
making
a quadratic residue modulo
. Therefore any odd prime factor occurring to an odd power in the prime factorization of
must be congruent to 1 modulo 4. The contrapositive therefore insures that any prime factor congruent to 3 modulo 4 must happen to an even power.
(<=) This direction is much simpler, as we may assume every prime factor congruent to 3 modulo 4 occurs to an even power in the prime factorization of
.
can then be written as
with
and
are distinct primes equal to 2 or congruent to 1 modulo 4.
can clearly be written as a sum of two squares
, and by prop 6.7 each
can be written as the sum of two squares. Adding prop 6.5 implies that
is thus expressible as the sum of two squares. 
Example: Is 54 expressible as the sums of two squares?
and therefore the answer is no since 3 is a prime factor congruent to 3 modulo 4 occurring to an odd power.
Example: Is 162 expressible as the sums of two squares?
and therefore the answer is yes, since 3 is the only prime factor congruent to 3 modulo 4 and it occurs to an even power.
Sums of Three Squares
Now that we got a theorem that deals with expressing integers as the sum of two squares, we can move onto the sum of three squares case. The following proposition tells us whether or not an integer expressible as the sum of three squares, NOT how to express it.
Proposition: Let
with
. If
, then
is not expressible as the sum of three squares of integers.
Proof: This will be a proof by contradiction. We will assume
is expressible as the sum of three squares. Assume
.


This implies
. And since
is expressible as a sum of three squares, we have the expression
. But since
, we have a contradiction.
Now assume
. Again by assumption,
. This implies
must be even. Since even, there exists an
such that
.



After applying induction
times, we would be able to see that
is expressible as the sum of three squares, which is a contradiction. Therefore,
is not expressible as the sum of three squares which ends our proof. 
Example: Determine whether 1472 is expressible as the sum of three squares.
To find out, we have to see if
can be written in the form
. Notice that the highest power of
evenly dividing
is
. After dividing by
, we get
. After performing simple algebra, we see that
. Putting everything together, we see that
, which according to the proposition, cannot be expressed as the sum of three squares.
Example: Determine whether 1584 is expressible as the sum of three squares.
Again, we have to see if
can be written in the form
. The highest power of
evenly dividing
is
. This gives us
. After subtracting
, we get
, which cannot be evenly divided by
. Therefore since
cannot be written in the form
,
can be written as the sum of three squares; however, we do not know exactly how to find it.
Sums of Four Squares
So far, we have discussed the sum of two square case and the sum of three square case. The sum of four square case is important because eventually we’ll find out which integers are expressible as the sum of four squares.
Euler’s Proposition: Let
with
. If
and
are expressible as the sums of four squares of integers, then
is expressible as the sum of four integers.
Proof:
Let
and
. Then


After expansion and calculation, you get that
. 
Example: Express 25 as the sum of four squares.
Notice
. But since we want to express it as a sum of four squares, we write
.
Example: Express 4 as the sum of four squares.
There are a couple ways to write it. For purposes for the next example, we’ll write
. Can you find the other way?
Example: Express 100 as the sum of four squares.
Using the proposition above, we can write
.



Euler’s Lemma: If
is an odd prime number, then there exist
such that
where
and
.
Proof: Two cases:
Case I:
.
Then by setting
, we have the same situation as proposition 6.7 of
, and the proof is the same.
Case II: 
Let
be the least positive quadratic nonresidue modulo p. Note
. Then the legrende symbol
. So there exists
, with
such that
. Now take
, which being positive and less than
, must be a quadratic residue modulo p, and so exists
, with
such that
.
Therefore
, which equivalently means that
for some
. Proving the existence of x and y to satisfy the desired equation.
Also
. So
as desired. 
The proof of Euler’s lemma leads us to the case for all primes.
Proposition: All prime numbers are expressible as the sums of four squares of integers.
Proof: Assume
to be an odd prime. Now let
be the least positive integer such that
and
. We need to show that
. This will be another proof by contradiction. Assume
. Now we will deal with cases.
Case I:
is even.
If
is even, then one of the three holds:
is all even (since even plus even is even)
is all odd (since odd plus odd is even)- two is even and two is odd
WLOG, we’ll set
and
. This implies

which is a contradiction to the minimality of
. 
Case II:
is odd
Then
. Let
such that




Then
. And so exists
with
such that
.
Now
.
By prop 6.10 we have that
(29)




Therefore
(34)
Since
we have




Thus we can set
as




And therefore
.
Since
, we know that
.
Making
, which makes
. But
contradicts the minimality of
for which
is solvable. Therefore
, completing the proof. 
Now that we’ve dealt with all cases, the four-square theorem can now be stated and proved.
Lagrange’s Theorem: All positive integers are expressible as the sum of four squares of integers.
Proof: By above proposition, all primes are expressible as the sum of four squares. We also know that the product of two primes is composite. By Euler’s proposition, the product of two primes can be expressed as the sum of four squares, which implies that composite numbers are expressible as the sum of four squares. Therefore, all positive integers are expressible as the sum of four square integers. 
Example: Express 99 as a sum of four squares of integers.
Using the same technique as above, 




Conclusion/Stuff to Think About
Other topics that this topic brings to interest:
Waring’s Problem: Let
with
. Does there exist a minmum integer
such that every positive integer is expressible as the sum of at most
kth powers of nonnegative integers?
Hilbert Theorem proves that a
exists for all positive integers; however, the proof is nonconstructive, and therefore does not give a formula for
.
15 Theorem: If an integral quadratic form with integral matrix represents all positive integers up to 15, then it represents all positive integers.






with
. If
and
are expressible as the sums of two squares of integers, then
is expressible as the sum of two squares of integers.
, then
with
. Then
occurs to an even power in the prime factorization of
with
. If
with
. If
is expressible as the sum of four integers.
such that
.