Pascal's Triangle

Category: Discrete Math   Level: 301

C(n, k) = C(n-1, k-1) + C(n-1, k), row n sums to 2n

Each entry is the sum of the two entries above it. Row n adds up to 2n, and entry k in row n counts the ways to choose k things from n.

Step through it

Watch it

Animated walkthrough

Step by step

Step 1: Start with ones

Row 0 is a single 1. Every row starts and ends with 1, so the edges of the triangle are all ones.

row 0: 1, row 1: 1 1

Step 1: Start with ones

Step 2: Add the two numbers above

Each inside entry is the sum of the two entries just above it. Row 2 gets 1 + 1 = 2 in the middle.

1 + 1 = 2

Step 2: Add the two numbers above

Step 3: Keep building rows

Rows 3 to 6 follow the same rule. For example, 4 + 6 = 10 in row 5. Two rules, endless rows.

4 + 6 = 10

Step 3: Keep building rows

Step 4: Each row sums to a power of 2

Add up each row: 1, 2, 4, 8, 16, 32, 64. Every entry is used twice to build the next row, so each row sum doubles.

row n sum = 2n, row 6: 1 + 6 + 15 + 20 + 15 + 6 + 1 = 64

Step 4: Each row sums to a power of 2

Step 5: Entries count choices

Entry k in row n is C(n, k), the number of ways to choose k things from n. The circled 10 says there are 10 ways to pick 2 toppings from 5. Count k from 0 at the left edge.

C(5, 2) = 5!/(2! ยท 3!) = 10

Step 5: Entries count choices

All steps at once

Storyboard

Generate it yourself

cd svg-generator
python3 -m svgmath render pascals-triangle --out /tmp/pascals-triangle

Source: svgmath/diagrams/counting.py