Discrete MathematicsCounting: Choices, Arrangements and Selections6 of 7
Counting: Choices, Arrangements and Selections · 6

Counting by Bijection

Some sets are too tangled or constrained to count directly, so we pair their items one-to-one with a simpler set we already know how to count.

Counting by Bijection and the Reverse Test
#people=?#seats\#\text{people} \htmlClass{lc-violet}{\overset{?}{=}} \#\text{seats}
1

Subsets as Binary Strings

First, we want to find the total number of subsets we can make from {A,B,C,D}\{A, B, C, D\}, and more generally from a set of nn items. Listing subsets by size forces us to add up separate cases from size 00 to size nn because the subsets keep changing size, so instead we turn every subset into a fixed-length string of zeros and ones.

Subsets as Binary Strings
{A,B,C,D}#subsets=  ?\{A, B, C, D\} \quad \#\text{subsets} = \thickspace ?
size 0\htmlClass{lc-mute}{\text{size } 0}
{ }\{\ \}
size 1\htmlClass{lc-mute}{\text{size } 1}
{A}{B}⋯\{A\}\quad \{B\}\quad \htmlClass{lc-mute}{\cdots}
size 2\htmlClass{lc-mute}{\text{size } 2}
{A,C}⋯\{A, C\}\quad \htmlClass{lc-mute}{\cdots}
size 3\htmlClass{lc-mute}{\text{size } 3}
{A,B,D}⋯\{A, B, D\}\quad \htmlClass{lc-mute}{\cdots}
size 4\htmlClass{lc-mute}{\text{size } 4}
{A,B,C,D}\{A, B, C, D\}
Text solution
Translate each subset into a 44-digit binary stringPut a slot under each of the 44 letters and write 1\counted{1} if the letter is in the subset or 00 if it is out.
subset {A,C}  ⟷  1⏟A  0⏟B  1⏟C  0⏟D\displaystyle \begin{aligned} &\text{subset } \{A, C\} \; \\ \pairs{\longleftrightarrow}\; &\underbrace{\counted{1}}_{A}\;\underbrace{0}_{B}\;\underbrace{\counted{1}}_{C}\;\underbrace{0}_{D} \end{aligned}
Invert with the Reverse TestAny 44-digit string of 00s and 1\counted{1}s picks out the exact subset of letters that have a 1\counted{1} under them.
0101  ⟷  {B,D}\displaystyle 0\counted{1}0\counted{1} \;\pairs{\longleftrightarrow}\; \{B, D\}
Count the slots by the product ruleEach of the 44 independent slots has 22 choices (00 or 1\counted{1}), and for nn items each of the nn slots has 22 choices.
2×2×2×2=24=16,2×2×⋯×2⏟n slots=2n\displaystyle \begin{aligned} 2 \times 2 \times 2 \times 2 &= 2^4 = \counted{16}, \\ \underbrace{2 \times 2 \times \dots \times 2}_{n\text{ slots}} &= \counted{2^n} \end{aligned}

So {A,B,C,D}\{A, B, C, D\} has 16\counted{16} subsets, and a set of nn items has 2n\counted{2^n} subsets in total.

2

Pairing Two Sets Directly

We now know a set of nn items has 2n\counted{2^n} subsets in total, and for n≥1n \ge 1 we want to find how many of those subsets have an even number of elements and how many have an odd number of elements. Rather than translating subsets into strings, we can pair the two collections with each other directly to show they have the exact same size.

Pairing Two Sets Directly
(103)\htmlClass{lc-blue}{\dbinom{10}{3}}
?\htmlClass{lc-mute}{?}
(107)\htmlClass{lc-pink}{\dbinom{10}{7}}
Text solution
Pair complements to see equal sizesJust as picking 3\first{3} of 1010 people for a committee leaves behind a unique group of 7\second{7} people who stay home, a direct pairing shows two sets have the same count without a formula.
(103)\displaystyle \first{\binom{10}{3}} =(107)\displaystyle = \second{\binom{10}{7}}
Flip one fixed element A\pairs{A}Pick one item A\pairs{A} from the nn items, and put A\pairs{A} in if it is absent or take A\pairs{A} out if it is already present, which changes the subset's size by ±1\pm 1 and turns every even subset into an odd subset.
Even subset {B,C}  ⟷flip A  Odd subset {A,B,C}\displaystyle \begin{aligned} &\first{\text{Even}}\text{ subset } \{B, C\} \; \\ \pairs{\underset{\text{flip } A}{\longleftrightarrow}}\; &\second{\text{Odd}}\text{ subset } \{\pairs{A}, B, C\} \end{aligned}
Split the 2n\counted{2^n} subsets into two equal halvesFlipping A\pairs{A} a second time returns the original subset, so even and odd subsets match one-to-one and divide the total count in half.
2n2\displaystyle \frac{\counted{2^n}}{2} =2n−1\displaystyle = \counted{2^{n-1}}

