TITLE: Which triangular numbers are also squares?
QUESTION [7 upvotes]: 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.

REPLY [3 votes]: As the other answers have explained, the multiplication by 4 is to make things neater. However, on closer look, the formulation
(2n+1)^2 - 1 = 8m^2
doesn't really simplify the situation.
This is because (2n+1), an odd number, when squared, will always be one more than [8 times a triangular number]. This formulation simply restates the problem: when is m^2 a triangular number.
The way I have gone about this problem is to state it as follows:
n(n+1) = 2m^2
n and (n+1) can share no common factors. Since all the prime factors except 2 on the RHS are raised to an even power, one of (n) and (n+1) must be a square and the other 2 times a square. The situation now becomes:
a^2 = 2b^2 +- 1
To illustrate, the first triangular and square number after 1 is 36, because:
3^2 = 2*2^2 + 1
The series of 'square triangulars' can be found by finding all a-b pairs which fulfil the above equation. The first few pairs are: (1,1); (3,2); (7,5); (17,12). These yeild the square triangular numbers: 1, 36, 1225, 41616.
An infinite series of these pairs can be generated as follows:
take one pair; (a,b)
the next pair is (a+2b, a+b)