4. For which integer values of $a$ and $b$ does the system

$$
\left\{\begin{array}{l}
m^{2}+n^{2}=b \\
\frac{m^{n}-1}{m^{n}+1}=a
\end{array}\right.
$$

have a solution (for $m$ and $n$) in the set $\mathbb{Z}$ of integers.
Solution. From the first equation, we get $m^{n}=\frac{1+a}{1-a}=1+\frac{2 a}{1-a}$, which means that the number $\frac{2 a}{1-a}$ must be an integer. Since $a$ and $a-1$ are coprime for $a \neq 0$, the number $\frac{2 a}{1-a}$ is an integer if and only if $a=-1,2,3$.

For $a=-1$ we have $m^{n}=0$, so we get $m=0$ and $n$ is any integer different from 0.

For $a=2$ we get $m^{n}=-3$, so $m=-3, n=1$.

For $a=3$, we get $m^{n}=-2$, so $m=-2, n=1$.

On the other hand, for $a=0$ we have $m^{n}=1$, from which we get $n=0, m$ is any integer different from zero or $m=1$ and $n$ is any integer.

Therefore, the system has a solution in the set of integers for: $a=-1, b=n^{2}, n \neq 0, a=0, b=1+n^{2} ; a=2, b=10 ; a=3, b=5$.

## 4th year