So a set of nn items has 2n−1\counted{2^{n-1}} subsets of even size and 2n−1\counted{2^{n-1}} subsets of odd size.

3

Grid Paths as Words

Now let's count paths on a grid: on a city grid that is 4\first{4} blocks wide and 3\second{3} blocks tall, we want to find the number of paths from the bottom-left corner to the top-right corner using only Right (R\first{R}) and Up (U\second{U}) steps.

4\htmlClass{lc-blue}{4}
3\htmlClass{lc-pink}{3}
R\htmlClass{lc-blue}{R}
R\htmlClass{lc-blue}{R}
U\htmlClass{lc-pink}{U}
R\htmlClass{lc-blue}{R}
U\htmlClass{lc-pink}{U}
R\htmlClass{lc-blue}{R}
U\htmlClass{lc-pink}{U}
Grid Paths as Words
#paths=  ?\#\text{paths} = \thickspace ?
4\htmlClass{lc-blue}{4}
3\htmlClass{lc-pink}{3}
start\htmlClass{lc-mute}{\text{start}}
goal\htmlClass{lc-mute}{\text{goal}}
R\htmlClass{lc-blue}{R}
U\htmlClass{lc-pink}{U}
Text solution
Write each path as a 77-letter wordEvery valid path to the top-right corner must move 4\first{4} blocks right and 3\second{3} blocks up in some order, which translates into a 77-letter word made of four R\first{R}'s and three U\second{U}'s.
Path on 4×3 grid  ⟷  R R U R U R U(4 R’s,  3 U’s)\displaystyle \begin{aligned} &\text{Path on } \first{4} \times \second{3} \text{ grid} \; \\ \pairs{\longleftrightarrow}\; &\first{R}\,\first{R}\,\second{U}\,\first{R}\,\second{U}\,\first{R}\,\second{U} \\ &(\first{4\text{ }R\text{'s}},\; \second{3\text{ }U\text{'s}}) \end{aligned}
Choose which 3\second{3} of the 77 slots get a U\second{U}Any 77-letter word with four R\first{R}'s and three U\second{U}'s traces a unique path on the grid, and placing the three U\second{U}'s automatically puts the four R\first{R}'s into the remaining slots.
(73)\displaystyle \binom{7}{\second{3}} =7×6×53×2×1\displaystyle = \frac{7 \times 6 \times 5}{3 \times 2 \times 1} =35\displaystyle = \counted{35}

So there are 35\counted{35} valid paths from the bottom-left corner to the top-right corner of the 4\first{4}-by-3\second{3} grid.

Every valid path from the bottom-left corner to the top-right corner uses the exact same four R\first{R}'s and three U\second{U}'s, so choosing which 3\second{3} of the 77 step slots get a U\second{U} locks in the entire path on the grid.

Every path across the 4-by-3 grid uses the same four R's and three U's, so picking which 3 of the 7 slots get a U sets the whole path.
4

Squeezing Out Mandatory Spacers

Next, suppose we have 1010 chairs in a row and want to find the number of ways to choose 4\first{4} chairs so that no two chosen chairs sit right next to each other. We cannot count the choices one chair at a time because a chair at the end of the row blocks only one neighbor while a chair in the middle blocks two, so we build a bijection that removes the spacing rule.

