Pascal’s Triangle Calculator: Rows, Entries C(n, k) and Binomial Expansion
By FindMySum · Last reviewed
Pascal's triangle is a triangular table of numbers in which every entry is the sum of the two above it. It looks like a simple pattern, but its entries are the binomial coefficients, which count combinations, give the coefficients of a binomial expansion and set the probabilities of coin tosses. This calculator builds the first rows, finds any entry exactly, lists a whole row, and expands (a·x + b·y)^n. Its opening example is row 6, entry 2.
Building the triangle
The top row, called row 0, is a single 1. Each row after it starts and ends with 1, and each number inside is the sum of the two numbers diagonally 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
Positions in a row are also counted from 0, so row 6, position 2 is 15. Counting from 0 makes the formulas line up with the binomial theorem; if you count from 1, subtract 1 from both numbers before using a formula.
The formula for any entry
You don't need to build the rows above to find an entry. Entry k of row n is the binomial coefficient:
C(n, k) = n! ÷ (k! × (n − k)!)
often read "n choose k" and written as n over k in brackets. For the default example: C(6, 2) = 720 ÷ (2 × 24) = 15, which matches row 6 above.
The addition rule and the formula agree because of Pascal's rule, C(n, k) = C(n − 1, k − 1) + C(n − 1, k): to choose k items from n, either you take the last item and choose k − 1 from the rest, or you leave it and choose all k from the rest.
The calculator works with exact whole numbers of any length. It computes a row with the shortcut C(n, k + 1) = C(n, k) × (n − k) ÷ (k + 1), which never needs a factorial, so row 1,000 is as exact as row 6.
Row sums and powers of two
Adding the entries of row n gives 2^n: row 6 adds to 1 + 6 + 15 + 20 + 15 + 6 + 1 = 64 = 2⁶. A set of n items has 2^n subsets, and row n counts them by size: one empty subset, n subsets of one item, C(n, 2) of two items, and so on. The alternating sum of a row (subtract every second entry) is always 0 for n ≥ 1.
Binomial expansion
The binomial theorem says:
(x + y)^n = C(n, 0)x^n + C(n, 1)x^(n−1)y + … + C(n, n)y^n
so row n holds the coefficients. Row 6 gives:
(x + y)⁶ = x⁶ + 6x⁵y + 15x⁴y² + 20x³y³ + 15x²y⁴ + 6xy⁵ + y⁶
The powers of x count down from n while the powers of y count up, and the two always add to n. When the terms have their own coefficients, they are raised to the same powers. For (2x − 3y)⁴, row 4 is 1 4 6 4 1 and each term k is multiplied by 2^(4−k) × (−3)^k:
(2x − 3y)⁴ = 16x⁴ − 96x³y + 216x²y² − 216xy³ + 81y⁴
Enter a and b under Advanced options to get any expansion of this form up to n = 50, with every term listed in a table.
Odd entries and the Sierpiński triangle
Shading the odd numbers in the triangle reveals a fractal: the Sierpiński triangle, a triangle with its middle removed, repeated inside each of the three corners, and so on. The calculator shades odd entries in the rows it shows. The pattern repeats every power of two: rows 0 to 3 form one copy, rows 0 to 7 three copies of it, rows 0 to 15 nine copies.
There is an exact count, due to James Glaisher in 1899: the number of odd entries in row n is 2 raised to the number of 1s in n written in binary. Row 6 is 110 in binary, with two 1s, so it has 2² = 4 odd entries (1, 15, 15, 1). Row 7 (111) has 8: every entry is odd. Row 8 (1000) has just 2, the ones at each end.
Other patterns
- Diagonals. The edges are 1s, the next diagonal the counting numbers, then the triangular numbers (1, 3, 6, 10, 15…) and the tetrahedral numbers (1, 4, 10, 20…).
- Fibonacci numbers. Adding along shallow diagonals gives 1, 1, 2, 3, 5, 8, 13…
- Powers of 11. Rows 0 to 4 read as numbers are 1, 11, 121, 1331 and 14641, the powers of 11. From row 5 the entries have two digits, and you have to carry.
- Probability. Row n divided by 2^n gives the chance of each number of heads in n fair coin tosses. Six tosses give exactly three heads 20 times in 64, or 31.25%.
Limits
To keep the page fast, the triangle shows up to 30 rows, a whole row is listed up to row 100 and expansions are written out up to n = 50. Any single entry, the row sum and the number of odd entries are available up to row 1,000.
More questions
Who invented Pascal’s triangle?
Blaise Pascal wrote about it in his Traité du triangle arithmétique (published 1665), but the triangle was known centuries earlier. The Persian mathematician al-Karaji and the poet Omar Khayyam described it around 1000 to 1100, and in China it is called Yang Hui’s triangle after the 13th-century mathematician who published it, crediting Jia Xian from the 11th century.
Is the triangle symmetrical?
Yes. Every row reads the same forwards and backwards, because choosing k items to take is the same as choosing the n − k items to leave: C(n, k) = C(n, n − k). That is why the largest entry sits in the middle of each row.
What is the hockey-stick pattern?
Start at a 1 on the edge, go down a diagonal any number of steps, and the sum of those entries equals the entry just below and to the other side of the last one. For example 1 + 3 + 6 + 10 = 20 (C(6, 3)). It is the identity Σ C(i, r) = C(n + 1, r + 1).
How big do the numbers in Pascal’s triangle get?
They grow quickly. Row 20’s middle entry is 184,756, row 100’s has 30 digits, and row 1,000’s middle entry C(1000, 500) has 300 digits. The middle entry of row n is roughly 2^n ÷ √(πn/2), so each row’s largest entry is roughly double the one in the row above.
Can Pascal’s triangle expand (x − y)^n?
Yes. Write it as (x + (−y))^n: the coefficients are the same, but every term with an odd power of y changes sign. (x − y)³ = x³ − 3x²y + 3xy² − y³. In the calculator, set b to −1 under Advanced options.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.