# Proof verification: Alternative proof of Lagrange's four square theorem.

We assume Fermat's two-square theorem to begin with. Note that, in our proof, the terms numbers and natural numbers are everywhere taken to mean nonnegative integers.

Lemma 1: The product of two numbers that are the sums of two squares, is itself a sum of two squares.

Proof: $(a_1^2+b_1^2)(a_2^2+b_2^2)=(a_1a_2+b_1b_2)^2+(a_1b_2-a_2b_1)^2$

Lemma 2: Every composite number of the form $4k+1$ can be represented as the sum of two squares.

Proof: As $3^m \equiv 1 \pmod {4}$ if and only if $m$ is even, the largest factor of the form $4l+3$ of any number of the form $4k+1$ must be a perfect square.

Theorem (Lagrange): Any natural number can be represented as the sum of four natural squares.

Proof: Any number $4n+1$ can be represented as the sum of two squares, and $4n+2$ and $4n+3$ can then be represented as the sum of three and four squares respectively. For $4n$, we take $4^p$ to be the highest power of $4$ dividing $4n$. Then $4n=4^pr=(2^p)^2r$, which is a sum of two squares as $r \equiv 1, 2, \text{ or } 3 \pmod{4}$. Thus, all numbers can be represented as the sum of four squares.

I think that this proof is correct, but it seems unusually short, and I haven't been able to find it anywhere else. Please verify it.

• This is wrong: $3\cdot7=21=4*5+1$ is not the sum of two squares. – Professor Vector Jun 17 '17 at 9:00
• Yout mostake is when you say that the largest factor of a number $4k+1$ of the form $4l+3$ has to be a perfect square. As Professor Vector's example shows, you cannot claim that, and unsurprisingly, you didn't justify this claim precisely. – Max Jun 17 '17 at 9:06
• Lemma $2$ is wrong - see this duplicate. – Dietrich Burde Jun 17 '17 at 13:23
• The set $E$ of numbers that can be represented as a sum of two squares has asymptotic density zero, so it is quite non-trivial that $\mathbb{N}\subset E+E$. – Jack D'Aurizio Jun 17 '17 at 15:39