# Proving the four-square-theorem by using the three-square theorem

Sorry, this is a very, very simple question...

Wikipedia says:

This theorem [the three-square theorem] can be used to prove Lagrange's four-square theorem, which states that all natural numbers can be written as a sum of four squares. Gauss pointed out that the four squares theorem follows easily from the fact that any positive integer that is $1$ or $2 \bmod{4}$ is a sum of $3$ squares, because any positive integer not divisible by $4$ can be reduced to this form by subtracting $0$ or $1$ from it.

But what are we doing about numbers like $112 \equiv 0 \bmod{4}$?

So what's really meant here is that we divide by the maximal power $j$ of $4$, then if in the "worst case" we get a number of the form $8\cdot b + 7$ we subtract $1$, this we can definitively write as three squares, and as final step we multiply all resulting integers with $2^j$, right?

$112 = 4^2\cdot 7 = 4^2(6 + 1^2) = 4^2 (2^2 + 1^2 + 1^2 + 1^2) = 8^2 + 4^2 + 4^2 + 4^2\, .$

• Looks right to me. – TonyK Mar 10 '15 at 9:18
• there is also no real alternative, in that, if the sum of four squares is divisible by 8, or 16, all four numbers (to be squared) are even, if the sum is divisible by 32 or 64, all four numbers are divisible by 4, and so on. – Will Jagy Mar 10 '15 at 17:51