## Task B-2.2.

Determine all ordered pairs of integers $(x, y)$ for which

$$
(x y-1)^{2}=(x+1)^{2}+(y+1)^{2}
$$
## Solution.

Notice that the given equation is symmetric, so if the pair $(x, y)$ is a solution to the equation, then the pair $(y, x)$ is also a solution.

Transform the given equation:

$$
\begin{aligned}
& (x y-1)^{2}=(x+1)^{2}+(y+1)^{2} \\
& (x y-1)^{2}-(x+1)^{2}=(y+1)^{2} \\
& (x y+x)(x y-x-2)=(y+1)^{2} \\
& x(y+1)(x y-x-2)=(y+1)^{2}
\end{aligned}
$$

First case. If $y+1=0$, then the equation is satisfied for any $x$. Therefore, the solutions to the given equation are all ordered pairs $(a, -1)$, where $a \in \mathbb{Z}$.

Due to symmetry, the solutions are also all ordered pairs $(-1, b)$, where $b \in \mathbb{Z}$.

Second case. If $x+1 \neq 0$ and $y+1 \neq 0$, then $x(x y-x-2)=y+1$.

This is equivalent to

$$
\begin{gathered}
x^{2} y-x^{2}-2 x=y+1 \\
x^{2} y-y=x^{2}+2 x+1 \\
\left(x^{2}-1\right) y=(x+1)^{2} \\
(x-1)(x+1) y=(x+1)^{2}
\end{gathered}
$$

Since $x+1 \neq 0$, it follows that $(x-1) y=(x+1)$.

If $x=1$, this equation has no solutions, so we divide by $x-1$:

$$
y=\frac{x+1}{x-1}=1+\frac{2}{x-1}
$$

This implies $x-1 \in\{-2,-1,1,2\}$, or $x \in\{-1,0,2,3\}$. Since $x, y \neq -1$, it must be that $x \in\{2,3\}$. From $x=2$ we get $y=3$; from $x=3$ we get $y=2$.

Finally, the solutions are the ordered pairs: $(2,3),(3,2),(-1, b),(a,-1)$ for $a, b \in \mathbb{Z}$.