Discrete MathematicsCounting: Choices, Arrangements and Selections5 of 7
Counting: Choices, Arrangements and Selections · 5
Casework and Complementary Counting
Multiplying choices works when each slot has a fixed number of options, but many counting problems have rules where one choice changes what is left for the others.
1
When Choices Depend on Earlier Choices: Casework
Using the digits 1,2,3,4, and 5 without repeating any digits, how many 3-digit numbers can we make that are greater than 300 and even?
The first digit must be 3,4, or 5, and the last digit must be 2 or 4. How many choices are left for the last slot depends on whether we already used 4 in the first slot:
When Choices Depend on Earlier Choices: Casework
Text solution
Case 1: Put 4 in the first slotPutting 4 into the first slot uses up one of the even digits, which forces 2 into the last slot and leaves the 3 remaining digits (1,3, and 5) for the middle slot.
1×3×1=3
Case 2: Put 3 or 5 in the first slotKeeping 4 out of the first slot leaves both even digits (2 and 4) available for the last slot, and leaves 3 unused digits for the middle slot.
2×3×2=12
Add the two casesEvery valid number either starts with 4 or starts with 3 or 5, so we add the counts from the two cases.
3+12=15
So there are 15 even 3-digit numbers greater than 300 that can be made from 1,2,3,4, and 5 without repeats.
Starting with 3 or 5 leaves both 2 and 4 available for the last slot, whereas starting with 4 uses up an even digit and leaves only 1 choice for the last slot:
Starting with 3 or 5 leaves both even digits for the last slot, while starting with 4 uses one up and cuts the tree in half.
2
Why Cases Cannot Overlap
Adding cases together only gives the right total when no outcome belongs to two cases at once. Using the letters A, B, and C with repeats allowed, how many 2-letter codes contain at least one A?
Why Cases Cannot Overlap
Text solution
Case 1: A in the first slot, not A in the second slotPutting A first (1 choice) and B or C second (2 choices) counts the codes with a single A at the start.
1×2=2
Case 2: Not A in the first slot, A in the second slotPutting B or C first (2 choices) and A second (1 choice) counts the codes with a single A at the end.
2×1=2
Case 3: A in both slotsPutting A into both slots counts the code AA once on its own.
1×1=1
Add the non-overlapping casesEvery code with at least one A falls into one and only one of these three cases.
2+2+1=5
So there are 5 two-letter codes with at least one A, unlike the overlapping 3+3=6 split that counts AA twice.
3
Complementary Counting: Turning "Or" into "And"
Now let's ask the same question for 4-letter codes from A, B, and C, with repeats allowed: how many 4-letter codes contain at least one A?
Instead of splitting into cases for 1,2,3, or 4 A's, we can count all possible codes and subtract the one case we do not want:
Complementary Counting: Turning "Or" into "And"
Text solution
Count all 4-letter codes with no restrictionsEach of the 4 slots can be A, B, or C.
3×3×3×3=81
Count the unwanted codes with zero A'sLeaving out A gives 2 choices (B or C) for the first slot, and 2 for the second, and 2 for the third, and 2 for the fourth.
2×2×2×2=16
Subtract the unwanted codes from the totalRemoving the codes with no A's leaves all the codes that have 1,2,3, or 4 A's.
81−16=65
So 65 of the 81 four-letter codes contain at least one A.
4
Counting Repeats by Counting No Repeats
The same switch from "or" to "and" works when we want to count repeated digits. Using the ten digits 0 through 9, how many 4-digit PINs have at least one repeated digit?
Counting Repeats by Counting No Repeats
Text solution
Count all 4-digit PINsAny of the 10 digits (0 through 9) can go into each of the 4 slots.
10×10×10×10=10,000
Count the unwanted PINs with no repeated digitsFor all four digits to be different, each slot must avoid the digits already used in earlier slots.
10×9×8×7=5,040
Subtract the no-repeat PINs from the totalEvery remaining PIN repeats at least one digit.
10,000−5,040=4,960
So there are 4,960 four-digit PINs with at least one repeated digit.
5
Using Complementary Counting and Casework Together
Sometimes switching to the opposite condition still leaves more than one unwanted case, so we use complementary counting and casework together. Still using A, B, and C with repeats allowed, how many 4-letter codes have at least two A's?
Using Complementary Counting and Casework Together
Text solution
Count all 4-letter codesEach of the 4 slots has 3 choices (A, B, or C).
3×3×3×3=81
Unwanted Case 1: Zero A'sEvery slot must be B or C, giving 2 choices per slot.
2×2×2×2=16
Unwanted Case 2: Exactly one AThe single A can go into any of the 4 positions, and each position has 1 choice for the A slot and 2 choices (B or C) for each of the other three slots.
4×(1×2×2×2)=4×8=32
Add the unwanted cases and subtract from the totalRemoving the codes with 0 A's or 1 A leaves the codes with 2,3, or 4 A's.
81−(16+32)=81−48=33
So there are 33 four-letter codes with at least two A's.
The five cases (0,1,2,3, or 4 A's) split all 81 codes into non-overlapping groups, so the wanted cases and the unwanted cases always add to 81:
Across all five non-overlapping cases, the codes we want and the codes we don't want always add up to all 81 codes.
6
Casework and Complementary Counting with Combinations
All our problems so far have filled ordered slots, so now let's choose an unordered group: from 5 Programmers and 4 Designers (9 people in all), how many 4-person teams have at least one Programmer?
Since order does not matter on a team, we use combinations C(n,k) to pick unordered groups all at once:
Casework and Complementary Counting with Combinations
Text solution
Method 1: Split into cases by the exact number of ProgrammersPick all Programmers for a case in one combination and all Designers in another, then add the four non-overlapping cases (1,2,3, or 4 Programmers).
Method 2: Subtract the unwanted case from all possible teamsOut of all C(9,4)=126 four-person teams, only C(4,4)=1 team has 0 Programmers and 4 Designers.
C(9,4)−C(4,4)=126−1=125
So there are 125 four-person teams with at least one Programmer (and for at least two Programmers, subtracting the 1 zero-Programmer team and the 20 one-Programmer teams gives 126−1−20=105).
Picking one "guaranteed" Programmer first and 3 of the remaining 8 people second counts every team with 2,3, or 4 Programmers 2,3, or 4 separate times, whereas grouping by the exact number of Programmers counts each team once:
Picking a Programmer first counts the same team once for each Programmer on it, while grouping by how many Programmers there are counts the team once.
Key concepts
When not to use casework
If the number of options in every step stays the same regardless of earlier choices, multiply straight across on a single line (forming a 3-digit number from 1,2,3,4,5 with no extra rules is simply 5×4×3=60).
Dependent choices ("it depends" → Casework)
When an option can go in two restricted slots, put that overlapping option into its own case so the number of choices inside each case stays fixed (for even 3-digit numbers >300 from 1,2,3,4,5, separate starting with 4,1×3×1=3, from starting with 3 or 5,2×3×2=12).
Non-overlapping cases
Define cases so no outcome can belong to two cases at once: either specify which slots hold the item (A, not A;not A, A;A, A) or split by the exact count of the item (0,1,2,3, or 4 A's).
Turning "ors" into "ands" ("at least" or "repeats" → Complementary counting)
Subtract the unwanted cases from the total whenever switching to the opposite condition turns multiple "or" cases into a single line of "ands" (4-letter codes from A, B, C with at least one A: 81−16=65;4-digit PINs with a repeat: 10,000−5,040=4,960) or leaves fewer cases to count (at least two A's subtracts 0 A's and 1 A: 81−(16+32)=33).
Unordered groups with combinations
Never make a separate first step for a required member (C(5,1)×C(8,3)=280 counts every team with multiple Programmers more than once). Either subtract the unwanted cases from all C(n,k) teams (C(9,4)−C(4,4)=126−1=125) or add the cases for each exact number from each subgroup (C(5,1)×C(4,3)+…).
7
Practice
1
Using the digits 1,2,3,4,5, and 6 without repeating any digits, how many 3-digit numbers can you make that are greater than 400 and odd?
Do not multiply 3×4×3=36 on a single line, because picking 5 first leaves only 2 odd digits for the last slot instead of 3.
List the allowed digits for the first slot (>400) and the last slot (odd). Which digit shows up in both lists?
The first digit must be 4,5, or 6 and the last digit must be 1,3, or 5. Do not multiply 3×4×3=36 on a single line, because picking 5 first leaves only 2 odd digits for the last slot instead of 3. Split into cases based on whether the first digit is 5:
Case 1 (first digit is 5)1 choice for the first slot (5), 2 remaining odd digits for the last slot (1 or 3), and 4 remaining digits for the middle slot:
1×4×2=8
Case 2 (first digit is 4 or 6)2 choices for the first slot (4 or 6), all 3 odd digits available for the last slot (1,3, or 5), and 4 remaining digits for the middle slot:
2×4×3=24
Add the two cases
8+24=32
2
A 5-letter code is made using the letters A, B, C, D, and E, with repeats allowed. How many codes contain at least one vowel (A or E)?
Be careful not to leave out only one vowel, which uses 45=1,024 and gives 2,101.Be careful not to pick a vowel for one slot first as 5×2×54=6,250, which counts codes with multiple vowels more than once.
Instead of tracking which slots hold A or E, how many letters are left if a code uses no vowels at all?
Total 5-letter codesEach of the 5 slots has 5 choices:
5×5×5×5×5=55=3,125
Unwanted codes (no vowels)Leave out both vowels (A and E), which leaves the 3 consonants B, C, and D for every slot (be careful not to leave out only one vowel, which uses 45=1,024 and gives 2,101, or pick a vowel for one slot first as 5×2×54=6,250, which counts codes with multiple vowels more than once):
3×3×3×3×3=35=243
Subtract from the total
3,125−243=2,882
3
How many 4-digit numbers (from 1,000 to 9,999, so the first digit cannot be 0) have at least one repeated digit?
Using 8 choices for the second slot as 9×8×7×6=3,024 forgets 0 and gives the wrong answer 5,976.
Count all 4-digit numbers first, then subtract the ones where all four digits are different, remembering which digit becomes allowed again in the second slot.
Total 4-digit numbersThe first slot has 9 choices (1 through 9) and the remaining three slots have 10 choices each (0 through 9):
9×10×10×10=9,000
Unwanted numbers (no repeated digits)The first slot has 9 choices (1 through 9). Because 0 can now be used along with the 8 unused nonzero digits, the second slot also has 9 choices, followed by 8 and 7 (using 8 choices for the second slot as 9×8×7×6=3,024 forgets 0 and gives the wrong answer 5,976):
9×9×8×7=4,536
Subtract from the total
9,000−4,536=4,464
4
A 5-digit passcode is made using the digits 1,2,3, and 4, with repeats allowed. How many passcodes contain the digit 1 at least twice?
Be careful not to count only the case where 1 is in the first slot (1×34=81, which misses the other 4 positions and gives the wrong answer 700).
Out of the 0,1,2,3,4, or 5 times the digit 1 can appear, which two cases are the ones you do not want?
Total 5-digit passcodesEach of the 5 slots has 4 choices:
45=1,024
Unwanted Case 1 (no 1's)Each slot uses only 2,3, or 4:
35=243
Unwanted Case 2 (exactly one 1)The single 1 can go into any of the 5 slots, and the other 4 slots each have 3 choices (2,3, or 4). Be careful not to count only the case where 1 is in the first slot (1×34=81, which misses the other 4 positions and gives the wrong answer 700):
5×34=5×81=405
Subtract both unwanted cases from the total
1,024−(243+405)=1,024−648=376
5
A club has 6 seniors and 5 juniors. How many ways can a 4-person committee be chosen if it must include at least one senior and at least one junior?
Remember to subtract both all-one-group cases rather than only the all-senior case (330−15=315).Avoid picking 1 senior and 1 junior first and then 2 of the remaining 9 people, 6×5×C(9,2)=1,080, which counts every valid committee multiple times.
If a 4-person committee does not have at least one of each, what are the only two ways that committee can be made up?
Total 4-person committees from all 11 members(Avoid picking 1 senior and 1 junior first and then 2 of the remaining 9 people, 6×5×C(9,2)=1,080, which counts every valid committee multiple times.)
C(11,4)=330
Unwanted committeesA committee breaks the rule if it has no juniors (all 4 are seniors) or no seniors (all 4 are juniors). Remember to subtract both all-one-group cases rather than only the all-senior case (330−15=315):
C(6,4)+C(5,4)=15+5=20
Subtract from the total
330−20=310
6
From a group of 6 doctors and 5 nurses, a 5-person medical team is chosen. How many teams have more doctors than nurses?
Do not forget that a team with 0 nurses still has more doctors than nurses (leaving out this case stops at 200+75=275).
On a 5-person team, what exact numbers of doctors make the doctors outnumber the nurses?
Split into non-overlapping cases by the exact number of doctors on the 5-person team (3,4, or 5 doctors):
Case 1 (3 doctors and 2 nurses)
C(6,3)×C(5,2)=20×10=200
Case 2 (4 doctors and 1 nurse)
C(6,4)×C(5,1)=15×5=75
Case 3 (5 doctors and 0 nurses)Do not forget that a team with 0 nurses still has more doctors than nurses (leaving out this case stops at 200+75=275):