Associated Topics || Dr. Math Home || Search Dr. Math

### Sums of Three Squares

```
Date: 05/18/98 at 00:52:59
From: steve darcy
Subject: Sum of three squares

Dear Dr Math:

What numbers cannot be expressed as the sum of three squares?

I will need the theory behind the answer. Many thanks.
```

```
Date: 05/18/98 at 15:14:56
From: Doctor Rob
Subject: Re: Sum of three squares

Theory:    Integer squares are congruent to 0, 1, or 4 (mod 8).

Theorem:   Any integer congruent to 7 (mod 8) cannot be represented as
the sum of three squares.

Proof:     Suppose N = 7 (mod 8), and N = x^2 + y^2 + z^2. Then,
reducing modulo 8, you must have 7 as a sum of three
numbers, each from the set {0,1,4}. Since N is odd, an odd
number of the three squares must be odd, and so an odd
number of these three numbers must be 1. If all three are
1, the sum is 3, not 7. If one of them is 1, then the other
two must be even and add to 6, which is 2 mod 4, while the
numbers are 0 mod 4. This is impossible.

Corollary: Any integer N of the form 4^m * (8*k + 7) cannot be written
as the sum of three squares.

Proof:     If m > 1, and N = x^2 + y^2 + z^2 = 0 (mod 4), then each of
x, y, and z must be even. Then:

N/4 = (x/2)^2 + (y/2)^2 + (z/2)^2

is also representable as the sum of three squares.
N/4 = 4^(m-1)*(8*k+7) is thus representable as the sum of
three squares. Continue the reduction of the exponent of 4
until it is zero, and then you will have concluded that
8*k + 7 is representable, which is false by the theorem.

The proof that these are the only integers not so representable was
given by Legendre, in _Essai sur la theorie des nombres_ (1798), pp.
202, 398-9, and Gauss, _Disquistiones Arithmeticae_ (1801), Section
291. It depends on the theory of ternary quadratic forms. I do not
know the details, but it is very complicated. There is an alternative
proof that is more elementary, longer, and also very complicated,
which is due to Liouville and Uspensky. This appears in Uspensky and
Heaslet, _Elementary Number Theory_ (1939), pp. 465-474.

-Doctor Rob,  The Math Forum
Check out our web site! http://mathforum.org/dr.math/
```
Associated Topics:
High School Number Theory

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search