🧮
🧮 Math & statistics

Pascal’s Triangle Generator

Results update as you type.

Your numbers

Understanding the Pascal's triangle generator — concept and principle

Pascal's triangle is a triangular array of whole numbers in which each number is the sum of the two numbers directly above it. This generator prints row n (the row you enter) and every row from 0 up to n. The rows give the binomial coefficients C(n, k), so the triangle is used to expand brackets such as (x + y)ⁿ, to count combinations, and to work out binomial probabilities. You can generate up to 40 rows.

Pascal’s triangle up to row 8Rows 0 to 8; row 8 is 1 8 28 56 70 56 28 8 1, and 70 comes from 35 + 35.Each number = sum of the two above11112113311464115101051161520156117213535217118285670562881← row 0row 535 + 35 = 70 = C(8, 4) · row 8 sums to 256
Row 8 (gold) is 1 8 28 56 70 56 28 8 1; every entry is C(n, k).

How it is calculated

The principle

The addition rule has a counting explanation. To choose k items from n, look at one particular item. Either you include it, and then choose k − 1 more from the remaining n − 1, or you leave it out and choose all k from the remaining n − 1. These two cases do not overlap, so their counts add. The same idea explains why row n gives the coefficients of (x + y)ⁿ: multiplying (x + y)ⁿ⁻¹ by (x + y) adds each coefficient to its neighbour.

Worked example

  1. Default input: Rows = 8.
  2. Start with row 0: 1. Row 1: 1 1. Row 2: 1 2 1. Row 3: 1 3 3 1.
  3. Keep adding neighbours: row 4 is 1 4 6 4 1, row 5 is 1 5 10 10 5 1, row 6 is 1 6 15 20 15 6 1, row 7 is 1 7 21 35 35 21 7 1.
  4. Row 8: 1, 1+7 = 8, 7+21 = 28, 21+35 = 56, 35+35 = 70, then the mirror image.
  5. Result: 1 8 28 56 70 56 28 8 1. Check one entry directly: C(8, 4) = 40320 ÷ (24 × 24) = 70.

How to read the result

The k-th number in row n (counting from 0) is the number of ways to pick k items from n. For example, 56 in row 8 means there are 56 ways to pick 3 people out of 8. Each row is symmetric because choosing k items is the same as leaving out n − k. The row adds up to 2ⁿ; row 8 sums to 256, the number of subsets of 8 items. The middle entries are the largest.

Common mistakes

Keep in mind: The generator stops at row 40, whose largest entry C(40, 20) = 137,846,528,820 is still exact. Past about row 56 the middle entries exceed 9 × 10¹⁵, the largest integer ordinary floating-point arithmetic stores exactly, so other tools may show them rounded.

Frequently asked questions

Why is it called Pascal's triangle?

Blaise Pascal studied it in his Traité du triangle arithmétique (published 1665), but the triangle was known much earlier in China, India and Persia.

What patterns are hidden in the triangle?

The diagonals give the natural numbers and the triangular numbers, and colouring the odd entries produces the Sierpiński triangle.

How do I use it to expand (x + y)⁵?

Take row 5, 1 5 10 10 5 1: x⁵ + 5x⁴y + 10x³y² + 10x²y³ + 5xy⁴ + y⁵.

Sources: NIST Digital Library of Mathematical Functions, §26.3 (dlmf.nist.gov) · Pascal, B., Traité du triangle arithmétique (1665)

Checked 8 Nov 2026. Standard formulas, computed in your browser with double-precision numbers.

🧮 All math & statistics tools →🌍 Calculators by country →