Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


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.

share|cite|improve this question
The multiplication by $4$ is to make the completing the square nice. – André Nicolas Apr 13 '14 at 1:36
@AndréNicolas I've done the following: $n^2+n+\frac{1}{4}=m^2+\frac{1}{4}$. – Voyska Apr 13 '14 at 1:40
See square triangular number. – Lucian Apr 13 '14 at 1:41
Number-theoretic reasoning tends to be more accurate if one avoids fractions. – André Nicolas Apr 13 '14 at 2:13
To complete the square in $ax^2+bx+c$, it is useful to multiply by $4a$. – André Nicolas Apr 14 '14 at 4:16

$$ 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 $$

share|cite|improve this answer

He multiplies it by $4$ so as to simplify the condition $\frac{n(n+1)}{2}=m^2$ to a simpler condition, involving a quadratic term on the left hand side (since there is a quadratic term on the right hand side, too). This allows us to complete the square (and also makes the equation "look good").

To proceed from your work, multiply both the sides by $4$ and then following the book's solution: $$4\times(n^2+n)=4\times(2m^2)$$ The condition is achieved simply by moving $1$ to the right hand side and by moving $8m^2$ to the left hand side.

share|cite|improve this answer
What I still don't understand is why that is the condition. – Voyska Apr 14 '14 at 4:12

The $m$th square number is equal to the $n$th triangular number if
$m={{\left(3+2\sqrt 2\right)^u-\left(3-2\sqrt 2\right)^u}\over{4\sqrt 2}}$ and $n={{\left(3+2\sqrt 2\right)^u-2+\left(3-2\sqrt 2\right)^u}\over 4}$.
For each integer value of the index $u$ — positive, zero or negative — there is such a pair.
If $m_0=0$ and $m_1=1$, then $m_u=6m_{u-1}-m_{u-2}=6m_{u+1}-m_{u+2}$.
If $n_0=0$ and $n_1=1$, then $n_u=6n_{u-1}-n_{u-2}+2=6n_{u+1}-n_{u+2}+2$.

share|cite|improve this answer

This conversion course gives solutions, but there are obtained two equations.

Certainly better to solve the equation.

Of course the solution of equation: $Y^2=\frac{X(X\pm1)}{2}$

Defined solutions of Pell's equation: $p^2-2s^2=\pm1$

But it is necessary to write the formula describing their solutions through solving Pell's equation:



And more.



$p,s$ - These numbers can be any character.

If you need to have a solution of the equation: $Y^2=\frac{X(X\pm{a})}{2}$

It is necessary to substitute into the formulas equation Pellya solutions: $p^2-2s^2=\pm{a}$

share|cite|improve this answer

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)

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.