Lelifi·tools

Pascal's Triangle Calculator

Row 10 sums to 2 to the 10th power, or 1024 in total. The row reads 1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1, and the cell C(10, 3) = 120 counts the ways to pick 3 items from 10 when order does not matter.

Draw the first rows of the triangle, or look up a single cell by row n and position k. Both counts start at 0, so the top 1 is row 0, position 0, and the row you probably call row 8 is n = 8.

Print any row of Pascal's triangle, look up a single cell, and check the row sum, the two parents above it and the diagonals that run through it.

By the Lelifi editors ·

Key takeaways

Rows 0 through 6, each entry the sum of the two above it111121133114641151010511615201561Row n sums to 2^n: these seven rows add to 1, 2, 4, 8, 16, 32 and 64
The first seven rows of Pascal's triangle, with each entry equal to the sum of the two above it. The row totals double every line, from 1 at the top to 64 in row 6.
Row 10 as the heads count in 10 coin flipsEach bar is C(10, k), the number of the 1024 flip patterns that hold exactly k heads1104512021025221012045101k=0k=1k=2k=3k=4k=5k=6k=7k=8k=9k=10The middle cell C(10, 5) = 252 is the most likely outcome: 252 of 1024 patterns, or 24.6 percent.
Row 10 read as coin flips: C(10, k) counts how many of the 1024 possible head and tail patterns hold exactly k heads, peaking at 252 patterns for 5 heads.
On this page
  1. How the triangle is built, one addition at a time
  2. Reading row 8 entry by entry
  3. Row sums and the powers of 2
  4. The combination behind every cell
  5. Diagonals, hockey sticks and Fibonacci
  6. Coin flips, algebra and where the triangle shows up
  7. Prime rows and the pattern inside the divisors
  8. Big rows, exact arithmetic and the calculator's limits

How the triangle is built, one addition at a time

Start with a single 1 at the top, called row 0. Every row below it starts and ends with 1, and every entry in between is the sum of the two entries diagonally above it, one to the left and one to the right. Nothing else is involved: no multiplication, no factorials, one addition per cell.

The first eight rows show the pattern taking hold.

Row nEntriesRow sum
011
11, 12
21, 2, 14
31, 3, 3, 18
41, 4, 6, 4, 116
51, 5, 10, 10, 5, 132
61, 6, 15, 20, 15, 6, 164

The build-up is visible in row 8. Reading row 7 as 1, 7, 21, 35, 35, 21, 7, 1, the pairs above each new cell add like this: 7 + 21 = 28 and 21 + 35 = 56 and 35 + 35 = 70 in the middle. Those three sums are the inner entries of row 8, and the outer cells copy the 1s at the edges.

Because each row needs only the row above it, the triangle can be extended by hand for as long as patience lasts. The widget on this page stops at 20 rows, where the center cell is already 184,756, but the same one addition rule keeps going.

Reading row 8 entry by entry

Every entry has an address: row n, position k, both counted from 0. The middle of row 8 is written C(8, 4), and the letter C stands for combinations, the count of ways to choose k things from n when order does not matter.

Position kC(8, k)Where it comes from
011
181 + 7 = 8
2287 + 21 = 28
35621 + 35 = 56
47035 + 35 = 70
55635 + 21 = 56
62821 + 7 = 28
787 + 1 = 8
811

Read down the table and the symmetry jumps out: position 1 mirrors position 7, position 2 mirrors 6, and the middle stands alone. Choosing which 4 of 8 spots stay empty is the same decision as choosing which 4 are filled, so C(8, 2) and C(8, 6) both equal 28, and row 8 reads the same in either direction.

That mirror property holds in every row, which halves the work of filling one in: compute the left half and copy it to the right.

Row sums and the powers of 2

Add a row across and the total is always a power of 2. Row n sums to 2^n, one number doubled n times: row 8 adds to 2^8 = 256, row 10 to 1024, and row 20 to 1,048,576.

The reason is counting rather than luck. Walking down n rows means making n decisions, and each route through the triangle is one sequence of choices. Two options per step give 2^n routes into row n, and each cell records how many routes land there.

Compare the growth rates. The row total doubles with every new row, while the largest entry grows more slowly at first and then nearly as fast: the middle of row 20 is 184,756, about 18 percent of the row total. In row 30 the middle reaches 155,117,520 against a total above a billion.

