Discrete Mathematics and Combinatorics
Permutations and Combinations and How to Choose Between Them
One question about order and one about repetition tell you which counting formula to use, shown through races, committees, cards and words.
Key takeaways
- A permutation is an ordered selection: P(n, k) = n! / (n − k)! ways to pick k of n distinct items in order.
- A combination is an unordered selection: C(n, k) = n! / (k! (n − k)!), which is P(n, k) divided by k!.
- Ask two questions of any problem: does order matter, and may an item be chosen more than once?
- When some items are identical, divide by the factorial of each group's size.
Use a permutation when the order of your choices changes the outcome, and a combination when it does not. Gold, silver and bronze medals among runners form a permutation, because swapping two winners gives a different result. A three-person committee is a combination, because the same three people are the same committee however you name them.
A reliable test is to take one finished outcome and swap two of the chosen items. If you now have something different, order matters.
Factorials and ordered selections
The factorial n! is the product of the whole numbers from 1 to n, and 0! is defined as 1. It counts the orderings of n distinct objects: n choices for the first place, n − 1 for the second, and so on down to 1.
Now fill only some places. In a race with 8 runners and no ties, the number of possible podiums is
P(8, 3) = 8 × 7 × 6 = 336
= 8! / 5! In general you multiply k factors, starting at n and counting down. This is the multiplication rule with the number of options dropping by one at each step.
Unordered selections
Suppose instead you pick 3 of the 8 runners to take a drug test. Each group of 3 corresponds to 3! = 6 different podiums, one for each way of ordering its members. Dividing removes the order:
C(8, 3) = P(8, 3) / 3! = 336 / 6 = 56 The number C(n, k) is read "n choose k" and also written as a binomial coefficient. It has a useful symmetry: C(n, k) = C(n, n − k). Choosing 5 of 8 runners to skip the test is the same decision as choosing 3 to take it, so C(8, 5) is also 56.
For hand calculation, avoid giant factorials. Write k falling factors on top and k! underneath, then cancel: C(10, 4) = (10 × 9 × 8 × 7) / (4 × 3 × 2 × 1) = 210.
The four basic cases
Order is only one question. The other is whether an item can be reused. Together they give four situations.
| Choosing k from n | No repeats | Repeats allowed |
|---|---|---|
| Order matters | n! / (n − k)! | nᵏ |
| Order ignored | C(n, k) | C(n + k − 1, k) |
With 5 ice cream flavors and 3 scoops, the four answers are all different. Stacked scoops of distinct flavors: 5 × 4 × 3 = 60. Stacked with repeats: 5³ = 125. A cup with 3 distinct flavors: C(5, 3) = 10. A cup with repeats allowed: C(7, 3) = 35.
The last formula is the least obvious. It comes from the stars and bars argument.
Two questions decide the formula.
Card hands
A five-card hand from a standard 52-card deck is unordered, so there are C(52, 5) = 2,598,960 hands. Many probabilities in card games are a count of special hands divided by this number.
Flushes, with all five cards in one suit: choose the suit, then 5 of its 13 cards. That gives 4 × C(13, 5) = 4 × 1,287 = 5,148, a figure that includes straight flushes.
A full house, three of one rank and two of another:
rank of the triple 13
its three suits C(4, 3) = 4
rank of the pair 12
its two suits C(4, 2) = 6
total 13 × 4 × 12 × 6 = 3,744 The two ranks are chosen in order here because their roles differ. Triple kings with a pair of fours is a different hand from triple fours with a pair of kings.
A trap with two pairs
For two pairs, the two paired ranks play identical roles. So choose them together, as C(13, 2) = 78, then pick suits for each pair, and finally pick the fifth card from the 11 other ranks.
78 × 6 × 6 × (11 × 4) = 123,552 Writing 13 × 12 for the two ranks would count every hand twice: once as "kings then fours" and once as "fours then kings". Compare this with the full house, where 13 × 12 was right. The deciding point is whether you can tell the two chosen things apart in the finished hand.
Words with repeated letters
How many distinct arrangements do the letters of MISSISSIPPI have? Pretend all 11 letters are different, giving 11! orders. The 4 copies of I can be shuffled among themselves in 4! ways without changing the word, and likewise the 4 copies of S and the 2 copies of P.
11! / (4! × 4! × 2!) = 39,916,800 / 1,152 = 34,650 This is called a multinomial coefficient. With only two kinds of letter it reduces to C(n, k): the number of strings with k letters A and n − k letters B equals the number of ways to choose where the A's go.
Committees with conditions
Say a club has 5 women and 4 men and wants a committee of 3 with at least one woman. The cleanest route counts all committees and removes those with no woman: C(9, 3) − C(4, 3) = 84 − 4 = 80.
A tempting shortcut is "choose one woman (5), then any 2 of the remaining 8 people (28)", giving 140. It is far too big, because a committee with two or three women is built several times. The shortcut smuggled in an order by naming one woman as first.
You can also add cases: exactly one, two or three women give 5 × 6 = 30, 10 × 4 = 40 and 10, for a total of 80.
Teams, tables and lotteries
Split 10 players into two teams of 5. If the teams are named, say Red and Blue, there are C(10, 5) = 252 ways. If they are unnamed, each split has been counted twice, leaving 126.
Seating n people around a round table, with rotations treated as the same, gives (n − 1)! arrangements for n ≥ 1. If mirror images also count as the same, as for beads on a bracelet with all beads distinct and n ≥ 3, halve it again.
A lottery that draws 6 numbers from 49 without regard to order has C(49, 6) = 13,983,816 possible draws. One ticket therefore matches all six with probability about 1 in 14 million, assuming a fair draw. That is general arithmetic, and no choice of numbers improves it.
Items that must sit together, or apart
Arrange 6 different books on a shelf so that two particular volumes are next to each other. Glue the pair into a single block. You now have 5 objects, with 5! = 120 orders, and the block can be read in 2 ways. The total is 240.
To keep those two volumes apart, subtract from all orders: 720 − 240 = 480.
When several items must all be separated, use gaps. To seat 4 adults and 3 children in a row with no two children adjacent, line up the adults first in 4! = 24 ways. This creates 5 gaps, counting both ends. Choose places for the children in order, one per gap:
adults 4! = 24
children into the gaps 5 × 4 × 3 = 60
total 24 × 60 = 1,440 The second line is a permutation because the children are distinct people. If they were identical tokens, it would be C(5, 3) = 10.
Seeing one count two ways
Formulas for selections often have a story that proves them without algebra. Consider choosing a team of k from n people and naming one member captain.
Pick the team first and then the captain: C(n, k) × k. Or pick the captain first and then the other k − 1 members: n × C(n − 1, k − 1). Both count the same thing, so they are equal for 1 ≤ k ≤ n. With n = 6 and k = 3, the two sides are 20 × 3 = 60 and 6 × 10 = 60.
This identity gives a fast way to build C(n, k) from smaller values. It is also a model for checking your own work: if you can describe two different procedures for making the same object, their counts must agree.
Selections made in stages
Many problems chain several selections together. Say a quiz team needs 2 students from a group of 6 in one year and 3 from a group of 7 in another, and then one of the 5 chosen becomes captain.
The two groups are chosen independently, giving C(6, 2) = 15 and C(7, 3) = 35 options. Naming the captain adds a factor of 5. The total is 15 × 35 × 5 = 2,625. Each selection ignores order, while the captaincy singles out one member and so adds a distinction of its own.
Checking your answer
- Write down two or three outcomes explicitly, in whatever notation seems natural.
- Swap items within one outcome and decide whether it changed.
- Decide whether any item may appear twice.
- Shrink the numbers until you can list everything, and compare.
- If possible, count a second way. Agreement between two methods is strong evidence.
Common questions
Why is a combination lock misnamed?
On a typical lock the order of the digits matters, so in mathematical terms its code is a permutation with repetition allowed. A 3-dial lock with digits 0 to 9 has 10³ = 1,000 codes.
Why is 0! equal to 1?
There is exactly one way to arrange nothing: the empty arrangement. The choice also keeps the formulas consistent, so that C(n, 0) = 1 and C(n, n) = 1, matching the single way to choose nobody or everybody.
What if k is larger than n?
Without repetition you cannot choose more items than exist, so P(n, k) and C(n, k) are taken to be 0. With repetition allowed there is no such limit: from 2 flavors you can still fill 5 scoops, in 2⁵ = 32 ordered ways or C(6, 5) = 6 unordered ones.
Where to see these numbers again
The numbers C(n, k) also fill out Pascal's triangle, and they are the coefficients in the binomial theorem. Meeting them in those other settings is a good way to make the formula feel less like something to memorize.