Sums of Three and Four Squares

How many squares does it take to express every whole number as the ? We saw that two was not enough in Sums of Two Squares. Perhaps three? Or four?

Well, three is not enough, but almost. The only whole numbers which cannot be written as the sum of 3 squares are numbers of the form 4m(8k+7). So you will have problems writing 7, 15, or 28 as the sum of three squares.

But every whole number can be written as the sum of four squares!

Accordingly, 7=22+12+12+12, and 15=32+22+12+12.

Presentation Suggestions:
Have the class pick their favorite number and write it as the sum of four squares.

The Math Behind the Fact:
The sum of 4 squares result was stated by Gerard, Fermat, and Diophantus(?), but first proved by Lagrange in 1770. It is a classic result in .

How to Cite this Page: 
Su, Francis E., et al. “Sums of Three and Four Squares.” Math Fun Facts. <>.

Fun Fact suggested by:
Lesley Ward

Did you like this Fun Fact?

Click to rate it.

Average rating 4.6 / 5. Vote count: 36

No votes so far! Be the first to rate this Fun Fact