# What Are Triangular Numbers?

• Author:
• Updated date:

I am a former maths teacher and owner of DoingMaths. I love writing about maths, its applications, and fun mathematical facts.

## What Are Triangular Numbers?

The triangular numbers are a sequence of numbers created by arranging dots into equilateral triangles of increasing size. You can see from the diagram below that the first triangular number, 1, is formed from just one dot.

To get the second triangular number, 3, we add another row, this time containing two dots, underneath our original dot.

We then add a row of three dots to get the third triangular number 6.

We continue to do this, each time adding an extra row to the bottom of the triangle which contains one more dot than the previous row. This gives the sequence 1, 3, 6, 10, 15, 21, etc.

## Describing Triangular Numbers Algebraically

We have seen how to construct the sequence of triangular numbers using a pictorial method, but now let's try to formalise this mathematically. We can see from what we have done so far, that the difference between one triangular number and the next increases by one each time.

If we denote the first triangular number as T1, the second as T2, and so on so that the nth triangular number is Tn, and furthermore define the zero-th triangular number as 0, we get that:

T0 = 0

T1 = T0 + 1 = 1

T2 = T1 + 2 = 3

T3 = T2 + 3 = 6

T4 = T3 + 4 = 10

and so on.

We therefore get that any triangular number is the sum of all of the positive integers up to and including its term number i.e. Tn = 1 + 2 + 3 + 4 + ... + n.

In sum notation, this can be expressed as in the following picture.

## How to Calculate the nth Triangular Number

We know that Tn = 1 + 2 + 3 + … + n.

If we rewrite Tn but with the sum in reverse we get that Tn = n + n−1 + n−2 + … + 2 + 1

Adding these two lines together we get that:

Tn + Tn = (n + 1) + (n − 1 + 2) + (n − 2 + 3) + … + (n + 1)

2Tn = (n + 1) + (n + 1) + (n + 1) + … + (n + 1)

As there are n terms in this series we then get:

2Tn = n × (n + 1)

Tn = n × (n + 1) / 2

Using this formula we can quickly calculate any term in the series.

E.g. T50 = 50 × 51 / 2 = 1275

T1000 = 1000 × 1001 / 2 = 500 500

If we align our triangles to the side, creating right-angled triangles instead of equilaterals, we can then take two consecutive triangles and by rotating one through 180°, put them together to make a square. This can be seen in the picture below where we have taken the 3rd triangular number (in red) and the 4th triangular number (in blue). By adding them together we get a square of size 4 × 4 = 16.

## Triangular and Square Numbers: The Algebra

We can see quite easily that this method can be applied to all of the triangular numbers we have seen so far and if we add together any consecutive triangular numbers, we do indeed get a square number.

For example; 1 + 3 = 4, 3 + 6 = 9, 6 + 10 = 16.

Furthermore, we can see that so far we are getting all of the square numbers 1 (equal to the first triangular number), 4, 9, 16, etc. without skipping any.

This can be shown algebraically by considering the formula we created earlier.

Tn + Tn−1 = n × (n + 1) / 2 + (n − 1) × n / 2

= (n2 + n) / 2 + (n2 − n) / 2

= 2n2 / 2

= n2

We have therefore shown that any consecutive triangular numbers must add together to create a square number and any square number n2 can be formed by adding together Tn and Tn−1.

There is also a surprisingly simple link between the triangular numbers and the cube numbers. The square of the nth triangular number is equal to the sum of the first n cube numbers.

Algebraically, this can be expressed as:

Tn2 = (1 + 2 + 3 + … + n)2 = 13 + 23 + 33 + … + n3.

This is known as Nichomachus's theorem, named after the ancient Greek mathematician Nichomachus of Gerasa.

## Practical Uses of the Triangular Numbers

Perhaps the most famous application of the triangular numbers is in the Handshake problem. If we have n people in a room, how many handshakes are needed so that each person had shaken hands with everybody else exactly once?

If there are only 2 people in a room, then 1 handshake takes place.

If there are 3 people in a room, then person a shakes hands with person b and person c, followed by person b and person c shaking hands for a total of 3 handshakes.

If there are 4 people in a room, it can be calculated fairly easily that 6 handshakes are needed.

This can be expanded to n people. With n people in a room, the first person would need to shake hands with everybody else in the room, making n − 1 handshakes featuring the first person. The second person needs to shake hands with everybody, but we have already counted his handshake with person 1, so they have a further n − 2 people to shake hands with.

By continuing this logic we can see that for n people, there will be (n − 1) + (n − 2) + … + 2 + 1 handshakes. As we have already seen, this is equal to Tn−1.

Therefore, regardless of how many people there are in the room, the number of handshakes required will always be a triangular number.