Number Theory

Figurate Numbers, From Triangles to Squares and Beyond

Arrange dots into triangles, squares, pentagons and pyramids, and learn the formulas and theorems that these shapes reveal.

Key takeaways

  • The n-th triangular number is n(n + 1)/2, the sum of the whole numbers from 1 to n.
  • Two neighboring triangular numbers add to a perfect square, which a single diagonal cut of a dot square shows.
  • A general formula covers polygons with any number of sides s.
  • Every positive whole number is a sum of at most three triangular numbers and at most four squares.
  • Stacking flat figurate numbers produces pyramidal numbers, including the tetrahedral numbers found in Pascal's triangle.

Figurate numbers are counts of dots arranged in regular geometric patterns. Triangles of dots give 1, 3, 6, 10, 15. Squares give 1, 4, 9, 16, 25. Pentagons, hexagons and three-dimensional pyramids give further families, each with a simple formula.

The appeal is that you can often see why a statement about numbers is true by rearranging pebbles. Greek mathematicians in the Pythagorean tradition worked this way, and some of the questions that grew out of these pictures occupied Fermat, Euler, Gauss and Cauchy.

Triangular numbers

Put one dot in the first row, two in the second, three in the third, and keep going to n rows. The total is the n-th triangular number, written Tₙ.

Tₙ = 1 + 2 + 3 + ... + n = n(n + 1)/2

To see the formula, make a second copy of the triangle, turn it upside down and fit it against the first. Together they form a rectangle of n rows and n + 1 columns. One triangle is half of that.

So T₄ = 4 × 5 / 2 = 10, the arrangement of bowling pins, and T₁₀₀ = 5050. Triangular numbers also count pairs: in a room of 8 people, if everyone shakes hands once with everyone else, there are T₇ = 28 handshakes.

To test whether a number N is triangular, compute 8N + 1 and check whether it is a perfect square. For N = 28 you get 225 = 15², so yes. For N = 30 you get 241, which is not a square.

Squares and the odd numbers

A square of side n holds n² dots. Build it up from a single dot by adding L-shaped borders along two sides. Each border has two more dots than the one before, so the borders contain 1, 3, 5, 7 and so on.

That picture proves that the sum of the first n odd numbers is n². For n = 4: 1 + 3 + 5 + 7 = 16.

Now draw a diagonal staircase through a square of side n. One piece is a triangle with n rows, and the other is a triangle with n − 1 rows. Therefore

Tₙ + Tₙ₋₁ = n²

For example, 15 + 10 = 25. A second picture surrounds one central dot with eight triangles to form a larger square: 8Tₙ + 1 = (2n + 1)². That is the identity behind the test above.

Arguments like these are the subject of proofs without words. A picture drawn for n = 4 persuades because you can see that nothing in it depends on 4.

Pentagons, hexagons and any polygon

Pentagonal numbers come from nested pentagons that share a corner: 1, 5, 12, 22, 35. Hexagonal numbers are 1, 6, 15, 28, 45. For a polygon with s sides, the n-th number is

P(s, n) = ((s − 2)n² − (s − 4)n) / 2
Shape s Formula First five
Triangle 3 n(n + 1)/2 1, 3, 6, 10, 15
Square 4 n² 1, 4, 9, 16, 25
Pentagon 5 n(3n − 1)/2 1, 5, 12, 22, 35
Hexagon 6 n(2n − 1) 1, 6, 15, 28, 45

Notice that hexagonal numbers are every other triangular number. The formula n(2n − 1) is exactly the triangular number with 2n − 1 rows.

Each family can also be cut into triangles. The n-th s-gonal number equals n + (s − 2)Tₙ₋₁. For a pentagon with n = 4, that is 4 + 3 × 6 = 22.

Flat and solid figurate numbers
Flat shapes Triangular: n(n + 1)/2 Square: n² Pentagonal: n(3n − 1)/2 Hexagonal: n(2n − 1) Stacked shapes Tetrahedral: n(n + 1)(n + 2)/6 Square pyramid: n(n + 1)(2n + 1)/6 Each layer is a flat figurate number Cubes: n³ VS Flat shapes Triangular: n(n + 1)/2 Square: n² Pentagonal: n(3n − 1)/2 Hexagonal: n(2n − 1) Stacked shapes Tetrahedral: n(n + 1)(n + 2)/6 Square pyramid: n(n + 1)(2n + 1)/6 Each layer is a flat figurate number Cubes: n³

Finding a formula from differences

Suppose you have only the dot counts and want the formula. Subtract each term from the next, then subtract again. For the pentagonal numbers:

terms:                 1    5    12    22    35
first differences:       4    7     10    13
second differences:        3     3     3

A constant second difference means the formula is a quadratic, an² + bn + c. The coefficient a is half the second difference, so a = 3/2.

n = 1:   3/2 + b + c = 1
n = 2:   6 + 2b + c = 5
subtract the first from the second:   9/2 + b = 4,  so b = −1/2
then c = 1 − 3/2 + 1/2 = 0
formula: (3n² − n)/2 = n(3n − 1)/2

For every polygon family the second difference equals s − 2, the number of new sides' worth of growth added at each layer. Triangles give 1, squares 2, pentagons 3, hexagons 4.

