MathsDiscrete Math

Pascal's Triangle
calculator.

Look up any entry of Pascal's triangle exactly, or use a row to expand (a + b)ⁿ.

How it's worked out

The triangle starts with a single 1 at the top, called row 0. Every row begins and ends with 1. Every other number is the sum of the two numbers just above it. Count rows and positions from 0, so row 4 reads 1, 4, 6, 4, 1 and its entry at position 2 is 6.

(nk)\displaystyle \binom{n}{k}=(n−1k−1)+(n−1k)\displaystyle {}= \binom{n-1}{k-1} + \binom{n-1}{k}

That sum is Pascal's rule, and the entry in row n at position k is the binomial coefficient C(n, k). It counts the ways to choose k items from n when order does not matter. You can also compute it directly, without building the rows above. For row 7 the rule gives 15 + 20 = 35 at position 3.

(nk)\displaystyle \binom{n}{k}=n!k!(n−k)!\displaystyle {}= \frac{n!}{k!\,(n-k)!}

The tool cancels the larger factorial first and works in exact whole numbers, so no entry is ever rounded. It shows the entry, the two entries above it, and every digit, for rows up to 5,000.

Expanding a binomial. The binomial theorem takes its coefficients from row n. The power of a falls from n to 0 while the power of b rises from 0 to n, and every term has powers adding up to n. When a term carries its own number, such as 2x or −3, that number is raised to the same power and multiplied in.

(a+b)n\displaystyle (a+b)^{n}=∑k=0n(nk)an−kbk\displaystyle {}= \sum_{k=0}^{n} \binom{n}{k} a^{n-k} b^{k}

Worked examples

Jo counts the tickets in a 6 of 49 lottery

A ticket picks 6 numbers from 49, and the order of the draw does not matter. So the count is the entry in row 49 at position 6: 13,983,816 different tickets.

One ticket wins the jackpot, so its chance is 1 in 13,983,816. The two entries above it in row 48 are 1,712,304 and 12,271,512. They split the tickets into those that use the number 49 and those that do not.

Open this example in the tool

Sam expands (2x − 3)³ for homework

Row 3 is 1, 3, 3, 1. Sam multiplies each coefficient by a power of 2x falling from 3 and a power of −3 rising from 0. The negative second term makes the signs alternate.

(2x−3)3\displaystyle (2x-3)^{3}=8x3−36x2+54x−27\displaystyle {}= 8x^{3} - 36x^{2} + 54x - 27

To check, Sam sets x = 1. The coefficients add up to −1, and (2 − 3)³ is also −1, so no sign has slipped.

Open this example in the tool

Ten coin flips and exactly five heads

Ten flips give 1,024 equally likely sequences of heads and tails, which is the sum of row 10. The entry at position 5 counts the sequences with exactly five heads: 252 of them.

So the chance of exactly five heads is 252 out of 1,024, a little under one in four. Four heads is less likely, with 210 sequences, and every entry of the row is at most the middle one.

Open this example in the tool

Reading your result

Row sums are powers of 2. Set a = b = 1 in the binomial theorem and you get the sum of row n, which is 2ⁿ. Row 5 is 1, 5, 10, 10, 5, 1, and it adds up to 32. In counting terms, row n lists how many subsets of each size an n-item set has.

Odd entries draw a fractal. Shade only the odd entries and the drawing becomes the Sierpiński triangle. James Glaisher showed in 1899 that row n has 2ˢ odd entries, where s is the count of 1s in n written in binary (OEIS A001316). Row 15 has 16 odd entries, all of them, while row 16 has only 2.

Big rows get big fast. The middle of row 100 is 1.0089 × 10²⁹, a 30-digit number. The tool keeps every digit, so you can use the entry in further exact sums.

Past the end means 0. Asking for position 7 in row 5 gives 0, because you cannot choose 7 items from 5. Positions run from 0 to n, and the row reads the same from both ends.

Common mistakes

  • Counting rows from 1. The top 1 is row 0, so (a + b)⁴ uses the row 1, 4, 6, 4, 1. Starting at row 1 gives the coefficients of the wrong power.
  • Forgetting the number inside a term. In (2x − 3)³ the 2 and the −3 are raised to powers too. Using only 1, 3, 3, 1 as the coefficients drops them.
  • Losing the minus signs. With a negative second term, every odd power of it is negative, so the signs alternate. Setting x = 1 and comparing with (A + B)ⁿ catches a slip.
  • Mixing up the position. The entry at position k pairs with the power k of the second term. Row 4 read from the left is 1, 4, 6, 4, 1, and position 0 is the first 1.

Questions people ask

Yes. Each entry follows from the one before it: multiply by n − k and divide by k + 1, which always divides exactly. The tool builds row n this way, so even row 5,000 does not need the 4,999 rows above it.

Sources