The Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math

Square Triangular Numbers

Date: 11/22/2002 at 14:24:27
From: Sharon
Subject: Perfect square

Is there a math equation for a perfect square, using the following as 
a definition for the perfect square with the following properties?
The sum of the integers is equal to the number squared.


   36 = 6 squared, making 36 a perfect square 
Another example would be 1225 
   1225 = sum of 1 to 49  
   1225 = 35 squared, making 1225 a perfect square

Date: 11/22/2002 at 15:00:25
From: Doctor Roy
Subject: Re: Perfect square


Thanks for writing to Dr. Math.

You are talking about numbers that are both triangular and square, or
square triangular numbers. You already know what a square number is.
A triangular number is a number that can be expressed as the sum of
the first n whole numbers, like 1, 3, 6, 10, 15, 21, .....

This problem was solved a while ago.  Here's the solution:

    (1 + 2 + 3 + .... + n) = n*(n+1)/2

This is the n-th triangular number. Let's say it is the same as the
mth square, m^2, or:

    n*(n+1)/2 = m^2

Let's complete the square on the left:

    1/2 * (n^2 + n + (1/2)^2) - (1/2)*(1/2^2) = m^2

                      1/2 * (n + 1/2)^2 - 1/8 = m^2

                          4*(n+1/2)^2 - 8*m^2 = 1

                              (2n+1)^2 - 8m^2 = 1

From here, let's substitute x = (2n+1) and y = 2m

                                  x^2 - 2*y^2 = 1

This is a famous equation known as the Pell equation.  The solutions
are well known.  

The first few solutions you know:  m = 6, n = 8 and m = 35, n = 49.  
A few others are:

    41616, 1413721, 48024900

These numbers are both triangular and square. Euler proved that there
is an infinite number of such numbers. There is an abbreviated proof
in the Dr. Math archives at:

   Triangular Numbers 

There is a general formula for square triangular numbers. You can find 
it by searching the Mathworld site for square triangular numbers.
The Mathworld website is at: 

I hope this helps.

- Doctor Roy, The Math Forum 
Associated Topics:
High School Number Theory

Search the Dr. Math Library:

Find items containing (put spaces between keywords):
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.