Prove if $7\mid a^2+b^2 \longrightarrow 7\mid a$ and $ 7\mid b$ Prove if $7\mid a^2+b^2 \longrightarrow 7\mid a$ and $7\mid b$
What I did:
I found the possible remainders for $a^2$ are $0, 1, 2$ and $4$.
I think I should say $r_7(a^2)+r_7(b^2)$ can't equal any multiple of $7$ unless both of them are $0$?
And if both of them are $0$, that implies $r_7(a)=0$ and $r_7(b)=0$
Am I correct? How can I explain this in mathy terms?
 A: The way to express your ideas formally is to use modular arithmetic. To say that the possible remainders for $a^2$ are $0,1,2$, and $4$ is to say that
$$
a^2 \equiv 0,1,2,4 \pmod 7.
$$
The same is true for $b^2$, and $7|a^2 + b^2$ if and only if $a^2 + b^2 \equiv 0 \pmod 7$. But notice that if $i,j\in \{0,1,2,4\}$, then $i+j \equiv 0 \pmod 7$ if and only if $i=j=0$.
A: To finish: verify $\,x,y\in \{0,1,2,4\}\,$ and $\,x+y\equiv 0\,\Rightarrow\, x\equiv 0\equiv y\,$ (else $\,x+y = 7\,$ so one of $\,x,y\,$ is $ > 3\, $ so $4,\,$ so the other is $3$, contradiction). Alternatively:
If $\,b\not\equiv 0\,$ then $\,b^{-1}\,$ exists so $\,a^2 \equiv -b^2\,\Rightarrow (ab^{-1})^2\equiv -1\,\overset{\rm cube}\Rightarrow (ab^{-1})^6\equiv -1\,$ contra Fermat.
A: This proof is rather “bizarre” but, I guess, some entertaining (this is because 7 is smoll).Clearly the prime  7 divides a and b, or not divided either. Let S be a^2+b^2; since 7≡3mod4, S is divided by 7^2 (an old and well known theorem); put a=7m+r; b=7n+s  where 1≤r,s≤6.Then a^2+b^2=49(m^2+n^2 )+14(mr+ns)+r^2+s^2 therefore 7 divides r^2+s^2 so we find again the same problem of starting but with just 6+5+4+3+2+1 = 21 posibilities for the new and smoller S’. The possible values are given below and none of them is divisible by 7 which ends the proof.
2, 5, 10, 17, 26, 37,
   8, 13, 20, 29, 40,
      18, 25, 34, 45,
          32, 41, 52,
              50, 61,
                  72.
