<s>[INST] Integer solutions of $n^2+n = 2x^2+2x$ I know that the integers solutions of the equation:
$$ n^2+n = 2x^2+2x $$
are
$$n = \frac{1}{4} (-(3 - 2 \sqrt{2})^m - \sqrt{2} (3 - 2 \sqrt{2})^m - (3 + 2 \sqrt{2})^m + \sqrt{2} (3 + 2 \sqrt{2})^m + 2),$$
$$x = \frac{1}{8} (2 (3 - 2 \sqrt{2})^m + \sqrt{2} (3 - 2 \sqrt{2})^m + 2 (3 + 2 \sqrt{2})^m - \sqrt{2} (3 + 2 \sqrt{2})^m + 4),$$
$m \in \mathbb{Z}, m\ge0$
but I don't understand how. 
Someone can point me in the right direction to solve this problem.
 [/INST] One way is to set $m=2n+1$ and $y=2x+1$ and get the equivalent Pell equation $m^2=2y^2-1$.
The fundamental solution is $m=1, y=1$ and the general solution comes from the odd powers of $1+\sqrt2$. You go from one solution to another by multiplying by $(1+\sqrt2)^2=3+2\sqrt2$. This gives
$$
\pmatrix{ m_{k+1} \\ y_{k+1}}
=
\pmatrix{ 3 & 4 \\ 2 & 3}
\pmatrix{ m_{k} \\ y_{k}},
\qquad
\pmatrix{ m_{0} \\ y_{0}}
=\pmatrix{ 1 \\ 1}
$$
whose eigenvalues are $3 \pm 2 \sqrt2$. The general solution is a linear combination of powers of these eigenvalues.
You can avoid eigenvalues etc by considering the powers of $1-\sqrt2$, which helps extract both parts.
</s>