# Prove that an integer of the form $8n +7$ cannot be expressed as a sum of three integer squares

Consider an integer of the form $8n +7$. Show that it cannot be expressed as a sum of three integer squares.

Hints are welcome. If you wish to post an answer, please post a hint as your answer, especially some fundamental concepts in elementary number theory / abstract algebra that might be relevant.

My work, so far:

As noted by carmichael561 (please see his hints below), the problem makes sense only for $n \in \mathbb{N}$.

$$8n+7 = a^2 + b^2 + c^2$$

for $a,b,c \in \mathbb{Z}$.

We can rewrite the equation as $$8n = a^2 + b^2 + c^2 -7$$

Now since $8$ divides the LHS, it also divides the RHS. In particular,

the LHS is a number that is congruent to $0$ mod($8)$ but the LHS is congruent to $7$ mod($8$), which is a contradiction.

Hint: what are the squares mod $8$?
• @user58865 you said three integer squares, so $n=\frac 12$ is not allowed. – Ross Millikan Sep 12 '16 at 1:04
• Note that $8\cdot\frac{1}{2}+7=11=3^2+1^2+1^2$. It's safe to say $n$ is an integer. – carmichael561 Sep 12 '16 at 1:05
• If $a^2+b^2+c^2=8n+7$ then $a^2+b^2+c^2\equiv 7$ (mod $8$). So as I've said, the key to arriving at a contradiction is determining the possible residue classes of $a^2,b^2,c^2$ mod $8$. – carmichael561 Sep 12 '16 at 1:54
• Sure: show that the possible residue classes for a square mod $8$ are $0,1,4$. – carmichael561 Sep 12 '16 at 2:37
• To determine the residue classes of squares mod $8$, you just need to compute $a^2$ mod $8$ for $a=0,1,2,\dots,7$. There is no need to divide by $8$. – carmichael561 Sep 12 '16 at 3:46