Pascal's triangle and the binomial theorem
The coefficients of an expansion can be written down directly, including the one term you actually want.
The last lesson produced the rows 1 1, 1 2 1, 1 3 3 1, 1 4 6 4 1 by multiplying brackets out. Here is a completely different way of producing numbers: start with a 1, and build each new row by adding neighbouring pairs from the row above, treating anything off the end as 0.
Change range(7) to range(12) and run it again. Add up each row as you read down. The totals are 1, 2, 4, 8: each row sums to double the one above.
Those are the same numbers. Adding neighbours and multiplying out brackets produce identical rows, and that is not a coincidence: multiplying an expansion by once more sends each old coefficient into two neighbouring slots, so each new coefficient is the sum of the two above it.
The arrangement is called Pascal's triangle. Row holds the coefficients of , counting the top row as row 0.
n = 0 1
n = 1 1 1
n = 2 1 2 1
n = 3 1 3 3 1
n = 4 1 4 6 4 1
n = 5 1 5 10 10 5 1Getting one coefficient without building the triangle
Building thirty rows to reach row 30 is fine for a computer and hopeless in an exam, so there is a formula for a single entry. It needs one piece of notation first.
The factorial of a whole number , written , is the product of every whole number from 1 up to . So and . By convention , which keeps the formulas below working at the ends of a row.
The entry in row , position , counting both from 0, is called a binomial coefficient, written and read " choose ".
Work out in full. The top is . The bottom is . So , which is indeed the third entry of row 5 above.
In practice the factorials mostly cancel, so it is faster to write : take factors counting down from on top, and underneath. Compute a whole row that way and compare it with the triangle.
Change the 5s to 6s and run it again. Then check one entry against the triangle you printed earlier. Also try choose(30, 26) and compare it with choose(30, 4).
The binomial theorem
Putting the coefficients together with the powers gives the whole expansion in one statement.
Read the powers rather than memorising them. In each term the exponents add to , the power of starts at and falls, and the power of starts at 0 and rises. So , with the coefficients read straight off row 4.
Finding a particular term, every step
Find the coefficient of in .
- Name the pieces so the theorem applies literally: , , . The minus sign belongs to ; that is what stops sign errors later.
- The power of comes from , so needs , which gives .
- The coefficient is .
- Now the term: .
- , remembering the 2 is cubed as well.
- , because an even power of a negative is positive.
- Multiply the numbers: , so the term is and the coefficient is 80.
That is a claim about one number, so it can be checked by expanding the whole thing and reading off the slot.
Change range(5) to range(6) so it expands , and predict the slot from the theorem before you press play. It is .
Row 4 of Pascal's triangle is 1 4 6 4 1. Without building row 5, write it down.
1 5 10 10 5 1. Each interior entry is the sum of the two above it: , , , , and the two ends are always 1 because . The row is symmetric because choosing things to include is the same as choosing things to leave out, so .