# Twice a triangle is triangle

The question is to prove that there are infinitely many triangular numbers $T_n$ where $2 \times T_n$ is also a triangular number, and give the first few as an example.

My attempt:

$$2 \cdot {x(x+1) \over 2} = {y(y+1) \over 2} \\ \Leftrightarrow {x(x+1)} = {y(y+1) \over 2} \\ \Leftrightarrow 2x^2 + 2x = y^2 + y \\ \Leftrightarrow 4x^2 + 4x = 2y^2 + 2y \\ \Leftrightarrow 4x^2 + 4x +1= 2y^2 + 2y +1\\ \Leftrightarrow (2x +1)^2= 2y^2 + 2y +1\\ \Leftrightarrow 2(2x +1)^2= 4y^2 + 4y +2\\ \Leftrightarrow 2(2x +1)^2= (2y +1)^2 + 1\\ \Leftrightarrow Y^2 - 2X^2 = -1, \quad X=(2x+1) \text{ and } Y=(2y + 1)\\$$

This is Pell's equation in 2 variables, and I obtained $(1, 1)$ and $(7, 5)$ as 2 solutions. However, I'm unable to prove infinite of them. I know that this is a very famous Pell equation, but I haven't been able to find good answers as to how the recurrence is established, firstly between $X$ and $Y$, and then between $x$ and $y$. I know that there exists one, which I obtained from this diophantine equation solver, but I don't understand the solution given there.

Can anyone please help me derive the recurrence relation?

• I already read this and similar questions, but they don't tell how to solve for the recurrence. – xylon97 Mar 22 '13 at 18:25
• What do you mean by "solve for the recurrence"? Do you want a closed formula for the solutions? – Álvaro Lozano-Robledo Mar 22 '13 at 18:32
• @Alvaro No, not closed form, in terms of the previous solutions. – xylon97 Mar 22 '13 at 18:37
• This is related to square triangular numbers: math.stackexchange.com/questions/76040/… (It can be explicitly visible from the picture and the approach in my answer.) – Martin Sleziak Nov 6 '15 at 16:10

## 2 Answers

Note that $$(a^2-2b^2)(c^2-2d^2)=(ac+2bd)^2 -2(ad+bc)^2.$$ This is a special case of the Brahmagupta Identity. It can be readily proved by expanding the two sides.

A nice way of looking at things is to let $(a,b)$ be a particular solution of your Pellian $x^2-2y^2=1$, say $(1,1)$. Then you can generate infinitely many solutions $(x_n,y_n)$ by letting $$x_n+y_n\sqrt{2}= (1+\sqrt{2})(3+2\sqrt{2})^n.$$

You can simplify calculations by noting that $x_{n+1}+y_{n+1}\sqrt{2}=(x_n+y_n\sqrt{2})(3+2\sqrt{2})$. This yields the recurrences $$x_{n+1}=3x_n+2y_n,\qquad y_{n+1}=2x_n+3y_n.$$

• @hkaputr97, if you wish to use this formula, remember to compose three solutions to your Pell equation and not just two; the $-1$ will be pesky. – Julien Clancy Mar 22 '13 at 18:37
• Also, @André, out of curiosity does this method give all solutions applied to appropriate previous ones? – Julien Clancy Mar 22 '13 at 18:45
• Yes, it gives all solutions, except for changes of sign. The full theory is quite beautiful, and almost general. Everything is fully worked out for $x^2-dy^2=1$. For $x^2-dy^2=-1$, once we have the fundamental solution, or any solution, we are OK, but there is not a fully satisfactory simple criterion for existence of a solution to $x^2-dy^2=-1$. – André Nicolas Mar 22 '13 at 18:54
• Could you link me to a resource or textbook that develops this theory? – Julien Clancy Mar 22 '13 at 18:56
• There is a very nice book by Ed Barbeau, called the Pell Equation. In addition, most books on elementary number theory have a Pell equation chapter, usually after the chapter on continued fractions. Silverman (Friendly Introduction $\dots$) is a nice number theory book. But there are many others, Niven and Zuckerman is good. So is the one by Kenneth Rosen. Lots of others, including freely available ones. You may want to ask a question about that, I am not familiar with the free stuff. – André Nicolas Mar 22 '13 at 19:28

You can generate infinitely many solutions $\langle Y_n,X_n\rangle$ by using the following recurrences:

\left\{\begin{align*} Y_{n+1}&=3Y_n+4X_n\\ X_{n+1}&=2Y_n+3X_n \end{align*}\right.\tag{1}

You can prove by induction that this recurrence generates solutions:

$$Y_{n+1}^2=9Y_n^2+24X_nY_n+16X_n^2\;,$$

and

$$2X_{n+1}^2=8Y_n^2+24X_nY_n+18X_n^2\;,$$

so

$$Y_{n+1}^2-2X_{n+1}^2=Y_n^2-2X_n^2\;.$$

I realize that $(1)$ seems to have been pulled from thin air, but it really wasn’t. The fractions $\dfrac{Y_n}{X_n}$ are alternating convergents in the continued fraction expansion of $\sqrt2$, where the $2$ comes from the coefficient of $X^2$ in your equation, and I’m using essentially this technique. You might want to look at that article in its entirety, as it gives a pretty comprehensive introduction to Pell’s equation.