The combination behind every cell

Row n, position k holds C(n, k), said aloud as n choose k. The formula multiplies k falling terms and divides by k factorial. For C(10, 3) the falling product is 10 × 9 × 8 = 720, the divisor is 3 × 2 × 1 = 6, and 720 ÷ 6 = 120. So there are 120 ways to pick 3 starters from a squad of 10, and position 3 of row 10 holds 120.

The widget multiplies and divides one term at a time instead of building a factorial, so it stays exact long past the point where a pocket calculator would fall back on scientific notation. C(52, 5), the number of five card poker hands, comes out as 2,598,960, and C(52, 26) prints all 15 digits, 495918532948104.

Symmetry saves half the table: C(n, k) always equals C(n, n minus k), because benching 7 of 10 players is the same decision as starting the other 3. That is why row 10 reads the same forwards and backwards, and why the calculator can look up position 7 by computing position 3.

Diagonals, hockey sticks and Fibonacci

The diagonals each carry a named sequence. The edge is all 1s. Next come the counting numbers 1, 2, 3, 4. The third diagonal holds the triangular numbers 1, 3, 6, 10, 15, which count handshakes in growing groups, and the fourth holds the tetrahedral numbers 1, 4, 10, 20, 35, which stack triangles into pyramids.

Shallow diagonals running up and to the right produce the Fibonacci numbers: 1, 1, 2, 3, 5, 8, 13, and onward, each the sum of the two shallow diagonals before it. MathWorld's entry on Pascal's triangle catalogs this and several dozen further patterns.

The hockey stick pattern is the one that looks like a mistake until it is checked. Run down a shallow diagonal and the running total lands one step below and across: adding the first four triangular numbers gives 1 + 3 + 6 + 10 = 20, and 20 sits exactly where the stick points, at C(6, 3). The Wikipedia article on the triangle sketches the proof, which is the addition rule applied over and over.

Coin flips, algebra and where the triangle shows up

Flip a fair coin 10 times. The 1024 possible patterns of heads and tails distribute along row 10, with C(10, k) counting the patterns that hold exactly k heads. The balanced result is the most common: C(10, 5) = 252 patterns, which is 252 ÷ 1024 = 0.2461, or 24.6 percent. All tails happens in 1 pattern, and at most 2 heads covers 1 + 10 + 45 = 56 patterns.

The same rows expand powers of a sum. Row 2 gives (a + b)^2 = a^2 + 2ab + b^2, and row 3 gives (a + b)^3 = a^3 + 3a^2b + 3ab^2 + b^3, with the coefficients 1, 3, 3, 1 sitting in the triangle. This is why the entries are also called binomial coefficients, and why a question about expanding a bracket and a question about coin flips have the same answer.

Probability, counting and algebra meet here because they are one counting problem in three costumes. A quality inspector counting defect combinations, a poker player counting hands and a student expanding a bracket are all reading the same rows, which is why the triangle has stayed in use since Pascal's 1654 treatise and in older manuscripts for centuries before that.

Prime rows and the pattern inside the divisors

Take any prime p and read across row p: every entry except the two edge 1s divides evenly by p. Row 5 gives 5, 10, 10, 5. Row 7 gives 7, 21, 35, 35, 21, 7. Row 11 gives 11, 55, 165, 330, 462, 462, 330, 165, 55, 11. Composite rows lose the property, and they usually lose it early.

Row nPrime?Inner entriesAll divisible by n?
5yes5, 10, 10, 5yes
7yes7, 21, 35, 35, 21, 7yes
9no9, 36, 84, 126, 126, 84, 36, 9no, 84 is not
10no10, 45, 120, 210, 252, 252, 210, 120, 45, 10no, 45 is not
11yes11, 55, 165, 330, 462, 462, 330, 165, 55, 11yes

The reason lives in the factorial formula. C(p, k) equals p factorial divided by k factorial times (p minus k) factorial, and the numerator carries a factor of p while the denominator does not: every factor down there is smaller than p, and p is prime, so nothing in the denominator can cancel it. A composite row breaks the argument because a factor of the denominator can cancel part of n itself. In row 10 the entry 45 comes from 10 × 9 over 2, and the 2 downstairs cancels the 2 inside the 10, leaving 5 × 9 = 45, which 10 does not divide.

