Consider these two problems. First: using n opening parentheses "(" and n closing parentheses ")", how many ways are there to arrange them so that, at no point, are there more closing parentheses than opening ones? Second: how many ways are there to split a convex (n+2)-gon with diagonals so that every piece is a triangle? These look like completely unrelated problems, yet remarkably, the answer to both is exactly the same sequence: 1, 1, 2, 5, 14, 42, 132… These numbers are called Catalan numbers.

Catalan numbers are given by the formula Cn = (2n)! / ((n+1)! × n!). Plugging in n=0, 1, 2… gives C0=1, C1=1, C2=2, C3=5, C4=14, C5=42, and so on. For example, the valid arrangements you can make with 3 pairs of parentheses are ((())), (()()), (())(), ()(()), and ()()() — exactly 5 of them.

But count the ways to split a pentagon (5-gon) with diagonals into all triangles, and you also get exactly 5. That's no coincidence. A pentagon splits into 3 triangles with 2 diagonals, and since it's an (n+2)-gon with n=3, this matches C3=5 exactly. Both the parentheses problem and the polygon problem share the same underlying structure — "the number of ways to recursively split something into two pieces."

There are 5 ways to split a pentagon into 3 triangles with 2 diagonals — exactly matching the number of ways to match 3 pairs of parentheses

Mathematicians describe this seemingly coincidental match by saying "there's a bijection" between the two problems — meaning the answers to both problems can be paired up one-to-one. If you think of each parenthesis as corresponding to a diagonal of the polygon, and the nesting structure of the parentheses as the order in which triangles attach, the two problems map onto each other in exactly the same way. Even the number of distinct shapes for a binary tree with n nodes (a tree structure where each node has at most a left and a right child) comes out to the same Cn.

Catalan numbers are named after the Belgian mathematician Eugène Catalan, but they were actually studied earlier and independently by Switzerland's Leonhard Euler and Mongolia's Mingantu. These numbers turn up in more than 200 different known combinatorics problems, hiding in all sorts of corners of mathematics.

On our activity page, you can change n and see exactly how each Catalan number is calculated, and list out every valid parenthesis arrangement to count them with your own eyes. You can also flip through every triangulation of a polygon, one by one, to confirm for yourself that the two problems' answers really do grow in exactly the same way.