[Math] Understanding a proof of Lagrange’s four-square theorem

number theoryproof-verification

I've been looking at Wikipedia's proof of the four-square theorem and trying to work out the details – I like that it doesn't need to separate the cases for $m$ even and odd, but there is one step that seems flawed if the $m$ even case is not dispensed with in advance.

Now let $m$ be the smallest positive integer such that $mp$ is the sum of four squares, $x_1^2+x_2^2+x_3^2+x_4^2$. We show by contradiction that $m$ equals $1$: supposing it is not the case, we prove the existence of a positive integer $r$ less than $m$, for which $rp$ is also the sum of four squares (this is the "infinite descent" method of Fermat).

For this purpose, we consider for each $x_i$ the $y_i$ which is in the same residue class modulo $m$ and between $-m/2+1$ and $m/2$ (included). It follows that $y_1^2+y_2^2+y_3^2+y_4^2=mr$, for some positive integer $r$ less than $m$.

What justifies the claim that $r<m$? From $y_i\in[-m/2+1,m/2]$ we get only $\sum y_i^2\le m^2$, and there still remains the case when each $y_i$ is equal to $m/2$.

Sorry to ask such a simple question, but there aren't any other proofs that I've seen that try to take this approach, and it would make my job easier (I'm writing a formal proof) if this approach is valid, since it saves me a few lemmas.

Best Answer

Assume $y_1=y_2=y_3=y_4=m/2$. Then $x_i=mk_i + m/2$, for some non-negative integers $k_1,...,k_4$ (because we can assume from the beginning of the problem that $x_1,...,x_4$ are non-negative). But this gives $mp=x_1^2+x_2^2+x_3^2+x_4^2=m^2(k_1^2+...+k_4^2+k_1+...+k_4+1)$, that is, $p=m(k_1^2+...+k_4^2+k_1+...+k_4+1)$, which is a contradiction since $p$ is prime.

Then $y_1,...,y_4$ cannot be all equal to $m/2$, and therefore $y_1^2+...+y_4^2<m^2$, which implies $r<m$.

Related Question