<s>[INST] Find all integer values for $m$ such that $x_1,x_2\in\mathbb{Z}$ We have $(m+1)x^2-(2m+1)x-2m=0$ where $m\in\mathbb{R}\backslash\left\{-1\right\}$. We need to find all integer values for $m$ such that both roots of the equation are integers.
Here is all my steps:


*

*$x_{1,2}=\frac{(2m+1)\pm\sqrt{12m^2+12m+1}}{2(m+1)}\in\mathbb{Z}$
$\Rightarrow 2(m+1)\:|\:(2m+1)\pm\sqrt{12m^2+12m+1}$
$\Rightarrow 2(2m+2)+1\pm\sqrt{12(2m+2)^2+12(2m+2)+1}=0$

*$x_1=2(2m+2)+1+\sqrt{12(2m+2)^2+12(2m+2)+1}=0$
$\Rightarrow \sqrt{12(2m+2)^2+12(2m+2)+1}=-4m-5$
$\Rightarrow 12(2m+2)^2+12(2m+2)+1=(-4m-5)^2$
$\Rightarrow 12(4m^2+8m+4)+24m+25=16m^2-40m+25$
$\Rightarrow 48m^2+96m+48+24m+25=16m^2-40m+25$
$\Rightarrow 32m^2+160m+48=0$|:16
$\Rightarrow 2m^2+10m+3=0$ but $\sqrt{\Delta}\notin\mathbb{N}$
Now we have to verify for $x_2$ like above:


*

*$x_2=48m^2+96m+48+24m+25=16m^2+40m+25$


$\Rightarrow 32m^2+80m+48=0|:16$
$\Rightarrow 2m^2+5m+3=0 \Rightarrow \sqrt{\Delta}=1$
$\Rightarrow m_1=-1\in\mathbb{Z}, m_2\notin\mathbb{Z}$

But as the author says $m\in\mathbb{R}\backslash\left\{-1\right\}$

 [/INST] Let's express $x$:
$$
-m = \frac{x^2-x}{x^2-2x-2}.
$$
So,
$$
-m - 1 = \frac{x+2}{x^2-2x-2}.
$$
Denominator never equal to $0$ for integers $x$. If $|x+2|<|x^2-2x-2|$, $m$ cannot be integer (unless $x=-2$; we'll check this case later). Solve this inequality:
$$
|x+2|<|x^2-2x-2|\Leftrightarrow (x^2-2x-2)^2 - (x+2)^2 > 0 \Leftrightarrow x^4 - 4x^3 + 4x - x^2 > 0
$$
But
$$
x^4 - 4x^3 + 4x - x^2 = x(x-1)(x+1)(x-4).
$$
Hence, if $x>4$ or $x<-1$, $m$ cannot be integer. Now we just should check integers $-2\le x\le 4$ (don't forget about $x=-2$).


*

*$x=-2$, $m=-1$

*$x=-1$, $m=-2$

*$x=0$, $m=0$

*$x=1$, $m=0$

*$x=2$, $m=1$

*$x=3$, $m=-6$

*$x=4$, $m=-2$


Excluding $m=-1$, possible $m$ are
$$
-6, -2, 0, 1.
$$
But both roots must be integers; so, $\boxed{m=-2}$ or $\boxed{m=0}$.
</s>