[ Residue arithmetic (other).]

Solve the equation $x^{2}+y^{2}=z^{2}$ in natural numbers.
First, let's consider the case when the numbers $x$ and $y$ are coprime. Both these numbers cannot be even due to the assumption of coprimality. They cannot be odd either: the sum of the squares of two odd numbers gives a remainder of 2 when divided by 4 and therefore cannot be a square.

Next, we will assume that $x$ is odd and $y$ is even. Then $z$ is odd.

We can write the equation as $x^{2}=(z-y)(z+y)$. The numbers $u=z-y$ and $v=z+y$ are odd and coprime.

Indeed, if they have a common divisor

$d>1$, then $d$ divides both $u+v=2z$ and $u-v=2y$. Since $d$ is odd, $z$ and $y$ are also divisible by $d$. Therefore, $x^{2}$ is divisible by $d$, which contradicts the coprimality of the numbers $x$ and $y$.

Thus, $u$ and $v$ are perfect squares: $u=m^{2}, v=n^{2}$, where $m$ and $n$ are odd coprime natural numbers. From this, we get $x=m n, y=1 / 2\left(m^{2}-n^{2}\right), z=1 / 2\left(m^{2}+n^{2}\right)$.

The general solution is obtained from this by swapping $x$ and $y$ and multiplying all variables by an arbitrary natural number.

## Answer

$\{x, y\}=\left\{m n k, 1 / 2 k\left(m^{2}-n^{2}\right)\right\}, z=1 / 2 k\left(m^{2}+n^{2}\right)$, where $m, n$ are coprime odd natural numbers, $m>n, k$ is an arbitrary natural number.