5. (3 points) Solve the equation $x^{2}+y^{2}=2^{z}$ in natural numbers.

Answer: $x=y=2^{n}, z=2 n+1$, where $n-$ is a non-negative integer.

#
# Solution:

Notice that $2^{z}$ is always even for natural numbers, so $x$ and $y$ must have the same parity.

First, consider the case when both numbers are odd. In this case, the sum of their squares gives a remainder of 2 when divided by 4. This means that $2^{z}=2$, so $x=y=z=1$.

If $x$ and $y$ are even, then $x^{2}$ and $y^{2}$ are divisible by 4, which means $2^{z}$ is divisible by 4. Dividing each term by 4, we get the equation in natural numbers $\left(\frac{x}{2}\right)^{2}+\left(\frac{y}{2}\right)^{2}=2^{z-2}$.

By dividing by 4, we eventually arrive at the first situation where $x$ and $y$ are odd. Therefore, the general solution is $x=y=2^{n}$, $z=2 n+1$.