Squeezing Out Mandatory Spacers
#ways to choose 4 chairs=  ?\#\text{ways to choose } \htmlClass{lc-blue}{4} \text{ chairs} = \thickspace ?
no two chosen chairs adjacent\text{no two chosen chairs adjacent}
1\htmlClass{lc-mute}{1}
2\htmlClass{lc-mute}{2}
3\htmlClass{lc-mute}{3}
4\htmlClass{lc-mute}{4}
5\htmlClass{lc-mute}{5}
6\htmlClass{lc-mute}{6}
7\htmlClass{lc-mute}{7}
8\htmlClass{lc-mute}{8}
9\htmlClass{lc-mute}{9}
10\htmlClass{lc-mute}{10}
Text solution
Squeeze out the 3\leftover{3} mandatory empty spacersBecause at least 1\leftover{1} empty chair must sit right after each of the first 3\first{3} chosen chairs (X\first{X}), removing those 3\leftover{3} mandatory spacer chairs shrinks the arrangement to 77 chairs with no spacing rules.
X X‾ _ X X‾ X X‾ _ _ X(10 chairs)  ⟷remove 3 spacersinsert 3 spacers  X _ X X _ _ X(10−3=7 chairs)\displaystyle \begin{gathered} \first{X}\,\leftover{\underline{\phantom{X}}}\,\_\,\first{X}\,\leftover{\underline{\phantom{X}}}\,\first{X}\,\leftover{\underline{\phantom{X}}}\,\_\,\_\,\first{X} \\ (10\text{ chairs}) \\ \;\pairs{\underset{\text{insert } \leftover{3}\text{ spacers}}{\overset{\text{remove } \leftover{3}\text{ spacers}}{\longleftrightarrow}}}\; \\ \first{X}\,\_\,\first{X}\,\first{X}\,\_\,\_\,\first{X} \\ (10 - \leftover{3} = 7\text{ chairs}) \end{gathered}
Put the spacers back in (Reverse Test)Taking any 4\first{4} chair positions c1<c2<c3<c4c_1 < c_2 < c_3 < c_4 in the 77-chair row and inserting 1\leftover{1} empty chair after each of the first three shifts their seat numbers so they are guaranteed to be at least 22 apart in the 1010-chair row.
c1<c2<c3<c4  ⟷  c1,  c2+1,  c3+2,  c4+3\displaystyle \begin{aligned} &c_1 < c_2 < c_3 < c_4 \; \\ \pairs{\longleftrightarrow}\; &c_1,\; c_2 \leftover{{} + 1},\; c_3 \leftover{{} + 2},\; c_4 \leftover{{} + 3} \end{aligned}
Choose 4\first{4} chairs freely from the 77-chair rowEvery free choice of 4\first{4} chairs out of 77 matches a unique spaced-out choice in the 1010-chair row.
(74)\displaystyle \binom{7}{\first{4}} =7×6×5×44×3×2×1\displaystyle = \frac{7 \times 6 \times 5 \times 4}{4 \times 3 \times 2 \times 1} =35\displaystyle = \counted{35}

So there are 35\counted{35} ways to choose 4\first{4} non-adjacent chairs from a row of 1010.

Even when chosen chairs sit side by side in the 77-chair row, inserting the 3\leftover{3} spacer chairs always pushes them at least one empty chair apart in the 1010-chair row.

Putting one empty spacer chair after each of the first three chosen chairs turns any 7-chair choice with no spacing rule into its own spaced-out 10-chair choice.
5

Hidden Pairings in Tournaments and Circles

Sometimes the easy set isn't a binary string or a row of slots at all, but another collection of objects hiding inside the same problem. First, we want to find the total number of matches played in a 137137-player single-elimination tournament with any setup of byes; second, we want to find the number of interior crossing points formed when 66 dots around a circle are all connected by straight chords with no three chords meeting at the same interior point.

