Number Theory

Pascal's Triangle and the Patterns Inside It

Build Pascal's triangle with simple addition, then find powers of 2, Fibonacci numbers, primes and a fractal inside it.

Key takeaways

  • Each interior entry is the sum of the two above it, and the entry in row n, position k, counts the ways to choose k things from n.
  • The entries of row n add to 2ⁿ, because they count all the subsets of a set with n elements.
  • Diagonals contain the counting numbers, triangular numbers and tetrahedral numbers.
  • When p is prime, every entry of row p except the two end 1s is divisible by p.
  • Coloring the odd entries produces a pattern that resembles the Sierpinski triangle.

Pascal's triangle is a triangular array of whole numbers with 1s down both edges, where every other entry is the sum of the two entries above it. That single rule produces a table that answers counting questions, expands algebraic powers and hides a surprising number of other patterns.

Entry k of row n, counting both from zero, is the number of ways to choose k objects from n. Almost every pattern in the triangle can be explained either by the addition rule or by that counting meaning.

Building the rows

Start with a lone 1 at the top. That is row 0. Each new row begins and ends with 1, and each space between is filled by adding the neighbors above.

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
Row 6:        1   6  15  20  15   6   1
Row 7:      1   7  21  35  35  21   7   1

Each row reads the same forwards and backwards. Numbering from zero is worth the habit, since row n then has n + 1 entries and its second entry is n.

The array carries Blaise Pascal's name because of his treatise on it, written in the 1650s and published in 1665. It was known long before. Versions appear in Indian work on poetic meters, in Persian mathematics, and in China, where it is often named for Yang Hui.

The counting meaning

The binomial coefficient C(n, k), read "n choose k", is the number of ways to pick k items from n when order does not matter. A direct formula is C(n, k) = n! / (k! (n − k)!), where n! is the product of the whole numbers from 1 to n and 0! = 1.

Row 5, position 2, holds 10, and there are 10 ways to choose two people from five.

The addition rule follows from this. Single out one of the n people, say Ana, a hypothetical member of the group. Any committee of k either includes Ana or does not. If it does, you choose k − 1 more from the other n − 1. If not, you choose all k from the other n − 1.

C(n, k) = C(n − 1, k − 1) + C(n − 1, k)

This style of reasoning, counting one collection in two ways, is the heart of combinatorial proof.

Reaching a row without building it

You do not need all the earlier rows to write down a particular one. Moving along row n, each entry comes from the one before by multiplying by a simple fraction:

C(n, k) = C(n, k − 1) × (n − k + 1) / k

For row 8, start at 1 and multiply in turn by 8/1, 7/2, 6/3, 5/4 and so on.

1
1 × 8/1  = 8
8 × 7/2  = 28
28 × 6/3 = 56
56 × 5/4 = 70

By symmetry the rest is 56, 28, 8, 1. Every result is a whole number even though fractions appear on the way, because each one counts something.

Do the multiplication before the division when you compute by hand, and the intermediate values stay exact. The shortcut also shows why the entries rise toward the middle: the factor (n − k + 1)/k is greater than 1 in the first half of the row and less than 1 in the second half.

The middle entries grow fast. Row 10 peaks at 252, row 20 at 184,756. Each middle entry in an even row is a little under four times the one two rows earlier, approaching a factor of 4 as the rows go on.

Expanding powers of a sum

The rows are the coefficients in powers of (a + b). Row 4 tells you at once that

(a + b)⁴ = a⁴ + 4a³b + 6a²b² + 4ab³ + b⁴

When you multiply out four copies of (a + b), you pick a or b from each. The term a²b² arises once for every way of choosing which two copies supply b, and there are C(4, 2) = 6 ways. The general statement is the binomial theorem.

This also explains a classroom curiosity. Setting a = 10 and b = 1 gives powers of 11: 11, 121, 1331 and 14641 match rows 1 to 4. From row 5 on, entries reach two digits and carrying blurs the match, but 11⁵ = 161051 still comes from 1, 5, 10, 10, 5, 1 once you carry.

Row sums and alternating sums

Add across each row and you get 1, 2, 4, 8, 16, 32: the powers of 2. Setting a = b = 1 in the binomial expansion proves it. So does counting: row n lists the number of subsets of each size, and a set of n elements has 2ⁿ subsets, since each element is either in or out.

Now alternate the signs. In row 4, 1 − 4 + 6 − 4 + 1 = 0. This holds for every row after row 0 (set a = 1 and b = −1). In words, a non-empty set has exactly as many subsets of even size as of odd size.

Square the entries instead and add them. Row 3 gives 1 + 9 + 9 + 1 = 20, which is the middle entry of row 6. In general, the sum of the squares of row n equals C(2n, n).