Three-dimensional families have constant third differences and cubic formulas. The tetrahedral numbers 1, 4, 10, 20, 35 have differences 3, 6, 10, 15, then 3, 4, 5, then 1, 1. More about the method appears in recurrence relations, where the same differences are treated as equations.

One caution applies. Differences find the polynomial that fits the terms you supplied. They cannot promise that the next dot picture follows it unless you know how each layer is constructed.

Centered figurate numbers

A different family starts with a single dot and wraps complete rings around it. Centered hexagonal numbers run 1, 7, 19, 37, 61, with each ring adding six more dots than the one before.

The formula is 3n(n − 1) + 1, which is 1 plus six triangles. These numbers describe how circles of equal size pack in hexagonal rings, as in a bundle of round cables.

They also satisfy a pleasing identity: the sum of the first n centered hexagonal numbers is n³. For n = 3, 1 + 7 + 19 = 27. The picture is a cube viewed corner-on, peeled into three-faced shells.

Numbers that are two shapes at once

Some numbers belong to two families. The number 36 is both T₈ and 6². The next such numbers are 1225 (T₄₉ = 35²) and 41616 (T₂₈₈ = 204²).

Setting Tₙ = k² and using the 8N + 1 identity gives (2n + 1)² − 8k² = 1. This is a case of Pell's equation, which has infinitely many whole-number solutions. So there are infinitely many square triangular numbers, though they thin out fast.

Every even perfect number is triangular as well: 6 = T₃, 28 = T₇, 496 = T₃₁. This follows from the shape of Euclid's formula described in perfect numbers and Mersenne primes.

Fermat's polygonal number theorem

How many figurate numbers of one type do you need to make any positive whole number? Fermat asserted that s numbers of the s-gonal family always suffice.

  • For triangles, at most three. Gauss proved this in 1796 and recorded it in his diary with the word "Eureka".
  • For squares, at most four. Lagrange proved this in 1770, as explained in Lagrange's four-square theorem.
  • For all larger s, at most s. Cauchy completed the general proof in the early nineteenth century.

As an example with triangles, 20 = 10 + 10. With squares, 23 = 9 + 9 + 4 + 1, and no three squares will do.

Into three dimensions

Stack triangles of balls, with the largest at the bottom, and you get tetrahedral numbers: 1, 4, 10, 20, 35. Each is the sum of the first n triangular numbers, and the formula is n(n + 1)(n + 2)/6.

Stack squares instead and you get square pyramidal numbers: 1, 5, 14, 30, 55, with formula n(n + 1)(2n + 1)/6. These count the cannonballs in a square pile.

A well-known puzzle asks when such a pile can be rearranged into a flat square. Apart from the trivial single ball, the only case is 24 layers, containing 4900 balls, a square of side 70. The proof that no others exist is much harder than the puzzle suggests.

Cubes bring one more identity, often credited to the tradition of Nicomachus:

1³ + 2³ + 3³ + ... + n³ = Tₙ²
Check n = 4:  1 + 8 + 27 + 64 = 100 = 10²

Pentagonal numbers and partitions

Extend the pentagonal formula n(3n − 1)/2 to n = 0, −1, 2, −2 and so on. You obtain the generalized pentagonal numbers 0, 1, 2, 5, 7, 12, 15.

These have no neat dot picture for negative n, yet they control something quite different: the number of ways to write a whole number as a sum of smaller ones. Euler's discovery gives a fast recursion, covered in integer partitions.

It is a good example of how a family that starts as a toy with pebbles turns out to sit inside serious theory.

Problems to work

  1. Find two triangular numbers whose sum and difference are both triangular. Try 15 and 21: the sum is 36 = T₈ and the difference is 6 = T₃.
  2. Show that nine times a triangular number, plus 1, is again triangular. Check small cases first: 9 × 1 + 1 = 10 and 9 × 3 + 1 = 28. Then substitute n(n + 1)/2 and look for the row number 3n + 1.
  3. Which last digits can a triangular number have? List the first twenty and see.

For the last one, only 0, 1, 3, 5, 6 and 8 occur. Since the final digit of Tₙ repeats with period 20 in n, checking twenty cases is a complete proof.

Adding up reciprocals

Figurate numbers also make friendly infinite sums. The reciprocals of the triangular numbers are 1, 1/3, 1/6, 1/10 and so on, and their total is exactly 2.

The trick is to split each term into a difference:

1/Tₙ = 2/(n(n + 1)) = 2/n − 2/(n + 1)
sum of the first N terms = 2 − 2/(N + 1)

All the middle pieces cancel, a pattern called a telescoping sum. As N grows, 2/(N + 1) shrinks to zero, leaving 2.

The reciprocals of the squares add to a very different kind of number, π²/6. Both series converge, but only the triangular one gives way to elementary cancellation. A small change of shape can turn a one-line exercise into a problem that resisted mathematicians for decades before Euler solved it.

A common mistake

Pictures suggest formulas, but a few terms never settle which formula is right. The sequence 1, 3, 6 could continue 10 (triangular numbers) or 11 under another rule. Tie your formula to the way each new layer is built, then confirm it by induction or by an argument that works for every n.

Written for 4Mathematics with AI writing tools and not reviewed line by line by a person. Check anything you rely on against a textbook or primary source. Report an error.

Keep reading

All 59 articles in Number Theory →

Latest news on this topic