How to show that $7\mid a^2+b^2$ implies $7\mid a$ and $7\mid b$?

Solution 1:

For the sum just look at $a^2 \mod 7$: it can only be $0,1,2$ or $4$. So unless both $a$ and $b$ are divisible by $7$, $a^2 + b^2$ cannot be divisible by $7$.

Solution 2:

The squares of the residues modulo $7$ are $1$,$2$,and $4$. Sums of these are $2,3,4,5,6,8$ which are congruent to $1,2,3,4,5,6$ but not $7$. Therefore $7$ does not divide the sum of two squares.