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:
$\endgroup$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.
4 Answers
$\begingroup$The square of an odd number is one more than a multiple of $4$: $$(2j+1)^2=4j^2+4j+1=4(j^2+j)+1,$$ and the square of an even number is exactly a multiple of $4$: $$(2i)^2=4i^2.$$ In fact, it is easy to see that the converse holds as well. That is, for any integer $m$, $$\begin{align*} m\text{ is even }&\iff m^2\text{ is a multiple of 4},\\[0.1in] m\text{ is odd }&\iff m^2\text{ is one more than a multiple of 4}. \end{align*}$$ If none of the numbers $w,x,y$ are odd, then $$z^2=w^2+x^2+y^2=(\text{multiple of 4})+(\text{multiple of 4})+(\text{multiple of 4})$$ is a multiple of 4, which implies $z$ is even.
If exactly one of the numbers $w,x,y$ is odd, then $$z^2=w^2+x^2+y^2=(\text{multiple of 4})+(\text{multiple of 4})+(\text{multiple of 4})+1$$ is one more than a multiple of $4$, and therefore $z$ is odd.
Is it possible to have two, or all three, of the integers $w,x,y$ be odd, and have $z^2=w^2+x^2+y^2$ be true for some integer $z$?
My answer above is just a more verbose way of doing modular arithmetic, or more specifically, arithmetic modulo $4$.
$\endgroup$ 1 $\begingroup$An even number can be written in the form $2n$ for some integer $n$, and its square is therefore of the form $4n^2$. An odd number, on the other hand, is of the form $2n+1$ for some integer $n$, and its square is therefore of the form $4n^2+4n+1=4(n^2+n)+1$. Thus, the square of every even integer is a multiple of $4$, and the square of every odd integer is one more than a multiple of $4$.
Now consider $w^2+x^2+y^2$: each of the terms is congruent to $0$ or to $1$ modulo $4$ (or if that terminology isn’t familiar, each leaves a remainder of $0$ or $1$ on division by $4$). Thus, the remainder when you divide $w^2+x^2+y^2$ by $4$ is exactly equal to the number of odd integers among $w,x$, and $y$. If $z$ is even, the remainder when $z^2$ is divided by $4$ is ... what? And what does that say about the number of odd integers in the set $\{w,x,y\}$?
$\endgroup$ $\begingroup$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)^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
$\endgroup$ $\begingroup$Let W and X be odd number, thus:
$W=2a + 1$ (odd)
$X=2b + 1$ (odd)
Let Y be an even number, thus:
$Y=2c$
So,
$W^2 + X^2 + Y^2 = (2a + 1)^2 + (2b + 1)^2 + (2c)^2$
$= 4a^2 + 4a + 1 + 4b^2 + 4b + 1 + 4c^2$
$= 4(a^2 + a + b^2 + b + c^2) + 2$
isn't this an even number? If yes, then you can produce an even number by having only 1 even and two odds.
Please can anyone confirm this?
$\endgroup$ 2