I'm reading Stopple's A Primer of Analytic Number Theory:
Exercise 1.1.3: Which triangular numbers are also squares? That is, what conditions on $m$ and $n$ will guarantee that $t_n=s_m$? Show that if this happens, then we have:
$$(2n+1)^2-8m^2=1,$$
a solution to Pell's equation, which we will study in more detail in Chapter $11$.
I thought about the following:
$$\begin{eqnarray*} {t_n}&=&{s_n} \\ {\frac{n^2+n}{2}}&=&{m^2} \\ {n^2+n}&=&{m^2} \end{eqnarray*}$$
I've solved for $n$ and $m$ but I still have no clue of how to proceed. I've looked at the book's solution and the solution is as follows:
$$\begin{eqnarray*} {\frac{n(n+1)}{2}}&=&{m^2} \\ {n(n+1)}&=&{2m^2} \\ {\color{red}{4n(n+1)}}&\color{red}{=}&{\color{red}{8m^2}} \\ {4n^2+4n+1-1}&=&{8m^2} \\ {(2n+1)^2-1}&=&{8m^2} \\ \end{eqnarray*}$$
In the red line, he multiplies the equation by $4$, I don't understand why to do it nor how the condition is achieved.
$$ n(n+1) = \underbrace{n^2 + n = \left(n^2+n+\frac 1 4\right) - \frac 1 4}_{\text{completing the square}} = \left( n + \frac 1 2 \right)^2 - \frac 1 4 $$
The reason for multiplying by $4$ is so that only integers will appear in the line above.
$$ 4n(n+1) = \underbrace{4n^2 + 4n = \left(4n^2+4n+1\right) - 1}_{\text{completing the square}} = (2n+1)^2 - 1 $$