Hidden Pairings in Tournaments and Circles
137137
players\htmlClass{lc-mute}{\text{players}}
68 matches68\ \htmlClass{lc-mute}{\text{matches}}
1 bye\htmlClass{lc-mute}{1\ \text{bye}}
6969
1\htmlClass{lc-green}{1}
champion\htmlClass{lc-green}{\text{champion}}
#matches=  ?\#\text{matches} = \thickspace ?
Text solution
Tournament: Pair each match with the player it eliminatesEvery match produces 1\leftover{1} loser, and every player except the 1\counted{1} undefeated champion loses exactly once.
Matches played=Losers=137−1=136\displaystyle \begin{aligned} \text{Matches played} &= \leftover{\text{Losers}} \\ &= 137 - \counted{1} = \counted{136} \end{aligned}
So 136\counted{136} matches are played in the tournament, regardless of how the bracket and byes are set up.
Circle chords: Pair each interior crossing with its 4\counted{4} boundary endpointsTracing the 2\second{2} crossing lines out to the edge gives 4\counted{4} boundary dots, and any 4\counted{4} boundary dots can be joined to cross inside the circle in only one way (their single pair of diagonals).
Interior crossings for n dots\displaystyle \text{Interior crossings for } n \text{ dots} =(n4)\displaystyle = \binom{n}{\counted{4}}
Evaluate for 66 boundary dotsCount the 4\counted{4}-dot subsets chosen from the 66 dots around the circle.
(64)\displaystyle \binom{6}{\counted{4}} =6×5×4×34×3×2×1\displaystyle = \frac{6 \times 5 \times 4 \times 3}{4 \times 3 \times 2 \times 1} =15\displaystyle = \counted{15}

So the chords between 66 dots on a circle create 15\counted{15} interior crossing points.

Any 4\counted{4} dots on the boundary of the circle have only one pair of diagonals that cross on the inside, so 4\counted{4}-dot boundary subsets and interior crossings match one-to-one.

Every subset of 4 dots on the circle has only one pair of crossing diagonals, matching the interior crossings one-to-one.

Key concepts

When a counting problem already asks for a free choice of kk items from nn (like choosing any 44 chairs out of 1010 in (104)\binom{10}{4} ways) or a fixed sequence of independent slots, count it directly with combinations or the product rule. You don't need a new bijection. Bring in a bijection when changing sizes, even-or-odd rules, spacing gaps, or tangled geometry block a direct count, and always verify your rule with the Reverse Test by checking that every item on the easy side reconstructs one and only one valid item on the hard side.

If the groups you are counting change size, turn them into a fixed row of yes-or-no slots: subsets of nn items match nn-digit binary strings ({A,C}↔1010\{A, C\} \pairs{\leftrightarrow} \counted{1}0\counted{1}0 in {A,B,C,D}\{A, B, C, D\}), giving 2n\counted{2^n} subsets in total. To show two halves of a collection have the exact same size without listing cases, pair them directly by flipping one fixed element A\pairs{A} in or out ({B,C}↔{A,B,C}\{B, C\} \pairs{\leftrightarrow} \{\pairs{A}, B, C\}), which splits the 2n\counted{2^n} subsets into 2n−1\counted{2^{n-1}} even subsets and 2n−1\counted{2^{n-1}} odd subsets. When counting paths on a grid, translate the path into a step word: walking 4\first{4} blocks right and 3\second{3} blocks up is a 77-letter word of four R\first{R}'s and three U\second{U}'s, counted by choosing the U\second{U} slots in (73)=35\binom{7}{\second{3}} = \counted{35} ways. When a spacing rule forces empty spacers between chosen items in a row, squeeze out the mandatory spacers after every chosen item except the last one (removing 3\leftover{3} spacer chairs from 1010 to pick 4\first{4} chairs freely from 77 in (74)=35\binom{7}{\first{4}} = \counted{35} ways). Finally, when neither strings nor rows fit, ask what inside the problem uniquely locks in one object: each match in a 137137-player single-elimination tournament is locked in by the unique loser it knocks out (137−1=136137 - \counted{1} = \counted{136} matches), and each interior chord crossing in a circle of nn dots is locked in by its 4\counted{4} boundary endpoints ((n4)\binom{n}{\counted{4}} crossings).

6

Practice

1

Let S={1,2,3,4,5,6,7,8}S = \{1, 2, 3, 4, 5, 6, 7, 8\}. Using the bijection between subsets of SS and 88-digit binary strings, how many subsets of SS contain both 11 and 22, but do not contain 88?

In the 88 yes-or-no slots for the elements of SS, which slots are already locked in and how many slots still have a free choice?

In the 88-digit binary string, the slots for 11 and 22 are locked as 1\counted{1} and the slot for 88 is locked as 00. Watch out not to treat the excluded 88 as a free slot, which would leave 8−2=68 - 2 = 6 slots and give the wrong answer 26=642^6 = 64. That leaves 8−3=58 - 3 = 5 free slots with 22 choices each, giving 25=322^5 = 32.
2

