How many squares does it take to express every whole number as the sum of squares? 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 4^{m}(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=2^{2}+1^{2}+1^{2}+1^{2}, and 15=3^{2}+2^{2}+1^{2}+1^{2}.

**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 number theory.

**How to Cite this Page:**

Su, Francis E., et al. “Sums of Three and Four Squares.” *Math Fun Facts*. <https://www.math.hmc.edu/funfacts>.

**Fun Fact suggested by: **

Lesley Ward