Sub topic 4
Combinations: Selections When Order Does Not Matter
This chapter assumes you know the addition and multiplication principles, factorial notation, and the permutation formula nPr from the earlier chapters. You should be comfortable simplifying fractions that contain factorials.
What a combination counts
A combination is a selection of objects in which the order of choice does not matter. Choosing Asha, Bala and Chitra for a committee is the same outcome as choosing Chitra, Asha and Bala. A permutation would count those two as different, and a combination counts them once.
The number of ways to choose r objects from n distinct objects is written nCr, C(n, r), or "n choose r".
Deriving the formula
Start from permutations. The number of ordered arrangements of r objects taken from n is nPr = n! / (n − r)!.
Every unordered group of r objects can be arranged internally in r! ways. So the ordered count is the unordered count multiplied by r!:
nPr = nCr × r!
Solving for nCr gives the formula:
nCr = n! / (r! × (n − r)!)
Take n = 5 and r = 3. There are 60 ordered arrangements. Each group of 3 appears 3! = 6 times among them, so there are 60 / 6 = 10 groups.
import math
n, r = 5, 3
print(math.factorial(n)) # 120
print(math.perm(n, r)) # 60 -> 5! / (5-3)!
print(math.comb(n, r)) # 10 -> 5! / (3! * 2!)
print(math.perm(n, r) == math.comb(n, r) * math.factorial(r)) # TrueComputing nCr quickly
Writing out full factorials wastes time. Cancel the larger factorial in the denominator and multiply only r terms:
nCr = [n × (n − 1) × ... × (n − r + 1)] / r!
The numerator has r factors, starting at n and going down. The denominator is r!.
Example: 10C3 = (10 × 9 × 8) / (3 × 2 × 1) = 720 / 6 = 120.
Example: 9C4 = (9 × 8 × 7 × 6) / (4 × 3 × 2 × 1) = 3024 / 24 = 126.
Use the smaller of r and n − r. For 100C98, you would otherwise multiply 98 terms. Instead, 100C98 = 100C2 = (100 × 99) / 2 = 4950. This works because of the symmetry property covered in the next chapter.
Special values
| Expression | Value | Reason |
|---|---|---|
| nC0 | 1 | There is one way to choose nothing |
| nCn | 1 | There is one way to choose everything |
| nC1 | n | Choose any one object |
| nC(n−1) | n | Leave out any one object |
| 0C0 | 1 | The empty selection from an empty set |
Deciding between permutation and combination
Ask one question: if I swap two chosen objects, do I get a different outcome?
- If yes, order matters. Use nPr, or the multiplication principle.
- If no, order does not matter. Use nCr.
Typical signals for combinations are words such as "select", "choose", "committee", "team", "group", "hand of cards", and "subset". Typical signals for permutations are "arrange", "line up", "rank", "president and secretary", "form a word", and "seat in a row".
Roles are the usual trap. Choosing 2 people from 8 for a committee is 8C2 = 28. Choosing a president and a vice-president from the same 8 is 8P2 = 56, because the two jobs are different and swapping the people changes the outcome.
Choosing from several groups
When a selection has parts drawn from different groups, count each part with nCr and multiply the results. Multiplication applies because the choices are independent steps.
Example: A team of 4 is formed from 6 men and 5 women, with exactly 2 men and 2 women.
- Choose the men: 6C2 = 15.
- Choose the women: 5C2 = 10.
- Total: 15 × 10 = 150.
When the problem offers different scenarios, such as "2 men and 2 women, or 3 men and 1 woman", count each scenario separately and add them. This is the addition principle.
- Scenario 1: 6C2 × 5C2 = 150.
- Scenario 2: 6C3 × 5C1 = 20 × 5 = 100.
- Total: 250.
Forcing and excluding specific objects
Two adjustments appear often.
- Include a particular object. Put it in the group, then choose the remaining r − 1 from the other n − 1 objects: (n−1)C(r−1).
- Exclude a particular object. Remove it from the pool, then choose r from the remaining n − 1: (n−1)Cr.
Example: Choose a team of 5 from 9 players. How many teams include a specific player, Dev?
Dev is fixed, so choose 4 more from the other 8: 8C4 = 70.
Teams without Dev: 8C5 = 56. The two cases add up to 70 + 56 = 126 = 9C5, which matches the total number of teams.
Selecting from everything
The total number of subsets of an n-element set, counting the empty set and the full set, is 2ⁿ. Each object is either in or out, giving 2 choices per object.
The number of non-empty selections is 2ⁿ − 1.
Example: From 6 distinct fruits, you may take any number of them but at least one. The number of ways is 2⁶ − 1 = 63.
If the objects are identical, the count changes. From 6 identical apples, the number of non-empty selections is 6, because only the quantity matters. Always check whether the objects are distinct.
Selection followed by arrangement
Many problems ask you to select first and then arrange. Select with nCr, then arrange with r!. This is exactly the relationship nPr = nCr × r!.
Example: How many 3-letter strings of distinct letters can be made from the letters of the word PLAN?
- Choose 3 of the 4 letters: 4C3 = 4.
- Arrange them: 3! = 6.
- Total: 24, which equals 4P3.
Common errors
- Using nPr when order does not matter. This overcounts by a factor of r!.
- Using nCr when roles differ. This undercounts by a factor of r!.
- Writing nCr with the wrong lower index, such as 10C(10−3) when you meant 10C3. The values happen to be equal here, but this confusion causes mistakes in other settings.
- Adding when you should multiply. Independent choices from separate groups multiply. Alternative scenarios add.
- Counting a "specific object included" case twice. If the problem says "at least one of A or B", do not add "A included" and "B included" without removing the overlap.
Worked example: a mixed problem
A panel of 5 is chosen from 7 teachers and 4 students. The panel must have a teacher as chair. In how many ways can it be formed?
Think of it as two steps.
- Choose the chair from the 7 teachers: 7 ways.
- Choose the other 4 members from the remaining 10 people: 10C4 = 210.
Total: 7 × 210 = 1470.
The chair has a distinct role, so choosing the chair is a separate step. The remaining 4 seats have no distinct roles, so they are a combination.
Practice
Exercise
A club has 12 members. In how many ways can a committee of 4 be chosen, and in how many ways can a president, secretary, treasurer and auditor be chosen from the same 12?
Show answer
The committee has no distinct roles, so the count is 12C4 = (12 × 11 × 10 × 9) / 24 = 11880 / 24 = 495. The four offices are distinct, so order matters and the count is 12P4 = 11880. The second answer equals the first multiplied by 4! = 24.
Exercise
A team of 6 is chosen from 5 batters and 7 bowlers, with exactly 3 batters. In how many ways can this be done? How many ways are there if the team must contain a specific bowler, Ravi, and exactly 3 batters?
Show answer
For the first part, choose 3 batters from 5 and 3 bowlers from 7: 5C3 × 7C3 = 10 × 35 = 350. For the second part, Ravi is fixed, so choose 3 batters from 5 and 2 more bowlers from the other 6: 5C3 × 6C2 = 10 × 15 = 150.
Exercise
How many non-empty selections can be made from 8 distinct books? How many if you must take exactly 3 or exactly 5 books?
Show answer
Non-empty selections: 2⁸ − 1 = 255. Exactly 3 or exactly 5 books: 8C3 + 8C5 = 56 + 56 = 112.