Math Tools Math Tools

Triangular Numbers, Square Numbers, and Other Figurate Numbers

Triangular Numbers, Square Numbers, and Other Figurate Numbers

By Math Tools ·

Triangular Numbers, Square Numbers, and Other Figurate Numbers

On July 10, 1796, a 19-year-old Carl Friedrich Gauss wrote a single line in his mathematical diary:

ΕΥΡΗΚΑ!  num = Δ + Δ + Δ

"Eureka! Every number is the sum of three triangular numbers." For instance, 10 = 6 + 3 + 1 and 25 = 15 + 10 + 0. He'd proved a claim Pierre de Fermat made more than 150 years earlier without proof.

Triangular numbers belong to a family called figurate numbers: numbers you can arrange as dots in regular shapes. They're some of the oldest ideas in mathematics, and they make hidden patterns in arithmetic visible.


You Can Prove Algebra With Pebbles

Before algebra had symbols, the Pythagoreans in ancient Greece reasoned with arrangements of pebbles. Many facts that take lines of algebra can be "seen" at a glance with dots.

For example, why is the sum of the first n odd numbers always a perfect square?

1 + 3 + 5 + 7 = 16 = 4²

Picture a square of dots. Each new odd number adds an L-shaped layer around the previous square: 1 dot, then 3 more to make 2 × 2, then 5 more to make 3 × 3. No algebra needed.


Triangular Numbers

A triangular number counts the dots in a triangle with rows of 1, 2, 3, …, n:

•      •       •        •
      • •     • •      • •
             • • •    • • •
                     • • • •
1      3       6       10

The formula:

Tₙ = 1 + 2 + … + n = n(n + 1) / 2

The sequence begins 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, …

A famous story tells how the young Gauss, when his teacher asked the class to add the numbers from 1 to 100, answered almost instantly: pair 1 with 100, 2 with 99, and so on, giving 50 pairs of 101. The total is 5,050, which is T₁₀₀. See 5050 and 55.

Triangular numbers count handshakes too: if n + 1 people all shake hands, there are Tₙ handshakes.


Square Numbers

Square numbers fill a square grid: 1, 4, 9, 16, 25, 36, …

Sₙ = n²

Two beautiful connections to triangular numbers:

  • Two consecutive triangular numbers make a square: Tₙ₋₁ + Tₙ = n². For example, 6 + 10 = 16. Cut a square of dots along its diagonal to see it.
  • 8 × (triangular) + 1 is always a square: 8Tₙ + 1 = (2n + 1)². Try 8 × 10 + 1 = 81 = 9².

Some numbers are both: 36 is the 6th square and the 8th triangular number. The next is 1,225. Browse the square numbers list and see 36.


Pentagonal, Hexagonal and Beyond

The pattern generalizes to any polygon with k sides. The formula for the nth k-gonal number is:

P(k, n) = ((k − 2)n² − (k − 4)n) / 2
Shape k Formula Sequence
Triangular 3 n(n + 1)/2 1, 3, 6, 10, 15
Square 4 1, 4, 9, 16, 25
Pentagonal 5 n(3n − 1)/2 1, 5, 12, 22, 35
Hexagonal 6 n(2n − 1) 1, 6, 15, 28, 45

Notice that every hexagonal number is also triangular: 6, 15, 28, 45 all appear in the triangular list.


Going 3D: Cubes and Pyramids

Figurate numbers extend into three dimensions:

  • Cube numbers: 1, 8, 27, 64, 125, … (n³)
  • Tetrahedral numbers: stacking triangular layers, 1, 4, 10, 20, 35, … = n(n + 1)(n + 2)/6
  • Square pyramidal numbers: stacking square layers, 1, 5, 14, 30, 55, …, like a pyramid of cannonballs

And a remarkable identity links cubes back to triangles:

1³ + 2³ + … + n³ = (1 + 2 + … + n)² = Tₙ²

For n = 4: 1 + 8 + 27 + 64 = 100 = 10². See the cube numbers list.


An Insider Reference: Fermat's Polygonal Number Theorem

In 1638, Pierre de Fermat claimed that every positive integer is the sum of at most:

  • 3 triangular numbers
  • 4 square numbers
  • 5 pentagonal numbers
  • and in general, k k-gonal numbers

As usual, Fermat gave no proof. The pieces came slowly:

  • 1770: Joseph-Louis Lagrange proved the four-square case
  • 1796: Gauss proved the triangular case (the "EUREKA" entry)
  • 1813: Augustin-Louis Cauchy proved the full theorem

It took 175 years to confirm a claim written in a margin. Read more about Fermat in our post on Pierre de Fermat.


Two Concepts Worth Knowing

Arithmetic Series

A sum like 1 + 2 + … + n, where terms increase by a constant, is an arithmetic series. Its sum is the number of terms times the average of the first and last: n(1 + n)/2. See the algebra formulas.

Proof Without Words

A proof without words uses a picture to make a mathematical fact obvious. Figurate numbers are the classic source of these, from odd numbers forming squares to triangles forming squares.


Quick Answer: What Are Figurate Numbers?

Figurate numbers count dots arranged in regular geometric shapes. Triangular numbers (1, 3, 6, 10, …) follow n(n + 1)/2, square numbers (1, 4, 9, 16, …) follow n², and pentagonal numbers (1, 5, 12, 22, …) follow n(3n − 1)/2. Every positive integer is the sum of at most three triangular numbers.


Try Them Yourself

Write your age as a sum of three triangular numbers. Gauss guarantees it's possible; see how many different ways you can find.