Color the odd entries across the first 16 or 32 rows and a different structure appears: the even cells gather into triangular holes and the picture repeats itself at three corners, the fractal known as the Sierpinski triangle. The pattern is pure parity arithmetic, one entry added to another, yet it looks designed.

Big rows, exact arithmetic and the calculator's limits

Rows past 20 leave the comfortable zone of hand addition. Row 20 sums to 1,048,576 with a center cell of 184,756, but row 30 already sums past a billion, row 50 past a quadrillion, and row 100 to a number with 31 digits. No spreadsheet column and no pocket display absorbs that growth without a plan.

The calculator carries two plans. For drawing rows it uses Pascal's rule, one addition per cell, which keeps every intermediate value a true integer all the way out. For single cells it uses the falling product with cancellation built in: before each multiply, the numerator term and the denominator term are reduced by their greatest common divisor, so the running product stays as small as the arithmetic allows. That is how C(52, 5) prints 2,598,960 and C(52, 26) prints all 15 digits, 495918532948104, with no rounding anywhere.

Exactness ends where the browser's integers end, at 2 to the 53rd power, about 9 quadrillion. Cells above that print in scientific notation marked as approximate. The NIST Digital Library of Mathematical Functions collects the definitions, recurrence relations and identities behind all of this at section 26.3 on binomial coefficients, which is the reference to reach for when a row needs to be trusted at full size.

Frequently asked questions

What is Pascal's triangle?

Rows of numbers where each entry is the sum of the two above it, with 1s along both edges. Row 4 reads 1, 4, 6, 4, 1 and row 5 reads 1, 5, 10, 10, 5, 1.

How do you build row 8?

Start from row 7, which is 1, 7, 21, 35, 35, 21, 7, 1, and add neighbours: 7 + 21 = 28 and 21 + 35 = 56 and 35 + 35 = 70. Row 8 is 1, 8, 28, 56, 70, 56, 28, 8, 1.

What is the sum of row n?

2^n. Row 8 adds to 256, row 10 to 1024 and row 20 to 1,048,576, because each row is one doubling away from the row above it.

What does C(n, k) mean on the triangle?

The number of ways to choose k items from n when order does not matter, and it sits at position k of row n. C(10, 3) = 120, so a coach has 120 ways to name 3 starters from 10 players.

Is there a row 0?

Yes, a single 1. Rows are counted from 0, so the seventh line of the triangle is row 6 with 1, 6, 15, 20, 15, 6, 1, and the calculator lets you start there.

Where are the triangular numbers in the triangle?

On the third diagonal: 1, 3, 6, 10, 15, 21. C(5, 2) = 10 is the number of handshakes among 5 people, which is why the sequence keeps turning up in seating and pairing questions.

How does the triangle produce Fibonacci numbers?

Add along shallow diagonals instead of rows: 1, 1, 2, 3, 5, 8, 13. Each total is the sum of the two shallow diagonals before it, which is the Fibonacci rule itself.

How does it predict coin flips?

Row 10 counts the 1024 patterns of 10 flips. Exactly 5 heads happens in C(10, 5) = 252 of them, which is 252 ÷ 1024 = 0.2461, or 24.6 percent.

How does the triangle expand (a + b)^n?

Row n holds the coefficients. Row 3 gives 1, 3, 3, 1, so (a + b)^3 = a^3 + 3a^2b + 3ab^2 + b^3, and row 4 gives the coefficients for the fourth power.

What is the hockey stick pattern?

A running total down a shallow diagonal lands one cell below and across. The first four triangular numbers give 1 + 3 + 6 + 10 = 20, and 20 is C(6, 3).

How large can n get before the numbers overflow?

The calculator stays exact while the value fits under about 9 quadrillion, which is what a browser number holds exactly. C(52, 26) prints all 15 digits, 495918532948104, and cells above that limit fall back on scientific notation.

Where else is the triangle used?

In probability for counting equally likely outcomes, in algebra for binomial expansion, and in statistics for the binomial distribution. The binomial coefficient calculator covers single cells in more depth.

Spotted a wrong number or a broken result?

More Math tools

See all Math tools

Fee schedules, rates and rules change without notice. Always confirm important figures with the official source before you rely on them.