Combinatorics
The art of counting without listing. The rule of product, factorials, permutations, arrangements and combinations all answer one question — in how many ways can this be done — and the whole difficulty comes down to two decisions: does order matter, and may items repeat.
Before you start
This topic builds on earlier ideas. Before you start, it's worth working through the lessons below — they'll make everything click:
- MultiplicationMultiplication is repeated addition of the same number. Learn the names of the factors and the product, the laws of multiplication (commutativity, associativity, distributivity), the times tables and column multiplication.
- PowersA power is shorthand for multiplying the same factor by itself. Learn the base and the exponent, the laws of exponents, powers of a product and of a quotient, zero and negative exponents, the monotonicity of exponentiation, and scientific notation.
- Special productsSeven identities that turn multiplying out brackets into a single line — and the same seven read right to left, which is factoring. The square of a sum and of a difference, the difference of squares, the cubes and the sum and difference of cubes, proved on a drawing and used for mental arithmetic.
Where this is used
Real situations where you count exactly the way this lesson teaches:
- How strong a password isA four-digit PIN is 10⁴ = 10,000 possibilities — a phone locks after three attempts, but a stolen database of such codes falls in a fraction of a second. Eight lower-case letters give 26⁸ ≈ 209 billion combinations, and eight characters drawn from 62 (lower case, upper case, digits) give 62⁸ ≈ 218 trillion, over a thousand times as many. Every character you add multiplies that count by the size of the alphabet rather than adding to it.
- Planning a delivery roundEight addresses can be visited in 8! = 40,320 different orders; add two more and there are 10! = 3,628,800, ninety times as many. That is why routing software hunts for a good round rather than the best one — the factorial itself says at which point going through the options one by one stops being feasible.
- Drawing up a seasonIn a sixteen-team league everyone plays everyone once per round: C(16, 2) = 120 fixtures, or 240 across two rounds. Eight matches to a matchday makes 30 matchdays, so before a single fixture is drawn you know how many weekends the season has to fill and how many refereeing teams have to be rostered.
- Putting a project team togetherThree people out of ten can be picked in C(10, 3) = 120 ways. Once the roles differ — lead, analyst, tester — order counts and there are 10 · 9 · 8 = 720 options, six times as many, because every trio can be assigned in 3! = 6 ways. The same distinction settles whether a recruiter is discussing who is on the team or who does what on it.
- Where compound interest comes fromTen years at 5% a year multiply the capital by (1 + 0.05)¹⁰ ≈ 1.6289. The binomial theorem splits that number into parts: the 1 is the capital, 10 · 0.05 = 0.5 is simple interest on its own, and C(10, 2) · 0.05² = 0.1125 is interest on interest — the first term a simple-interest calculation cannot see at all. The remaining terms (0.015 and 0.0013) add the rest. That is why at low rates the gap between simple and compound interest is small, and at high rates it grows quadratically.
All formulas
Rule of product
a choice made in several independent steps — multiply the counts
Factorial
the product of the first n naturals; 0! equals 1 by definition
Permutations
the number of orderings of all n items
Arrangements without repetition
choose k out of n, order matters, nothing repeats
Arrangements with repetition
k times over, we choose from the same n options
Combinations
choose k out of n, order does NOT matter
Symmetry of combinations
choosing k items is the same as discarding the other n − k
Pascal's rule
every entry of the triangle is the sum of the two above it
The binomial theorem
the coefficients of the expansion are row n of Pascal's triangle
Combinatorics answers the question "in how many ways?" before anyone can start listing cases. It is also a prerequisite for classical probability: to divide the number of favourable outcomes by the number of all of them, you first have to be able to count both.
The rule of product
All of combinatorics grows out of a single observation. If a choice is made in several independent steps offering options, then the number of outcomes is:
The counts are multiplied, not added — because every decision in the first step can be paired with every decision in the second.
Factorials
The product of the first few naturals turns up so often in counting that it has its own symbol:
It is read "n factorial". The first few values are worth knowing by heart:
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |
|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 2 | 6 | 24 | 120 | 720 | 5040 |
Mind the first column: , by definition. An empty sequence can be arranged in exactly one way — by doing nothing — and besides, without that convention the combination formula would divide by zero.
That growth is a practical hint: if ten people can be ordered in ways, solving a problem by listing cases is out of the question.
Permutations
A permutation is an ordering of all items. The first position can be filled in ways, the second in (one item is already used), and so on:
Arrangements without repetition
When only of the items are chosen but order matters, we are counting arrangements without repetition:
The second form is the handier one to compute: it is simply decreasing factors starting at .
Arrangements with repetition
If items may repeat, each of the steps has the full options, so the rule of product gives directly:
Combinations
When items are chosen out of and order does not matter, we have combinations:
Where does the in the denominator come from? From the fact that the arrangements counted every -element set times over — once for each ordering of the same items. So we divide by the number of those orderings:
Symmetry
Combinations have a property that saves a great deal of arithmetic:
Choosing items is, after all, the same as naming the items left behind. So is computed like , rather than by writing out eighteen factors.
The bars add up to — the number of subsets of a six-element set, because every item is decided independently: take it or leave it.
Pascal's triangle
The symbols for successive line up into a triangle in which not one factorial has to be computed. The rows are numbered from zero:
There is a single rule of construction: every row starts and ends with a 1, and every entry in between is the sum of the two above it. Written in symbols, that is the identity:
Why does it hold? Single out one fixed item of the set — say the first. Every choice of items either takes it (leaving places to fill from the other items) or skips it (all places have to be filled from those ). The two cases do not overlap and cover everything, so the counts add up.
The triangle also displays two properties we already have, only this time as a picture. The symmetry is the mirror image of a row about its middle. And the entries of row add up to — row six is exactly the of the chart above, summing to .
The binomial theorem
The triangle is not a curiosity — it is the table of coefficients of a power of a sum. The binomial theorem states:
The justification is again a counting argument rather than an algebraic one. The power is a product of identical brackets; multiplying them out, each bracket contributes either or . A term with arises exactly when was taken from of the brackets — and there are such choices. Hence the coefficient.
In practice nobody sums this symbolically; you read off row of the triangle. For that row is :
Note the two independent rhythms: the exponent of falls from to zero, the exponent of rises from zero to , and in every term the two add up to . That is the fastest check on an expansion. The special products for and are simply rows two and three of this same triangle.
Which formula to use
The whole difficulty comes down to two questions about the problem:
| does order matter? | may items repeat? | formula |
|---|---|---|
| yes, all items are used | — | |
| yes, out of | no | |
| yes, out of | yes | |
| no, out of | no |
A practical test for the first question: swap two of the chosen items. If that gives a different situation, order matters.
Exercises
The five kinds of question match the five formulas in the table above — Pascal's triangle and the binomial theorem are practised on the worked examples of those sections, because the generator here asks for a number of ways, not for a row or a coefficient. A prompt with an exclamation mark asks straight for a factorial — mind . Permutations for a given is also , only phrased in words. Arrangements without repetition and arrangements with repetition both come with and ; they differ only in whether items may be taken more than once. Combinations ask for a choice of out of with order ignored — and here the symmetry is worth remembering. Every answer is a whole number.
Practice
Work through a set of exercises — they get harder as you go. At the end you'll see your score and the mistakes worth reviewing.
Common mistakes
- Adding instead of multiplying — successive steps of a choice multiply the counts.
- Confusing arrangements with combinations — if order does not matter, the result still has to be divided by .
- Forgetting — especially in the edge cases of the combination formula.
- Cancelling factorials by eye — is , not and not .
- Assuming repetition — whether items may repeat is decided by the problem, not by which formula is more convenient.
- Listing the cases — beyond there are usually far too many to get through without a slip.
- Counting a row from one — row has entries and they are numbered from zero, so is the third entry of row five, not the second.
- The bare coefficient instead of the whole term — in the expansion of the coefficient of is , not : it is the whole 2 that is raised to a power, not just the .
Formula card
Topic: Combinatorics
Rule of product
a choice made in several independent steps — multiply the counts
Factorial
the product of the first n naturals; 0! equals 1 by definition
Permutations
the number of orderings of all n items
Arrangements without repetition
choose k out of n, order matters, nothing repeats
Arrangements with repetition
k times over, we choose from the same n options
Combinations
choose k out of n, order does NOT matter
Symmetry of combinations
choosing k items is the same as discarding the other n − k
Pascal's rule
every entry of the triangle is the sum of the two above it
The binomial theorem
the coefficients of the expansion are row n of Pascal's triangle