A club has 1010 members, including Alice and Bob. How many subsets of the club's members contain an odd number of people and do not include Alice?

First lock Alice out of the group. How many members are left to form subsets, and whose status can you flip to pair the even and odd subsets among them?

Locking Alice out leaves the other 99 members, who form 29=5122^9 = \counted{512} subsets in total (do not start from all 1010 members to get 210−1=5122^{10-1} = 512, because Alice's slot is fixed at 00). Flipping whether Bob is in or out pairs every even subset with a unique odd subset without ever adding Alice. Since Bob still counts as one of the 99 free members before flipping, don't subtract him twice to get 27=1282^7 = 128. This splits the 512\counted{512} subsets into two equal halves of size 5122=28=256\tfrac{\counted{512}}{2} = 2^8 = 256.
3

On a city grid that is 66 blocks wide and 55 blocks tall, you walk from the bottom-left corner (0,0)(0,0) to the top-right corner (6,5)(6,5) taking only Right (RR) and Up (UU) steps. How many paths pass through the intersection at (2,3)(2,3)?

Break the walk into two stages, from (0,0)(0,0) to (2,3)(2,3) and then from (2,3)(2,3) to (6,5)(6,5), and write the step word for each stage.

Walking from (0,0)(0,0) to (2,3)(2,3) translates into a 55-letter word with 2\first{2} R\first{R}'s and 3\second{3} U\second{U}'s ((52)=10\binom{5}{\first{2}} = \counted{10} choices), and walking the remaining blocks from (2,3)(2,3) to (6,5)(6,5) translates into a 66-letter word with 6−2=46 - 2 = \first{4} R\first{R}'s and 5−3=25 - 3 = \second{2} U\second{U}'s ((62)=15\binom{6}{\second{2}} = \counted{15} choices). Since a full path chooses the first stage and the second stage, multiply the counts rather than adding 10+15=2510 + 15 = 25: 10×15=150\counted{10} \times \counted{15} = 150.
4

A street has 1515 streetlights in a row. The city wants to turn off 44 of them to save power, but for safety there must be at least 22 working streetlights between any two turned-off streetlights. In how many ways can the 44 streetlights be chosen?

Right after each of the first 33 turned-off streetlights, how many working streetlights are forced to act as spacers?

Squeeze out the 2\leftover{2} mandatory working-light spacers right after each of the first 3\first{3} turned-off lights. The 44th turned-off light is the last one and needs no spacers after it, so remove 3×2=6\first{3} \times \leftover{2} = \leftover{6} lights rather than 4×2=84 \times 2 = 8 (which would leave 77 lights and give (74)=35\binom{7}{4} = 35). That leaves a free choice of 4\first{4} lights out of 15−6=915 - \leftover{6} = 9, which gives (94)=126\binom{9}{\first{4}} = 126.
5

200200 players enter a single-elimination qualifying tournament with any setup of byes. Play stops as soon as only 1616 undefeated players remain to advance to the finals. How many matches are played in the qualifying tournament?

If you pair every qualifying match with the unique player it eliminates, how many of the 200200 players never lose a match during qualifying?

Pairing each match with the unique player it eliminates matches the total qualifying games played to the number of eliminated players. Because play stops when 16\counted{16} undefeated players remain, subtract all 16\counted{16} advancing players rather than just 11 champion (which would give 200−1=199200 - 1 = 199), leaving 200−16=184200 - \counted{16} = 184.
6

1010 dots are placed around a circle so that no three chords cross at the same interior point, and every pair of dots is connected by a chord. Given one specific dot PP on the circle, how many interior crossing points lie on a chord that has PP as an endpoint?

Every interior crossing is locked in by 44 boundary dots. If the crossing lies on a chord from PP, what must be true about those 44 dots?

An interior crossing point lies on a chord from P\second{P} if and only if P\second{P} is one of the 4\counted{4} boundary dots whose diagonals form that crossing. Since P\second{P} already fills 11 of those 4\counted{4} endpoint spots, choose the other 3\counted{3} boundary dots from the remaining 99 dots (do not choose 44 from 99 to get (94)=126\binom{9}{4} = 126), which gives (93)=84\binom{9}{\counted{3}} = 84.