Tuesday, 15 September 2026

Exercise (8.2).11

Prove that $8m + 7$ cannot be written as a sum of three squares.


For a given natural number $n$, let's consider its square $n^2 \pmod 8$. There are two cases to consider, even $n=2x$ and odd $n=2x+1$, for some natural number $x$.


Case even $n=2x$

We have $ n^2 = (2x)^2 = 4x^2 $.

Now $x$ can itself be even $x=2y$ or odd $x=2y+1$, for some natural number $y$. 

If $x$ is even then $n^2 = 4(2y)^2 = 16y^2$, and so $n^2 \equiv 0 \pmod 8$.

If $x$ is odd then $n^2 = 4(2y+1)^2 = 4(4y^2 +4y +1) = 16y^2+16y+4$, and so $n^2 \equiv 4 \pmod 8$.


Case odd $n=2x+1$

We have $ n^2 = (2x+1)^2 = 4x^2 + 4x + 1$.

Now $x$ can itself be even $x=2y$ or odd $x=2y+1$, for some natural number $y$. 

If $x$ is even then $n^2 = 4(2y)^2 + 4(2y) + 1 = 16y^2 + 8y + 1$, and so $n^2 \equiv 1 \pmod 8$.

If $x$ is odd then $n^2 = 4(2y+1)^2 + 4(2y+1) + 1 = 4(4y^2 + 4y + 1) + 8y + 4  + 1 = 16y^2+16y + 8y + 8 + 1$, and so $n^2 \equiv 1 \pmod 8$.


In all cases the square of a natural number is only 0, 1 or 4 modulo 8. This means the sum of 3 squares can only be 0, 1, 2, 3, 4, 5, 6, but never 7. This means the sum of 2 squares can't take the form $8m+7$.