Prove that the only integer solution to the equation $x^2+y^2=3z^2$ is $x=y=z=0$. I started by saying that $x^2$ and $y^2$ must be divisible by 9 because they are perfect squares and must add to a multiple of three. $z^2$ also must be a multiple of 9, otherwise the equation wouldn't be correct. $3z^2$ will have an extra multiple of $3$, so the equation is not true for values other than $x=y=z=0$.
Is my reasoning correct? And would this logic apply for $x^2+y^2=5z^2$?

Suppose $x^2+y^2=3z^2$ is a minimal non zero solution. Now consider $x$ and $y$ modulo $3$ ($1^2 \equiv 2^2 \equiv 1 \pmod{3}) $. Both must be multiples of $3$ so $x=3a$ and $y=3b$. this give $3a^2+3b^2=z^2$ so $z$ must be a multiple of $3$. $z=3c$ and we have $a^2+b^2=3c^2$ which contradict the hypothesis that $x^2+y^2=3z^2$ is a minimal non zero solution.
