Discrete MathematicsCounting: Choices, Arrangements and Selections3 of 7
Counting: Choices, Arrangements and Selections · 3
Combinations: Choosing Subsets
Slots count how many ways we can put items in a specific order, and now we need a way to count unordered groups where the order we pick the items in doesn't matter.
1
Dividing Out the Scrambling and the (kn) Formula
Suppose we have 5 people, A,B,C,D, and E, and 3 tickets to a concert, or a deck of 10 cards from which we deal a 4-card hand. We want to find how many different groups we can choose when rearranging the same items gives the exact same group.
If order did matter, we would fill 3 ordered slots from the 5 people in 5×4×3=60 ways. Because everyone chosen gets into the same car regardless of when their name was called, we need to see how many times each group of 3 is repeated inside those 60 slot outcomes.
Dividing Out the Scrambling and the (n choose k) Formula
All 3×2×1=6 ways of ordering the same three people in the slots give the same group in the car, bundling the 60 slot outcomes into 10 groups of 6.
Rearranging the same three people in the slots only steps through the 6 rows inside one box, while the group in the car stays the same.
Now let's record the steps for counting the 4-card hands dealt from a deck of 10 cards.
Text solution
Fill 4 ordered slots from the 10 cardsPretend order matters first so we can count the slot arrangements.
10×9×8×7
Divide by the 4! ways to scramble a 4-card handAny chosen set of 4 cards can be dealt in 4×3×2×1 different orders, so dividing bundles each box of duplicates into one hand.
Hands=4×3×2×110×9×8×7
Cancel the denominator into the top before multiplyingBecause the final answer must be a whole number, the bottom always divides cleanly into the top: 4×2=8 cancels the 8 on top, and 3 divides into 9 to leave 3.
4×3×2×110×9×8×7=10×3×7=210
So there are 210 different 4-card hands from a 10-card deck.
We write the number of ways to choose an unordered subset of k items from n items using the symbol below (there is no fraction bar between the n and the k; read it as the question, "from n items, how many ways can I choose a group of k?"):
read "n choose k"(kn)=scrambles of the k itemsk!n(n−1)⋯(n−k+1)k slots stepping down=k!(n−k)!n!
In the factorial form on the right, dividing n! by (n−k)! simply cancels the factors from (n−k) down to 1 so that only the k slots on top remain:
When you need to calculate an actual number, skip the three factorials: write k numbers stepping down on top, put k! on the bottom, and cancel before multiplying.
2
Symmetry: Choosing What to Leave Behind
Writing k slots on top and k! on the bottom is a lot of work when k is large. For example, suppose there are 100 cookies on a table and we want to find (98100), the number of ways to choose 98 cookies to pack into a box.
Symmetry: Choosing What to Leave Behind
Text solution
Switch from the 98 cookies packed to the 2 cookies left behindEvery selection of 98 cookies to take leaves behind one exact pair of cookies on the table.
(98100)=(100−98100)=(2100)
Put 2 slots on top and 2! on the bottomCancel the 2 into 100 before multiplying.
(2100)=2×1100×99=50×99=4950
So there are 4950 ways to choose 98 of the 100 cookies.
In any lineup of n items, circling k items to take automatically leaves the remaining n−k items behind, pairing every subset of size k one-to-one with a subset of size n−k.
Choosing a group to take automatically sets the group left behind, pairing every possible group you could take with the exact group it leaves behind.
This same pairing explains the two extreme cases: taking all n items is the same decision as leaving 0 behind, and there is only 1 way to take everything (or to take nothing and leave with the empty group):
(kn)=(n−kn),(nn)=(0n)=1
3
Combining Pools with "And," "Or," and "At Least One"
So far we have chosen a single group from one pool. Now suppose a company has two separate pools, 6 developers and 4 designers (10 people in total), and we want to count how many ways we can form:
A 5-person project team with 3 developers and2 designers.
A 4-person project team with at least 1 designer.
Combining Pools with "And," "Or," and "At Least One"
Picking one "guaranteed" designer first and then choosing 3 more people from the remaining 9((14)×(39)) counts every multi-designer team once for each designer on it, because swapping which designer was picked first gives the exact same 4-person team.
Picking one "guaranteed" designer first and mixing the other designers into the remaining pool counts every multi-designer team once for each designer on it.
Here are the steps for both team rules while keeping the pools separate.
Text solution
Multiply the two pool choices for "3 developers and 2 designers."Each of the (36) developer groups can be paired with each of the (24) designer groups to complete a team.
(36)×(24)=3×2×16×5×4×2×14×3=20×6=120
Count all unrestricted 4-person teams and the 0-designer teamsFor a 4-person team with at least 1 designer, the only forbidden outcome among all (410) teams is choosing all 4 members from the 6 developers.
(410)=210,(46)=(26)=2×16×5=15
Subtract the 0-designer teams from the totalRemoving the all-developer teams leaves every 4-person team with 1,2,3, or 4 designers.
(410)−(46)=210−15=195
So there are 120 teams with 3 developers and 2 designers, and 195 four-person teams with at least 1 designer. Splitting "at least 1 designer" into non-overlapping cases by the exact number of designers ("1 designer or2 designers or3 designers or4 designers") adds to the same count:
Now suppose the rule isn't about categories like developers and designers, but about specific individuals among the 10 people when forming a 4-person team:
Alice must be on the team.
Bob cannot be on the team.
Alice and Bob refuse to serve together on the same team.
Rules About Specific People
Text solution
Put a required person on the team before counting (Alice must be in)Putting Alice into one of the 4 spots leaves 3 empty spots to fill from the remaining 9 people.
(4−110−1)=(39)=3×2×19×8×7=84
Cross off an excluded person before counting (Bob must be out)Removing Bob from the pool of 10 people leaves all 4 spots to fill from the remaining 9 people.
(410−1)=(49)=4×3×2×19×8×7×6=126
Subtract the teams that include both people (Alice and Bob together)Putting both Alice and Bob on the team leaves 2 spots to fill from the other 8 people, and subtracting those (28) forbidden teams from all (410) teams leaves the valid teams.
(410)−(28)=210−2×18×7=210−28=182
So there are 84 teams with Alice, 126 teams without Bob, and 182 teams where Alice and Bob do not serve together. Setting Alice and Bob aside so 8 people remain and adding the three non-overlapping valid cases gives the same result:
Alice in, Bob out(38)+Bob in, Alice out(38)+both out(48)=56+56+70=182
5
Combinations in Disguise: Bit Strings, Grid Paths, and Networks
Combinations also count outcomes in problems that don't look like picking a committee at all. We want to find:
How many 8-bit strings (sequences of eight 0s and 1s) contain exactly three 1s.
How many shortest paths walk from the bottom-left corner to the top-right corner of a 4-by-3 city street grid moving only Right (R) and Up (U).
How many direct cables are needed to connect every pair among 6 computers in a network.
Combinations in Disguise: Bit Strings, Grid Paths, and Networks
Every corner-to-corner path across the 4-by-3 grid is completely determined by the 3-element subset of step numbers in {1,2,3,4,5,6,7} where the path steps Up, leaving the other 4 steps to go Right.
Picking a path across the grid is the same as picking which 3 of its 7 steps go Up.
Text solution
Choose 3 of the 8 bit positions to hold 1sStarting with eight 0s in boxes 1 through 8, an 8-bit string with three 1s is completely determined by which subset of 3 box numbers we flip to 1.
(38)=3×2×18×7×6=56
Choose 3 of the 7 total steps to go UpEvery path across the 4-by-3 grid takes 4+3=7 steps in total, and choosing which 3 step slots get a U (or which 4 get an R) fixes the entire route.
(37)=(47)=3×2×17×6×5=35
Choose 2 of the 6 computers as the endpoints of a cableEach cable connects one unordered pair of computers, so the number of cables equals the number of 2-computer subsets.
(26)=2×16×5=15
So there are 56 eight-bit strings with three 1s, 35 shortest paths across the 4-by-3 grid, and 15 cables connecting the 6 computers.
6
Counting Subsets by Size: Why the Combinations Add Up to 2n
Each (kn) counts the subsets of one fixed size k. Now we want to find what happens when we add the combinations across every possible subset size from k=0 to k=n.
Remember from power sets that building a subset of any size from n items means walking down the line of n items and making a Yes-or-No choice ("in" or "out") for each one, which gives n choices2×2×⋯×2=2n subsets in total.
Counting Subsets by Size: Why the Combinations Add Up to 2ⁿ
Sorting all 2n subsets into piles by how many items were chosen (0 items, 1 item, 2 items, all the way up to n items) gives the sum of all combinations for a set of size n:
For n=3 items {A,B,C}, the piles of size 0,1,2, and 3 add up to:
(03)+(13)+(23)+(33)=1+3+3+1=8=23
Key concepts
Whenever you set up a counting problem, ask first whether swapping two chosen items changes the final outcome. If 3 people out of 5 receive Gold, Silver, and Bronze medals, order matters, so do not use combinations; stop at the ordered slots (5×4×3=60). If those 3 people are simply riding in a car together, order doesn't matter, so divide the k slots by k! to bundle the scrambles into one group:
When k is more than half of n, switch to counting the n−k items left behind ((kn)=(n−kn), turning (98100) into (2100)=4950, with (nn)=(0n)=1 at the ends).
To combine pools or handle restrictions:
And vs. Or
Multiply combinations when completing stages of a single group ((36)(24) for 3 developers and2 designers), and add them when splitting into non-overlapping cases.
At least one / People who won't serve together
Subtract the forbidden teams from the unrestricted total ((410)−(46) for at least 1 designer; (410)−(28) when two specific people refuse to serve together) rather than picking one "guaranteed" person first and mixing the rest of their pool into the second step.
Specific people required or excluded
Handle them before writing the combination: put a required person on the team to reduce both n and k((39)), and cross off an excluded person to reduce only n((49)).
Disguised subsets and all sizes at once
Count subsets of positions whenever choosing where a feature goes determines the outcome ((38) for 8-bit strings with three 1s, (34+3)=(37) for paths across a 4-by-3 grid, and (26) for cables among 6 nodes). When a problem spans nearly all subset sizes of n items, start with (0n)+(1n)+⋯+(nn)=2n and subtract the disallowed sizes.
7
Practice
1
A summer reading list has 12 books, and you want to choose 4 of them to pack for a trip. How many different sets of 4 books can you choose?
Watch out for stopping at the ordered slots 12×11×10×9=11,880: divide by 4! on the bottom to remove the scrambling of the 4 chosen books.Watch out for dividing by 4 instead of 4!=24 to get 2970.
Does the order you toss the 4 books into your bag change which books are on the trip? Put 4 slots on top starting from 12, then divide by the ways to scramble those 4 books.
Set up 4 slots on top from the 12 books and divide by 4! on the bottom to remove the scrambling of the 4 chosen books (watch out for stopping at the ordered slots 12×11×10×9=11,880, or dividing by 4 instead of 4!=24 to get 2970):
(412)=4×3×2×112×11×10×9=11×5×9=495
2
A quality-control inspector tests a batch of 50 microchips and needs to select 48 of them to ship. In how many ways can the inspector choose the 48 microchips?
Be careful not to forget the 2! in the denominator, which would count the 2 rejected chips in order and give 50×49=2450.
Instead of choosing which 48 microchips go into the shipping box, how many microchips is the inspector choosing to leave behind?
By symmetry, choosing 48 microchips to ship is the same decision as choosing 50−48=2 microchips to leave behind (be careful not to forget the 2! in the denominator, which would count the 2 rejected chips in order and give 50×49=2450):
(4850)=(250)=2×150×49=25×49=1225
3
An animal shelter has 7 dogs and 5 cats. How many different ways can you adopt a group of 3 dogs and 2 cats?
Don't add the two counts to get 35+10=45, which would count adopting 3 dogs or2 cats rather than both.
Count the combinations from the dog pool and the cat pool separately, then decide whether adopting 3 dogs and2 cats means adding or multiplying the two stages.
Choose 3 dogs from 7 and 2 cats from 5, then multiply the two stages because every group of 3 dogs can be paired with every group of 2 cats (don't add the two counts to get 35+10=45, which would count adopting 3 dogs or2 cats rather than both):
(37)×(25)=3×2×17×6×5×2×15×4=35×10=350
4
A research lab has 8 biologists and 5 chemists (13 scientists in total). How many ways can you form a 4-person committee that includes at least 1 chemist?
Avoid picking 1 "guaranteed" chemist first and 3 from the remaining 12 scientists to get (15)(312)=5×220=1100, which overcounts every committee with two or more chemists.
What is the only kind of 4-person committee from the 13 scientists that fails the "at least 1 chemist" rule?
Count all unrestricted 4-person committees from the 13 scientists and subtract the committees with 0 chemists, where all 4 members are chosen from the 8 biologists (avoid picking 1 "guaranteed" chemist first and 3 from the remaining 12 scientists to get (15)(312)=5×220=1100, which overcounts every committee with two or more chemists):
From a club of 11 members, you are choosing a 5-person delegation. Maya must be on the delegation, while Leo and Nora refuse to serve on the delegation together. How many valid 5-person delegations can be formed?
Watch out for forgetting that Maya already takes up a spot and subtracting (38)=56 to get 154.Watch out for crossing both Leo and Nora off at the same time to get (48)=70, which leaves out delegations where one of them serves without the other.
Put Maya on the delegation first so you are filling the remaining spots from the other 10 members. From that count, how many delegations break the rule by also including both Leo and Nora?
Put Maya on the delegation first, leaving 4 spots to fill from the remaining 10 members in (410)=210 ways. Then subtract the forbidden delegations that also include both Leo and Nora: with Maya, Leo, and Nora all on the delegation, there are 2 spots left to fill from the other 8 members in (28)=28 ways (watch out for forgetting that Maya already takes up a spot and subtracting (38)=56 to get 154, or crossing both Leo and Nora off at the same time to get (48)=70, which leaves out delegations where one of them serves without the other):
(410)−(28)=210−28=182
6
How many 10-bit strings (sequences of ten 0s and 1s) contain at most two 1s?
Don't forget the all-zeros string 0000000000 for zero 1s or treat (010) as 0, which would give 10+45=55.
"At most two 1s" splits into non-overlapping cases based on how many of the 10 positions hold a 1. What are the possible counts of 1s?
Split into three non-overlapping cases by the number of 1s (zero 1s, one 1, or two 1s) and add them up (don't forget the all-zeros string `0000000000` for zero 1s or treat (010) as 0, which would give 10+45=55):
(010)+(110)+(210)=1+10+2×110×9=1+10+45=56
7
On a city street grid, you start at the bottom-left corner (0,0) and walk 6 blocks East (Right) and 4 blocks North (Up) to (6,4), moving only Right and Up. How many paths pass through the coffee shop located 3 blocks East and 2 blocks North at (3,2)?
Multiply the two stages because any first-leg path can be paired with any second-leg path (don't add the two legs to get 10+10=20).
Break the walk into two stages, from (0,0) to (3,2)and then from (3,2) to (6,4), and count how many Right and Up steps each leg takes.
Walking from (0,0) to (3,2) takes 3+2=5 steps with 2 Up steps ((25)=10 paths), and walking the remaining 3 blocks East and 2 blocks North from (3,2) to (6,4) also takes 5 steps with 2 Up steps ((25)=10 paths). Multiply the two stages because any first-leg path can be paired with any second-leg path (don't add the two legs to get 10+10=20):
(25)×(25)=10×10=100
8
Ten towns are building direct point-to-point fiber-optic cables so that every pair of towns is connected. Four of the towns are on an island and already have all the cables connecting them to one another built. How many more cables need to be built to finish connecting all 10 towns?
Avoid subtracting the 4 island towns from the pool first and computing (210−4)=(26)=15, which leaves out the 4×6=24 cables needed to connect the 4 island towns to the 6 mainland towns.
How many cables are needed to connect all 10 towns in total, and how many of those cables are the ones already built among the 4 island towns?
Connecting all 10 towns requires (210)=45 cables in total, and the 4 island towns already have (24)=6 cables among themselves (avoid subtracting the 4 island towns from the pool first and computing (210−4)=(26)=15, which leaves out the 4×6=24 cables needed to connect the 4 island towns to the 6 mainland towns):
(210)−(24)=2×110×9−2×14×3=45−6=39
9
A pizza shop offers 8 toppings. Using the total number of subsets of an 8-element set, find how many ways you can order a pizza with at least 2 toppings if you cannot order all 8 toppings at once.
Be careful not to overlook the 0-topping plain pizza (08)=1, which would leave 256−8−1=247.
Start with all 28 subsets across every topping count from 0 to 8. Which specific subset sizes are ruled out by "at least 2 toppings" and "not all 8 toppings"?
The sum of (k8) over all sizes k from 0 to 8 is 28=256. Subtract the disallowed sizes: 0 toppings ((08)=1), 1 topping ((18)=8), and all 8 toppings ((88)=1) (be careful not to overlook the 0-topping plain pizza (08)=1, which would leave 256−8−1=247):