Proof that squares are divisible by 3 when their sum is

For a number $n$ we have

$n\equiv 0,1,2 \mod 3$ so we get $$n^2\equiv 0,1\mod 3$$ For $$a^2+b^2$$ we have

$$a^2+b^2\equiv 0 \mod 3$$ The only possibility is $$a^2=b^2\equiv 0 \mod 3$$


It probably isn't the best solution, but you could try using congruence.

Since 3 is a pretty small number, you can test each case for

$$a,b\equiv 0,1,2\pmod 3$$

And for each one check if

$$a² + b² \equiv 0 \pmod 3 $$

It gives you (all results given modulo 3):

$$ \begin{matrix} a & b & a^2+b² \\ 0 & 0 & 0 \\ 0 & 1 & 1 \\ 0 & 2 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 2 \\ 1 & 2 & 2 \\ 2 & 0 & 1 \\ 2 & 1 & 2 \\ 2 & 2 & 2 \\ \end{matrix} $$

As you can see:

$$a² + b² \equiv 0 \pmod 3 $$ iff $$a \equiv 0\pmod 3 \land b\equiv 0\pmod 3 $$