Patterns along the diagonals

Read diagonally, parallel to an edge.

Diagonal Entries What they count
First 1, 1, 1, 1, 1 A constant
Second 1, 2, 3, 4, 5 Counting numbers
Third 1, 3, 6, 10, 15 Triangular numbers
Fourth 1, 4, 10, 20, 35 Tetrahedral numbers

Each diagonal is the running total of the one before. That fact is often called the hockey stick identity: add entries down a diagonal from its starting 1, and the sum appears one step down and to the side, forming the shape of a stick with a bent blade. For instance, 1 + 3 + 6 + 10 = 20.

The third and fourth diagonals count dots stacked in triangles and balls stacked in pyramids, which you can explore under figurate numbers.

Shallow diagonals, cutting across the rows at a gentler slope, add up to Fibonacci numbers. One of them is 1, 4, 3, with sum 8. The next is 1, 5, 6, 1, with sum 13.

Patterns found in Pascal's triangle
Addition rule Each entry is the sum of the two above Odd entries A nested triangle pattern Prime rows Inner entries divisible by the row number Row sums Powers of 2 Diagonals Counting, triangular and tetrahedral numbers Slanted sums Fibonacci numbers Addition rule Each entry is the sum of the two above Row sums Powers of 2 Diagonals Counting, triangular and tetrahedral numbers Slanted sums Fibonacci numbers Prime rows Inner entries divisible by the row number Odd entries A nested triangle pattern

Primes and divisibility

Look at row 5: the inner entries 5, 10, 10, 5 are all multiples of 5. Row 7 has 7, 21, 35, 35, 21, 7, all multiples of 7. Row 6 does not behave this way, since 15 and 20 are not multiples of 6.

The reason for primes is that C(p, k) = p! / (k! (p − k)!). When 0 < k < p, the numerator contains the factor p, while the denominator is a product of numbers smaller than p. A prime cannot be canceled by smaller numbers.

It follows that (a + b)ᵖ and aᵖ + bᵖ leave the same remainder on division by p. This is one standard route to Fermat's little theorem.

The converse holds too: if every inner entry of row n is divisible by n, for n ≥ 2, then n is prime.

The fractal in the odd numbers

Shade every odd entry and leave every even one blank. With 8, 16 or 32 rows, you see triangles nested inside triangles, closely resembling the Sierpinski triangle.

You do not need the large numbers to draw it. Use only parity: odd plus odd is even, odd plus even is odd, even plus even is even.

The count of odd entries in a row follows a clean rule. Write n in binary and count the 1s. If there are s of them, row n has 2ˢ odd entries. Row 6 is 110 in binary, with two 1s, so it has four odd entries: 1, 15, 15 and 1. Rows numbered one less than a power of 2, such as row 7, are entirely odd.

Rows that turn into a bell shape

Plot the entries of a large row as a bar chart and a smooth hump appears, tallest in the middle and falling away on both sides. Divide by 2ⁿ and the bars become the probabilities of getting each number of heads in n fair coin tosses.

For 10 tosses, row 10 reads 1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1, with total 1024. Getting 4, 5 or 6 heads accounts for 210 + 252 + 210 = 672 of those outcomes, about 66%.

As n increases, the shape approaches the normal curve after suitable rescaling. This was an early special case of the central limit theorem.

A common misconception is that exactly half heads becomes more likely with more tosses. The opposite is true. The middle entry is the largest in its row, but its share of the total shrinks: 50% for 2 tosses, 37.5% for 4, about 25% for 10. What becomes more likely is that the proportion of heads lies close to one half.

Puzzles to try

  1. Count the routes through a grid of streets that go only east or south. To reach a corner 3 blocks east and 2 south, there are C(5, 2) = 10 routes. Writing the totals on each corner recreates the triangle.
  2. Toss 4 fair coins. The chance of exactly 2 heads is 6/16 = 3/8, read from row 4.
  3. Pick any interior entry and look at the six numbers around it. Multiply three alternate neighbors, then the other three. The two products match.

For the third puzzle, take the 4 in row 4, position 1. Its six neighbors, going around, are 1, 3, 6, 10, 5 and 1. The alternate products are 1 × 6 × 5 = 30 and 3 × 10 × 1 = 30.

Not every apparent pattern survives. Check a new conjecture on rows well beyond those that suggested it, then look for a reason based on the addition rule or on counting.

Written for 4Mathematics with AI writing tools and not reviewed line by line by a person. Check anything you rely on against a textbook or primary source. Report an error.

Keep reading

All 59 articles in Number Theory →

Latest news on this topic