For any integer x
$x\%3 = 0\,\; or \;1 \, \, or\,\, 2$
$\therefore x^2\%3 = 0 \;\, or \;1 \; or \; 2^2 \;\%\,3=1$
$Thus \, a^2 +b^2 \;can \, be\,$
$0+0=0\; or\; 0+1=1 \;or\; 1+0=1.$
Thus the only possibility is when both $a$ and $b$ are divisible by 3.