3. (4 points) Find all integer solutions of the equation:

$$
y^{2}=x^{2}-x+2
$$

#
# Solution:

For $|x| \leq 3$, solutions are easily found by enumeration: $\{(2 ; \pm 2) ;(-1 ; \pm 2)\}$.

Now let $|x| \geq 4$. Consider two cases.

Case 1: $x=2 t-$ is even. Then

$$
x^{2}-x+2=4 t^{2}-2 t+2=(2 t-1)^{2}+2 t+1
$$

From the last equality, it follows that $x^{2}-x+2$ differs from the perfect square $(2 t-1)^{2}$ by the amount $2 t+1$. However, from the neighboring perfect squares $(2 t-2)^{2}$ and $(2 t)^{2}$, the number $(2 t-1)^{2}$ differs by the amounts $4 t-3$ and $4 t-1$ respectively. More precisely,

if $t \geq 2$, then

$$
(2 t-1)^{2}<(2 t-1)^{2}+2 t+1<(2 t)^{2}
$$

if $t \leq-2$, then

$$
(2 t)^{2}<(2 t-1)^{2}+2 t+1<(2 t-1)^{2}
$$

Case 2: $x=2 t+1-$ is odd. Then

$$
x^{2}-x+2=4 t^{2}+2 t+2=(2 t+1)^{2}-(2 t-1)
$$

From the last equality, it follows that $x^{2}-x+2$ differs from the perfect square $(2 t+1)^{2}$ by the amount $2 t-1$. However, from the neighboring perfect squares $(2 t)^{2}$ and $(2 t+2)^{2}$, the number $(2 t+1)^{2}$ differs by the amounts $4 t+1$ and $4 t+3$ respectively. More precisely,

if $t \geq 2$, then

$$
(2 t)^{2}<(2 t+1)^{2}-2 t+1<(2 t+1)^{2}
$$

if $t \leq-2$, then

$$
(2 t+1)^{2}<(2 t+1)^{2}-2 t+1<(2 t)^{2}
$$

Thus, for $|x| \geq 4$, the equation has no solutions in integers.

Answer: $\{(2 ; \pm 2) ;(-1 ; \pm 2)\}$.