Open In App

Catalan Numbers

Last Updated : 30 Jun, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Catalan numbers are a sequence of natural numbers that appear in various counting problems, often related to recursive structures. They are named after the French-Belgian mathematician Eugène Charles Catalan.

These numbers have applications in combinatorial mathematics, such as counting paths, tree structures, and polygon triangulations.

Some examples of Catalan numbers are:

1, 2, 5, 14, 42, 132, 429, 4862, 16796, .....,

Formula for Catalan Numbers

The n-th Catalan number Cncan be calculated using the following formula:

C_n = \frac{(2n)!}{(n+1)!n!}

Where n is a non-negative integer, and the factorial symbol "!" represents the product of all positive integers less than or equal to that number.

Alternatively, you can use the binomial coefficient:

C_n = \frac{1}{n+1} \binom{2n}{n}

Catalan Numbers Examples

Let's calculate the first few Catalan numbers:

  • C_0 = \frac{(2 \times 0)!}{(0+1)!0!} = \frac{1}{1} = 1
  • C_1 = \frac{(2 \times 1)!}{(1+1)!1!} = \frac{2}{2} = 1
  • C_2 = \frac{(2 \times 2)!}{(2+1)!2!} = \frac{24}{6 \times 2} = 2
  • C_3 = \frac{(2 \times 3)!}{(3+1)!3!} = \frac{720}{24 \times 6} = 5
So, the first few Catalan numbers are: 1, 1, 2, 5, 14, 42, ….,

Applications of Catalan Numbers

Catalan numbers arise in several combinatorial problems, including:

  • Parenthesization: The number of ways to correctly parenthesize n + 1 factors (e.g., for multiplying expressions like (a⋅b)⋅(c⋅d))
  • Binary Trees: The number of distinct binary trees with n internal nodes.
  • Triangulations: The number of ways to triangulate a polygon with n + 2 sides.
  • Paths: The number of paths along the edges of a grid that do not pass above the main diagonal.

➣ Read in detail - Applications of Catalan Numbers

Read More:

Solved Questions on Catalan Numbers

Question 1. How many valid parentheses, expressions can be formed with 4 pairs of parentheses?

Solution:

The number of valid parenthesis expressions for nnn pairs of parentheses is given by the nnn-th Catalan number, C_n

The formula for the n-th Catalan number is:

C_n = \frac{1}{n+1} \binom{2n}{n} = \frac{(2n)!}{(n+1)!n!}

For 4 pairs of parentheses, n = 4.

C_4 = \frac{1}{4+1} \binom{8}{4} = \frac{1}{5} \times \frac{8 \times 7 \times 6 \times 5}{4 \times 3 \times 2 \times 1} = \frac{1}{5} \times 70 = 14

So, there are 14 valid parenthesis expressions that can be formed with 4 pairs of parentheses.

Question 2. How many distinct binary search trees can be formed with 3 nodes?

Solution:

The number of distinct binary search trees (BSTs) that can be formed with n nodes is the n-th Catalan number.

For n = 3, we can use the Catalan number formula to find the solution.

C_3 = \frac{1}{3+1} \binom{6}{3} = \frac{1}{4} \times \frac{6 \times 5 \times 4}{3 \times 2 \times 1} = \frac{1}{4} \times 20 = 5

Thus, there are 5 distinct binary search trees that can be formed with 3 nodes.

Conclusion

Catalan numbers are crucial in combinatorics and appear in a wide range of mathematical problems. Whether calculating tree structures, path counting, or polygon triangulation, understanding how to derive and apply Catalan numbers is essential for tackling more advanced mathematical and computational tasks.

Practice Problems Based on Catalan Numbers

Question 1. Find the 5th Catalan number?
Question 2. How many distinct binary search trees can be formed with 4 nodes?
Question 3. Calculate the 3rd Catalan number?
Question 4. How many valid parentheses expressions can be formed with 2 pairs of parentheses?

Answer:-

1) 42
2) 14
3) 5
4) 2


Next Article
Article Tags :

Similar Reads