Pascal's Triangle Generator

Build Pascal's triangle row by row — every number is the sum of the two above it. See row sums, binomial coefficients, and the hidden diagonals explained.

Loading calculator…

How to use this calculator

Type how many rows you want (row 0 through row n − 1) and the calculator builds the triangle by the same additive rule Pascal used: start each row with 1, end it with 1, and fill every spot in between by adding the two numbers sitting directly above it. The answer band shows the last row you asked for, along with its total.

Tip: Building each cell as a sum — never by directly computing a binomial coefficient — is the whole point of Pascal's triangle. The combinatorics identity (nk)=(n1k1)+(n1k)\binom{n}{k} = \binom{n-1}{k-1} + \binom{n-1}{k} falls out of that addition rule for free.

The build rule

Row 0 is just 1. Every later row keeps 1 at both ends, and each interior entry is the sum of the two entries above it:

(nk)=(n1k1)+(n1k)\binom{n}{k} = \binom{n-1}{k-1} + \binom{n-1}{k}

Six rows built this way look like:

Row 0:            1
Row 1:          1   1
Row 2:        1   2   1
Row 3:      1   3   3   1
Row 4:    1   4   6   4   1
Row 5:  1   5  10  10   5   1

Check row 4's middle entry: 6=3+36 = 3 + 3, the sum of the two 3s directly above it in row 3.

Row n holds the binomial coefficients

Position kk of row nn (both counted from 0) equals (nk)=C(n,k)\binom{n}{k} = C(n, k) — the number of ways to choose kk items from a set of nn. Row 4 is (40),(41),(42),(43),(44)\binom{4}{0}, \binom{4}{1}, \binom{4}{2}, \binom{4}{3}, \binom{4}{4}, which works out to 1, 4, 6, 4, 1. That is also why every row is symmetric: (nk)=(nnk)\binom{n}{k} = \binom{n}{n-k}.

Row sums double every time

Add up any row and you get a power of two: row 4 sums to 1+4+6+4+1=16=241 + 4 + 6 + 4 + 1 = 16 = 2^4. Each entry of a row feeds into forming two entries of the next row (one to the left, one to the right), so the row total exactly doubles at every step, starting from row 0's total of 1.

Binomial expansion

The same numbers are the coefficients when you expand (a+b)n(a + b)^n. Row 2 gives 1, 2, 1, matching (a+b)2=a2+2ab+b2(a+b)^2 = a^2 + 2ab + b^2. Row 3 gives 1, 3, 3, 1, matching (a+b)3=a3+3a2b+3ab2+b3(a+b)^3 = a^3 + 3a^2b + 3ab^2 + b^3 — the reason this triangle shows up constantly in algebra and probability.

Hidden diagonals

Reading the triangle along its diagonals uncovers other famous sequences:

DiagonalValuesSequence
1st (edge)1, 1, 1, 1, …constant
2nd1, 2, 3, 4, …natural numbers
3rd1, 3, 6, 10, …triangular numbers
shallow (up-right)sums to 1, 1, 2, 3, 5, 8, …Fibonacci numbers

That last one is the neatest: summing entries along a shallow diagonal — one step left, one step up, repeated — reproduces the Fibonacci sequence, tying this triangle directly to the golden-ratio family of calculators.

Worked example — 6 rows

  1. Row 0: 1.
  2. Row 1: edges are 1, so 1 1.
  3. Row 2: edges 1, interior 1+1=21 + 1 = 21 2 1.
  4. Row 3: edges 1, interior 1+2=31+2=3 and 2+1=32+1=31 3 3 1.
  5. Row 4: edges 1, interior 1+3=41+3=4, 3+3=63+3=6, 3+1=43+1=41 4 6 4 1.
  6. Row 5: edges 1, interior 1+4=51+4=5, 4+6=104+6=10, 6+4=106+4=10, 4+1=54+1=51 5 10 10 5 1, summing to 32=2532 = 2^5.

Frequently asked questions

What is Pascal's triangle?
Pascal's triangle is a triangular array of numbers where each row starts and ends with 1, and every interior number is the sum of the two numbers directly above it. Row nn (counting from 0) holds the binomial coefficients (n0)\binom{n}{0} through (nn)\binom{n}{n}.
How do you build Pascal's triangle?
Start row 0 with a single 1. To build the next row, put a 1 at each end, then fill every interior spot by adding the two numbers directly above it. Repeating this rule row after row generates the whole triangle.
What is the connection between Pascal's triangle and binomial coefficients?
The kk-th entry (from 0) of row nn equals (nk)=C(n,k)\binom{n}{k} = C(n,k), the number of ways to choose kk items from nn. Row 4 is 1, 4, 6, 4, 1 — exactly (40)\binom{4}{0} through (44)\binom{4}{4}.
Why does every row sum to a power of two?
Each entry in row n+1n+1 is used in forming two entries of row n+1n+1 from row nn (once for the spot to its left-below, once for the spot to its right-below), so the total doubles every row. Row 0 sums to 1, so row nn sums to 2n2^n.
What are the diagonals of Pascal's triangle?
The outermost diagonal is all 1s. The next diagonal in is the natural numbers 1, 2, 3, 4, …. The third diagonal holds the triangular numbers 1, 3, 6, 10, …. Shallow diagonals (running up-right at a gentle slope) sum to the Fibonacci numbers.
How is Pascal's triangle related to the Fibonacci sequence?
Adding the entries along a shallow diagonal — one step left and one step up, repeated — produces the Fibonacci sequence. For example the diagonal through row 4's 1, row 3's 3, and row 2's 1 sums to 5, the next Fibonacci number after 3.
Did Pascal invent this triangle?
No — versions of the triangle were known centuries earlier in India, Persia, and China. Blaise Pascal's 1654 treatise organized and popularized its properties in the West, which is why it carries his name today.
How many rows can this calculator build?
Up to 30 rows. Row 29 already has 30 entries and a row sum of 2292^{29} (over 536 million), which is plenty to see every pattern in the triangle clearly.

Related calculators