Pascal's Triangle Generator
Generate Pascal's triangle to any number of rows. Each entry is the binomial coefficient C(n, k).
Pascal's triangle formulas
Entry k of row nC(n, k) = n!k! (n − k)!
Building ruleC(n, k) = C(n − 1, k − 1) + C(n − 1, k)
Row sum2n
Binomial theorem(a + b)n = Σ C(n, k) an−k bk
Where Rows and positions are counted from 0 — the top "1" is row 0.
Worked examples
Write row 5.
- Each entry is the sum of the two above it in row 4 (1 4 6 4 1)
Answer: 1 5 10 10 5 1
Expand (x + 2)⁴.
- Row 4 coefficients: 1, 4, 6, 4, 1
- Multiply by powers of 2: 1·1, 4·2, 6·4, 4·8, 1·16
Answer: x⁴ + 8x³ + 24x² + 32x + 16
Probability of exactly 2 heads in 5 coin flips.
- C(5, 2) = 10 outcomes out of 25 = 32
Answer: 10/32 = 31.25%