Let $n=x^2+y^2$; $n=2^{2k}m$ or $n=2^{2k+1}m$ with $m$ odd. Prove that $2^{k}$ divides both $x$ and $y$. Let $n=x^2+y^2$ where x,y are integers, be one of the forms $n=2^{2k}m$ respectively $n=2^{2k+1}m$ with m odd. Prove that $2^{k}$ divides both x and y.
 A: We prove something a little stronger. Let $2^a$ be the highest power of $2$ that divides both $x$ and $y$. We show that if $2^{2k}$ or $2^{2k+1}$ is the highest power of $2$ that divides $x^2+y^2$, then $a=k$. 
Since $2^a$ is the highest power of $2$ that divides both $x$ and $y$, we have  $x=2^a s$ and $y=2^at$, where $s$ and $t$ are not both even.
If $s$ and $t$ are of opposite parity, then $x^2+y^2=2^{2a}(s^2+t^2)$, and $s^2+t^2$ is odd. So $2^{2a}$ is the highest power of $2$ that divides $x^2+y^2$, and therefore $a=k$.
If $s$ and $t$ are both odd, then $s^2\equiv 1\pmod{4}$ and $t^2\equiv 1\pmod{4}$. It follows that $s^2+t^2\equiv 2\pmod{4}$. So the highest power of $2$ that divides $s^2+t^2$ is $2^1$. It follows that the highest power of $2$ that divides $x^2+y^2$ is $2^{2a+1}$. So again $a=k$. 
A: Let $(x,y)=2^rs$ where $s$ is odd
and $\displaystyle\frac xX=\frac yY=2^rs\implies (X,Y)=1$
$\displaystyle\implies x^2+y^2=2^{2r}s^2(X^2+Y^2)$
Now as $(X,Y)=1,$  
Case $1:$ Either both are odd :
As $(2c+1)^2=4c^2+4c+1\equiv1\pmod4, X^2+Y^2=2\pmod4$ i.e., divisible by $2,$ but not by $4$
Case $2:$ $X,Y$ are of opposite parity 
$\implies X^2+y^2\equiv0+1\pmod4$ i.e., odd
A: Hint $\ x = 2^k a,\ y = 2^{k+j}b,\, \ a,b\ \ {\rm odd}\,\Rightarrow\, x^2\!+y^2 = 2^{2k}(\color{#c00}{a^2\! + 2^{2j} b^2}).\,$ Now $\rm\color{#c00}{that}$ is odd if $\,j>0$ else $\,j=0\,$ so it is $\,a^2\!+b^2 = \rm odd^2\!+odd^2 \equiv 1+1\equiv 2\pmod 4,\,$ so $\rm\color{#c00}{that}$ has at most one factor of $\,2$.
