If $w^2 + x^2 + y^2 = z^2$, then $z$ is even if and only if $w$, $x$, and $y$ are even I'm trying to go through the MIT opencourseware Mathematics for Computer Science (6.042J). I've been stumped for half a day trying to figure it out. Something isn't clicking, and I could use some help.
Here is the problem:

Suppose that $w^2 + x^2 + y^2 = z^2$, where $w$, $x$, $y$, and $z$ always denote positive integers.
(Hint: It may be helpful to represent even integers as $2i$ and odd integers as $2j + 1$, where $i$ and $j$ are integers)
Prove the proposition: $z$ is even if and only if $w$, $x$, and $y$ are even. Do this by considering all the cases of $w$, $x$, $y$ being odd or even.


First of all, the sum of a set of integers will be even iff the number of odd summands is even(may be $0$).
So, here either none or two of $w,x,y$ are odd.
If none of them is odd, we are done.
If two of them are odd, say $w=2W,x=2X+1,y=2Y+1$ where $W,X,Y$ are integers.
$w^2+x^2+y^2=(2W)^2+(2X+1)^2+(2Y+1)^2=4(W^2+X^2+X+Y^2+Y)+2\equiv2\pmod 4$
But $(\pm1)^2\equiv1, (\pm2)^2\equiv0\pmod 4$
So, there can be no integer $z,$ such that $z^2\equiv2\pmod 4$
Conversely, if $w,x,y$ are even $z^2=w^2+x^2+y^2\equiv0\pmod 4\implies z$ is even
