# Square Triangle numbers and Pell's equation

So i have just started to study number theory and i was asked this question.

Now i tried to search online and i found out pell equation can used to solve this question. Now in an online video i saw that $$x^2-2y^2=1$$ is the equation and you take the solution point such as the first solution $$x_1=3$$ and $$y_1=2$$ and you input that into $$T_n=S_n$$ and solving that you will get your first triangular square number.

My question is how do you go about finding the solutions to pell equation without doing trial by error.

Please correct me if i am wrong or got some misinformation

The first two numbers that are both squares and triangles are $$1$$ and $$36$$.

• Find the next one and, if possible, the one after that.
• Can you figure out an efficient way to find triangular-square numbers?
• Do you think that there are infinitely many?
• Have you researched Pell's equation? The Wikipedia article on the subject, along with articles of Keith Conrad, should give you a fairly complete picture. You have to find or look up the fundamental solution, from which all other (infinitely many) solutions may be generated. Sep 10, 2020 at 14:21
• Sep 10, 2020 at 14:57
• Once you get the Pell equation as shown in some answers, you can use this method to solve it. math.stackexchange.com/questions/3099910/… Sep 11, 2020 at 21:15

I don't understand how you got the equation $$x^2+2y^2=1$$ for finding square triangle numbers

We have the diophantine equation, $$T_n=\frac{n(n+1)}{2}=k^2$$.

\begin{align*} n^2 + n &= 2 k^2 \\ 4 n^2 + 4 n &= 8 k^2 \\ (2 n + 1)^2 &= 8 k^2 + 1 \end{align*}

Make the substitution $$u =2 n + 1$$ to get $$u^2 - 8 k^2 = 1$$.

A trivial solution to this is $$(3,1)$$ The rest of the solutions can be found in the form $$(u, k)$$, where $$u_i + 2 \sqrt{2} k_i = (3 + 2 \sqrt{2})^i$$ for natural number, $$i$$. This gives solutions to $$u_i$$ as $$\frac{(3+2\sqrt{2})^i+(3-2\sqrt{2})^i}{2}$$.

For example, $$u_2=\frac{9+12\sqrt{2}+8+9-12\sqrt{2}+8}{2}=17$$. This gives $$n=8$$ and $$T_8=36$$.

I don't really like this form, because it gets harder to deal with when you are dealing with larger powers. You can instead use the fact that the expression for $$u_i$$ is similar to the explicit formula of a recursion with characteristic polynomial, $$x^2-6x+1$$.

This gives the recursion $$u_i=6u_{i-1}-u_{i-2}$$ with initial conditions of $$u_1=3$$ and $$u_2=17$$. We can make the substitution $$u_i=2n_i+1$$, so $$n_i=6n_{i-1}-n_{i-2}+2$$, where $$n_1=1$$ and $$n_2=8$$.

There are infinite of them, see the sequence A001110 on OEIS.

$$0, 1, 36, 1225, 41616, 1413721, 48024900, \dots$$

Without going on much detail about continued fractions and Pell equations, we have the formula (yanked from OEIS):

$$a(n) = \frac {(17+12\sqrt 2)^n+(17-12\sqrt2)^n-2}{32}$$

$$T_n=\dfrac{n(n+1)}2=m^2\iff(2n+1)^2-2(2m)^2=1$$

There are infinitely many solutions to the Pell equation $$x^2-2y^2=1$$,

given by $$y=$$$$\;0,2,12,70,408,...$$ (click on numbers for more information;

$$y_n=6y_{n-1}-y_{n-2}$$), so square triangular numbers are squares of $$0,1,6,35,204,...$$

Pell's equation is $$x^2-Dy^2=1$$

Now, if you meant $$x^2-2y^2=1$$

The solutions arise when you find a period in the continued fraction for $$\sqrt{2}$$. For this, consider \begin{align} \sqrt{2} &= 1+(\sqrt{2}-1) \\ \implies \frac{1}{\sqrt{2}-1} &= \sqrt{2}+1 \end{align} And then solution follows.