Pascal's Triangle Generator

Choose how many rows of Pascal's triangle to generate.

Result

1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1
21 elements
10

How it is calculated

You choose the number of rows, and the tool builds Pascal's triangle one row at a time with whole-number addition. Row 0 is just 1. Every later row starts and ends with 1, and each middle entry is the sum of the two entries above it: T(r, k) = T(r−1, k−1) + T(r−1, k). The entries of row n are the binomial coefficients C(n, k), which count the ways to choose k items from n. The tool prints the rows, then the total number of entries, rows × (rows + 1) ÷ 2, and the largest value in the last row. The row count must be a whole number from 1 to 25; a decimal such as 6.4, or a value outside that range, gives no result. Because only integers are used, there is no rounding error.

Worked example

Ask for 6 rows. Row 1 is 1. Row 2 is 1 1. Row 3 is 1 2 1. Row 4: 1, then 1+2 = 3, 2+1 = 3, then 1, giving 1 3 3 1. Row 5 is 1 4 6 4 1. Row 6 is 1 5 10 10 5 1, where 5 = 1+4, 10 = 4+6 and 10 = 6+4. The total number of entries is 6 × 7 ÷ 2 = 21, so the tool reports 21 elements. The largest value in the last row is 10, which equals C(5, 2), the number of ways to choose 2 items from 5.

Try this example →

Common mistakes

  • Treating the first row you see as row 1 in binomial formulas. The tool's first line is row 0 in math terms, C(0, 0), so its sixth line is the row for n = 5.
  • Asking for more than 25 rows. The tool stops at 25 and returns nothing above that, to keep the numbers readable.
  • Entering a decimal such as 4.6 and expecting it to be rounded to 5 rows: the tool gives no result, so enter a whole number of rows.
  • Reading the total number of elements as the sum of the values. It counts the entries (21 for 6 rows), while the sum of row n is 2n.
  • Using the triangle to expand (x + y)n with the wrong row. For the power n, take the line with n + 1 numbers, such as 1 3 3 1 for the cube.

Sources

About this calculator

Pascal's triangle is a triangular array of numbers where each entry is the sum of the two directly above it, starting from a single 1 at the top — the values in each row are exactly the binomial coefficients C(n,k), the number of ways to choose k items from a set of n. This generator builds any number of rows using exact integer arithmetic, so the values stay precise even for large row counts where floating-point rounding would otherwise creep in.

The triangle is a core teaching tool in combinatorics and algebra, used to expand binomials like (x+y)^n without multiplying term by term, to read off combination counts directly, and to illustrate patterns in number theory such as powers of 11, triangular numbers, and connections to the Fibonacci sequence found along its diagonals.

Was this helpful?

You can pick up to 3 reactions.

Note from the editors

Beyond binomials, the rows hide other patterns you can spot-check against the output. The second diagonal counts 1, 2, 3, 4, and the third lists triangular numbers: 1, 3, 6, 10. Row 25 is the largest this tool prints, with a middle value of 2,704,156, so it is useful for checking combination counts such as C(24, 12). Which pattern in the triangle would you like to see highlighted next?

Comments

  • Be the first to comment.

Popular calculators

All Calculators