MatheramaMatherama
← Combinatorics
Combinatorics·Section 1·27 min read

Introduction and Fundamental Principles of Counting

Long before combinatorics became a formal pillar of mathematics, it thrived as recreational mathematics—a playground of puzzles, games, and number patterns. Many enduring mathematical ideas began when curious minds tried to solve such puzzles purely for the pleasure of discovery.

Consider a magic square: a square grid of numbers in which every row, every column, and both main diagonals add up to the same constant, called the magic sum. In the classical 3×33 \times 3 magic square below, the integers 11 through 99 are arranged so that every row, column, and diagonal sums to 1515:

Classical 3x3 Magic Square with Magic Sum 15

Mathematicians have constructed far more elaborate magic squares, including Srinivasa Ramanujan's famous 4×44 \times 4 birthday magic square—whose top row displays his birth date 22 12 18 87 (22 December 1887) while its rows, columns, diagonals, corner 2×22 \times 2 blocks, and central 2×22 \times 2 block all sum to 139139. Filling a Sudoku grid, determining the number of valid 1010-digit mobile numbers, or counting the distinct ways to form a committee all belong to this same discipline.

In essence, combinatorics is the mathematical study of arranging and selecting discrete objects—such as numbers, letters, or people—according to specified rules.


Solution Sets and the Limits of Direct Enumeration§

To see how a counting problem works beneath the surface, begin with a small example where every valid configuration can be written down explicitly.

Illustrative Problem 1: Arrange 22 girls and 22 boys in a queue so that no two girls stand adjacent and no two boys stand adjacent.

Let the two girls be G1,G2G_1, G_2 and the two boys be B1,B2B_1, B_2. Because only four people are involved, we can list every alternating queue directly. Notice that a valid queue must start with either a girl or a boy:

  • Starting with a girl: G1B1G2B2G_1 B_1 G_2 B_2, G2B1G1B2G_2 B_1 G_1 B_2, G1B2G2B1G_1 B_2 G_2 B_1, G2B2G1B1G_2 B_2 G_1 B_1.
  • Starting with a boy: B1G1B2G2B_1 G_1 B_2 G_2, B1G2B2G1B_1 G_2 B_2 G_1, B2G1B1G2B_2 G_1 B_1 G_2, B2G2B1G1B_2 G_2 B_1 G_1.

Each valid arrangement is a solution of the problem. Gathering all solutions into a single set SS gives the solution set:

S={G1B1G2B2,  G2B1G1B2,  G1B2G2B1,  G2B2G1B1,  B1G1B2G2,  B1G2B2G1,  B2G1B1G2,  B2G2B1G1}S = \{G_1 B_1 G_2 B_2,\; G_2 B_1 G_1 B_2,\; G_1 B_2 G_2 B_1,\; G_2 B_2 G_1 B_1,\; B_1 G_1 B_2 G_2,\; B_1 G_2 B_2 G_1,\; B_2 G_1 B_1 G_2,\; B_2 G_2 B_1 G_1\}

The count we seek is simply the cardinality of SS, namely ∣S∣=8|S| = 8.

Direct enumeration works when SS is tiny, but it collapses almost immediately as the number of objects grows. Even a supercomputer cannot list all possible orderings of a standard 5252-card deck. The central goal of combinatorics is therefore clear: develop logical methods to compute ∣S∣|S| exactly without writing out the individual elements of SS.


Divide and Rule: Discovering the Idea of Partitioning§

Before stating any formal law of counting, observe how we naturally simplify a slightly larger problem by breaking it into clean, non-overlapping pieces.

Illustrative Problem 2: Two girls (Alexa and Siri) and three boys (B1,B2,B3B_1, B_2, B_3) are to be seated in a row of 55 chairs so that the two girls occupy the first two chairs. In how many ways can they be seated?

Let SS be the solution set of all valid seatings. Rather than attempting to list all elements of SS at once, fix the first two chairs first.

Suppose Alexa sits on Chair 11 and Siri sits on Chair 22. Now only the three boys remain for Chairs 3,4,3, 4, and 55. To count their arrangements systematically, fix who sits on Chair 33:

  • If B1B_1 sits on Chair 33, the remaining two boys arrange on Chairs 44 and 55 in 22 ways: (B2,B3)(B_2, B_3) or (B3,B2)(B_3, B_2).
  • If B2B_2 sits on Chair 33, the remaining two boys arrange in 22 ways: (B1,B3)(B_1, B_3) or (B3,B1)(B_3, B_1).
  • If B3B_3 sits on Chair 33, the remaining two boys arrange in 22 ways: (B1,B2)(B_1, B_2) or (B2,B1)(B_2, B_1).

Hence there are 2+2+2=62 + 2 + 2 = 6 ways to seat the three boys.

Next, swap the two girls so that Siri sits on Chair 11 and Alexa sits on Chair 22. By the exact same reasoning, the three boys again arrange themselves on Chairs 3,4,3, 4, and 55 in 66 ways.

Tree Diagram Showing the Partition of the Seating Solution Set

Adding the two cases yields 6+6=126 + 6 = 12 valid seatings.

Expressing this divide-and-rule strategy in set notation reveals why the count is exact. We split SS into two subsets:

  • S1S_1: all arrangements with Alexa on Chair 11 and Siri on Chair 22 (∣S1∣=6|S_1| = 6).
  • S2S_2: all arrangements with Siri on Chair 11 and Alexa on Chair 22 (∣S2∣=6|S_2| = 6).

Two essential conditions hold:

  1. S1∩S2=∅S_1 \cap S_2 = \emptyset: No seating belongs to both S1S_1 and S2S_2.
  2. S1∪S2=SS_1 \cup S_2 = S: Together, S1S_1 and S2S_2 account for every valid seating.

Because both conditions are satisfied, ∣S∣=∣S1∣+∣S2∣=6+6=12|S| = |S_1| + |S_2| = 6 + 6 = 12.

Overcounting and Undercounting§

In larger problems we do not list the elements of SS; we split SS logically according to some chosen criterion. Whenever a logical split violates either of the two conditions above, the final count fails:

  • Overcounting occurs when parts overlap (Si∩Sj≠∅S_i \cap S_j \neq \emptyset). Any arrangement lying in more than one part is counted two or more times.
  • Undercounting occurs when the parts fail to cover all of SS (⋃Si⊊S\bigcup S_i \subsetneq S). Valid arrangements are silently omitted.

Nearly every error in combinatorics traces back to faulty case-splitting that causes either overcounting or undercounting.

Scaling Up Without Enumeration§

We now know that 33 boys can sit on 33 chairs in 66 ways. Use that single fact to solve the next case without listing a single arrangement.

Illustrative Problem 3: In how many ways can 44 boys (B1,B2,B3,B4B_1, B_2, B_3, B_4) sit in a row of 44 chairs?

Let SS be the solution set. Split SS logically into four subsets S1,S2,S3,S4S_1, S_2, S_3, S_4, where SkS_k consists of all seatings with boy BkB_k on Chair 11.

1. No overlap: Because Chair 11 holds only one boy at a time, all six pairwise intersections are empty:

S1∩S2=∅,S1∩S3=∅,S1∩S4=∅,S2∩S3=∅,S2∩S4=∅,S3∩S4=∅S_1 \cap S_2 = \emptyset, \quad S_1 \cap S_3 = \emptyset, \quad S_1 \cap S_4 = \emptyset, \quad S_2 \cap S_3 = \emptyset, \quad S_2 \cap S_4 = \emptyset, \quad S_3 \cap S_4 = \emptyset

2. No omissions: Every seating places one of the four boys on Chair 11, so:

S1∪S2∪S3∪S4=SS_1 \cup S_2 \cup S_3 \cup S_4 = S

In each subset SkS_k, one boy is fixed on Chair 11 and the remaining 33 boys arrange themselves on the remaining 33 chairs in 66 ways. Thus ∣S1∣=∣S2∣=∣S3∣=∣S4∣=6|S_1| = |S_2| = |S_3| = |S_4| = 6, giving:

∣S∣=∣S1∣+∣S2∣+∣S3∣+∣S4∣=6+6+6+6=24|S| = |S_1| + |S_2| + |S_3| + |S_4| = 6 + 6 + 6 + 6 = 24

Partitioning and the Addition Principle§

The logical splitting we just practiced has a precise name in set theory.

Definition (Partition of a Set): A collection of subsets S1,S2,…,SkS_1, S_2, \dots, S_k forms a partition of a set SS if:

  1. Pairwise Disjoint (Mutually Exclusive): Si∩Sj=∅S_i \cap S_j = \emptyset for all i≠ji \neq j (1≤i,j≤k1 \le i, j \le k).
  2. Exhaustive: S1∪S2∪⋯∪Sk=SS_1 \cup S_2 \cup \dots \cup S_k = S.

Each subset SiS_i is called a part (or block) of the partition.

Partition of a Solution Set into Pairwise Disjoint Exhaustive Subsets

Core Strategy of Combinatorics:
To count a complicated solution set SS, construct a mutually exclusive and exhaustive partition of SS into simpler parts whose sizes can be counted cleanly.

Theorem (Addition Principle): If a finite solution set SS is partitioned into kk pairwise disjoint, exhaustive parts S1,S2,…,SkS_1, S_2, \dots, S_k, then:

∣S∣=∣S1∣+∣S2∣+⋯+∣Sk∣=∑i=1k∣Si∣|S| = |S_1| + |S_2| + \dots + |S_k| = \sum_{i=1}^{k} |S_i|

In concise operational form: if a choice can be made from one group in mm ways or from another completely disjoint group in nn ways, then there are m+nm + n ways to make the choice.

Example 1: Class A has 2020 students, A={a1,a2,…,a20}A = \{a_1, a_2, \dots, a_{20}\}, and Class B has 3030 students, B={b1,b2,…,b30}B = \{b_1, b_2, \dots, b_{30}\}, with no student enrolled in both classes. In how many ways can a single representative be selected from either Class A or Class B?

Solution: The solution set S=A∪BS = A \cup B partitions cleanly into the two disjoint sets S1=AS_1 = A (∣S1∣=20|S_1| = 20) and S2=BS_2 = B (∣S2∣=30|S_2| = 30). By the Addition Principle:

∣S∣=∣S1∣+∣S2∣=20+30=50|S| = |S_1| + |S_2| = 20 + 30 = 50

Example 2 (Non-Disjoint Groups — Avoiding Overcounting): A student may choose one elective from a list of 1212 Science courses or 1010 Mathematics courses. If 33 interdisciplinary courses appear on both lists, how many distinct electives are available?

Solution: Adding 12+10=2212 + 10 = 22 overcounts because the two lists overlap in 33 courses. To build a valid disjoint partition, split the courses into three mutually exclusive parts: Science only (12−3=912 - 3 = 9), Mathematics only (10−3=710 - 3 = 7), and both lists (33). By the Addition Principle, the number of distinct electives is 9+7+3=199 + 7 + 3 = 19 (equivalently 12+10−312 + 10 - 3). In Section 08, we generalize this overlap correction into the Principle of Inclusion–Exclusion.


The Multiplication Principle§

Although often taught as an independent rule, the Multiplication Principle is a direct special case of the Addition Principle—the case in which every part of a partition has the exact same size.

To see this clearly, modify Example 1: suppose two students must be selected—the first from Class A (2020 students, {a1,…,a20}\{a_1, \dots, a_{20}\}) and the second from Class B (3030 students, {b1,…,b30}\{b_1, \dots, b_{30}\}).

  • If the first student is a1a_1, the second can be chosen in 3030 ways.
  • If the first student is a2a_2, the second can again be chosen in 3030 ways.
  • For every choice of ai∈Aa_i \in A (1≤i≤201 \le i \le 20), there are always 3030 choices for the second student from BB.

Writing out the entire solution set SS displays a 20×3020 \times 30 rectangular array of ordered pairs:

S={(a1,b1)(a1,b2)(a1,b3)⋯(a1,b29)(a1,b30)(a2,b1)(a2,b2)(a2,b3)⋯(a2,b29)(a2,b30)(a3,b1)(a3,b2)(a3,b3)⋯(a3,b29)(a3,b30)⋮⋮⋮⋱⋮⋮(a19,b1)(a19,b2)(a19,b3)⋯(a19,b29)(a19,b30)(a20,b1)(a20,b2)(a20,b3)⋯(a20,b29)(a20,b30)}S = \left\{ \begin{matrix} (a_1, b_1) & (a_1, b_2) & (a_1, b_3) & \cdots & (a_1, b_{29}) & (a_1, b_{30}) \\ (a_2, b_1) & (a_2, b_2) & (a_2, b_3) & \cdots & (a_2, b_{29}) & (a_2, b_{30}) \\ (a_3, b_1) & (a_3, b_2) & (a_3, b_3) & \cdots & (a_3, b_{29}) & (a_3, b_{30}) \\ \vdots & \vdots & \vdots & \ddots & \vdots & \vdots \\ (a_{19}, b_1) & (a_{19}, b_2) & (a_{19}, b_3) & \cdots & (a_{19}, b_{29}) & (a_{19}, b_{30}) \\ (a_{20}, b_1) & (a_{20}, b_2) & (a_{20}, b_3) & \cdots & (a_{20}, b_{29}) & (a_{20}, b_{30}) \end{matrix} \right\}

Each row SiS_i contains all pairs whose first entry is aia_i. These 2020 rows form a pairwise disjoint, exhaustive partition of SS in which every part has equal size ∣Si∣=30|S_i| = 30. Applying the Addition Principle:

∣S∣=∣S1∣+∣S2∣+⋯+∣S20∣=30+30+⋯+30⏟20 times=20×30=600|S| = |S_1| + |S_2| + \dots + |S_{20}| = \underbrace{30 + 30 + \dots + 30}_{20 \text{ times}} = 20 \times 30 = 600

Theorem (Multiplication Principle):

  1. Ordered-Pair Form: If a finite set AA has mm elements and a finite set BB has nn elements, the number of ordered pairs (a,b)(a, b) with a∈Aa \in A and b∈Bb \in B is m×nm \times n.
  2. Partition Form: If a finite solution set SS is partitioned into mm pairwise disjoint, exhaustive parts of equal size nn, then ∣S∣=m×n|S| = m \times n.

Generalization to kk Steps: Given kk finite sets A1,A2,…,AkA_1, A_2, \dots, A_k containing n1,n2,…,nkn_1, n_2, \dots, n_k elements respectively, choosing one element independently from each set produces n1×n2×⋯×nkn_1 \times n_2 \times \dots \times n_k ordered kk-tuples.

Example 3: A room contains 1010 men, 88 women, 66 boys, and 44 girls. In how many ways can a group consisting of one man, one woman, one boy, and one girl be selected?

Solution: The four selections have 1010, 88, 66, and 44 choices respectively, and each count is completely independent of the others regardless of selection order. By the Multiplication Principle:

Total ways=10×8×6×4=1920\text{Total ways} = 10 \times 8 \times 6 \times 4 = 1920

Example 4 (Combining Addition and Multiplication): Three cities XX, YY, and ZZ are connected by roads: there are 33 roads from XX to YY, 44 roads from YY to ZZ, and 22 direct highways from XX to ZZ that bypass YY. How many distinct routes lead from XX to ZZ?

Solution: Partition all routes from XX to ZZ into two mutually exclusive cases:

  • Case 1 (Passing through YY): Choose a road X→YX \to Y (33 ways) and a road Y→ZY \to Z (44 ways). By the Multiplication Principle, this gives 3×4=123 \times 4 = 12 routes.
  • Case 2 (Direct from XX to ZZ): 22 routes.

By the Addition Principle, there are 12+2=1412 + 2 = 14 distinct routes in total.


Independence and the Order of Choices§

Essential Condition:
The Multiplication Principle requires that the number of choices at each step remain constant regardless of the outcomes of previous steps. Whenever the size of the partition parts varies from one choice to another, direct multiplication is invalid.

Two contrasting examples make this requirement crystal clear.

Case 1: Dependent Choices Create Uneven Partitions§

Example 5: From 1010 boys and 88 girls, one head boy and one head girl are to be chosen. However, a girl named Amaara refuses to serve as head girl if a boy named Max is chosen as head boy. Find the number of valid selections.

Why Direct Multiplication Fails: Consider choosing the head girl first, then the head boy:

  • If Amaara is chosen as head girl, Max is excluded, leaving 99 choices for head boy.
  • If any of the other 77 girls is chosen as head girl, all 1010 boys remain eligible.

The number of head-boy choices depends on which girl is picked. In the rectangular grid of pairs, Amaara's row contains only 99 pairs whereas the other 77 rows each contain 1010 pairs.

Comparison of Uniform Partition (Independent Choices) vs Uneven Partition (Dependent Choices)

Method 1 (Partitioning into Uniform Blocks): Split the solution set SS into two disjoint, exhaustive parts based on the exceptional girl:

  • S1S_1: valid pairs in which Amaara is head girl. Excluding Max leaves 99 boys:
S1={(Amaara,Boy 1),  (Amaara,Boy 2),  …,  (Amaara,Boy 9)}  ⟹  ∣S1∣=9S_1 = \{(\text{Amaara}, \text{Boy } 1),\; (\text{Amaara}, \text{Boy } 2),\; \dots,\; (\text{Amaara}, \text{Boy } 9)\} \implies |S_1| = 9
  • S2S_2: valid pairs in which Amaara is not head girl. Each of the remaining 77 girls can pair with all 1010 boys, forming a uniform 7×107 \times 10 block:
S2={(Girl 1,Boy 1)(Girl 1,Boy 2)⋯(Girl 1,Boy 10)(Girl 2,Boy 1)(Girl 2,Boy 2)⋯(Girl 2,Boy 10)⋮⋮⋱⋮(Girl 7,Boy 1)(Girl 7,Boy 2)⋯(Girl 7,Boy 10)}  ⟹  ∣S2∣=7×10=70S_2 = \left\{ \begin{matrix} (\text{Girl } 1, \text{Boy } 1) & (\text{Girl } 1, \text{Boy } 2) & \cdots & (\text{Girl } 1, \text{Boy } 10) \\ (\text{Girl } 2, \text{Boy } 1) & (\text{Girl } 2, \text{Boy } 2) & \cdots & (\text{Girl } 2, \text{Boy } 10) \\ \vdots & \vdots & \ddots & \vdots \\ (\text{Girl } 7, \text{Boy } 1) & (\text{Girl } 7, \text{Boy } 2) & \cdots & (\text{Girl } 7, \text{Boy } 10) \end{matrix} \right\} \implies |S_2| = 7 \times 10 = 70

By the Addition Principle, ∣S∣=∣S1∣+∣S2∣=9+70=79|S| = |S_1| + |S_2| = 9 + 70 = 79.

Method 2 (Complementary Shortcut): Ignoring the restriction gives a complete 8×10=808 \times 10 = 80 grid of pairs. Removing the single forbidden pair (Amaara,Max)(\text{Amaara}, \text{Max}) leaves 80−1=7980 - 1 = 79 valid pairs.

While Method 2 is shorter here (and anticipates the Subtraction Principle below), Method 1 shows why dependence breaks multiplication and how isolating the restricted case restores uniform blocks.

Case 2: How Choice Order Preserves or Breaks Independence§

Notice that independence does not require the exact same set of items to remain available at Step 22—only the same count.

Example 6 (Unrestricted Roles): From a class of 6060 students, two different students are chosen: one as class captain and one as class monitor. In how many ways can this be done?

Solution: Choose the captain in 6060 ways. Although the identity of the remaining 5959 students depends on who became captain, the number of remaining choices for monitor is always 5959. Every part of the partition has equal size 5959, so the Multiplication Principle gives 60×59=354060 \times 59 = 3540. Reversing the order (monitor first, captain second) gives the same uniform count.

Now introduce a single restriction and compare both orders of selection.

Example 7 (Restricted Role — Choice Order Matters): A class of 6060 students has 4040 girls and 2020 boys. Two different students must be chosen as class captain and class monitor, subject to the rule that only a girl may become monitor, while the captain may be either a boy or a girl. Find the number of valid selections.

Method 1 (Monitor First — Uniform Partition):

  1. Choose the monitor from the 4040 girls: 4040 ways.
  2. Choose the captain from the remaining 3939 girls and 2020 boys: 39+20=5939 + 20 = 59 ways—always 5959, regardless of which girl was chosen as monitor.

By the Multiplication Principle:

Total ways=40×59=2360\text{Total ways} = 40 \times 59 = 2360

Method 2 (Captain First — Uneven Partition): If we instead choose the captain first (6060 ways), the number of choices left for the monitor is no longer constant:

  • If a boy becomes captain (2020 ways), all 4040 girls remain eligible for monitor.
  • If a girl becomes captain (4040 ways), only 3939 girls remain eligible for monitor.

Because 2020 parts have size 4040 while 4040 parts have size 3939, direct multiplication fails. We must partition SS into two disjoint cases:

  • Case 1 (Boy is captain): 20×40=80020 \times 40 = 800.
  • Case 2 (Girl is captain): 40×39=156040 \times 39 = 1560.

By the Addition Principle, ∣S∣=800+1560=2360|S| = 800 + 1560 = 2360.

Rule of Constraint Priority:
Whenever restrictions apply to particular roles or positions, always make the most restricted choices first. Doing so often keeps subsequent choice counts constant, allowing a single application of the Multiplication Principle instead of tedious casework.


The Subtraction Principle§

Method 2 of Example 5 illustrated an idea that is often far more efficient than direct counting. In many combinatorial problems, counting the configurations that satisfy a given condition directly forces us into a maze of messy cases, whereas counting the configurations that satisfy the opposite condition—along with the unrestricted total—is effortless. In such situations, we count everything without restriction and subtract the unwanted cases.

Theorem (Subtraction Principle): Let UU be the finite universal set of all configurations obtained when a restriction is relaxed, let A⊆UA \subseteq U be the subset of configurations satisfying the given restriction, and let A′=U∖AA' = U \setminus A be its complement (the configurations satisfying the opposite restriction). Then:

∣A∣=∣U∣−∣A′∣|A| = |U| - |A'|

Visual Comparison of the Subtraction Principle and the Division Principle

Example 8 (Repeated Letters in a Password): How many 77-letter passwords can be formed using the 2626 letters of the English alphabet such that at least one letter is repeated?

Solution: Counting AA directly would require listing dozens of distinct repetition patterns (one letter repeated twice, two letters repeated twice, one repeated thrice, all seven identical, and so on). Instead, apply the Subtraction Principle:

  • UU (Unrestricted universe): All 77-letter passwords. Each of the 77 positions has 2626 independent choices, so ∣U∣=267|U| = 26^7.
  • AA (Target restriction): Passwords with at least one repeated letter.
  • A′A' (Opposite restriction): Passwords with no repeated letter (all 77 letters distinct). Filling the positions from left to right gives 2626, then 2525, then 2424, ..., down to 2020 choices:
∣A′∣=26×25×24×23×22×21×20|A'| = 26 \times 25 \times 24 \times 23 \times 22 \times 21 \times 20

Therefore, the number of passwords with at least one repeated letter is:

∣A∣=∣U∣−∣A′∣=267−(26×25×24×23×22×21×20)|A| = |U| - |A'| = 26^7 - (26 \times 25 \times 24 \times 23 \times 22 \times 21 \times 20)

The Essence of the Subtraction Principle:
Notice how counting AA directly in Example 8 was nearly impossible, while computing both the unrestricted total ∣U∣|U| and the opposite case ∣A′∣|A'| took just one line each. Whenever a condition (especially one phrased with "at least one") breaks into too many cases, pause and check whether counting without the restriction and with the opposite restriction is simpler—then subtract.

Example 9 (At Least One Six on Three Dice): Three distinguishable dice (red, blue, and green) are rolled simultaneously. How many outcomes show the number 66 on at least one die?

Solution: Without restriction, each die has 66 outcomes, so ∣U∣=63=216|U| = 6^3 = 216. For the opposite restriction A′A' (no die shows a 66), each die has 55 outcomes (1,2,3,4,1, 2, 3, 4, or 55), giving ∣A′∣=53=125|A'| = 5^3 = 125. By the Subtraction Principle:

∣A∣=216−125=91|A| = 216 - 125 = 91

The Division Principle§

Consider a simple farm calculation: if 100,000100{,}000 tomatoes are harvested from a field in which every single plant bears exactly 100100 tomatoes, then the number of plants in the field is immediately:

100,000100=1000\frac{100{,}000}{100} = 1000

This observation generalizes into one of the most useful tools in combinatorics.

Theorem (Division Principle): If a finite set SS is partitioned into mm pairwise disjoint, exhaustive parts S1,S2,…,SmS_1, S_2, \dots, S_m of equal size dd, then:

m=∣S∣dm = \frac{|S|}{d}

Proof: By the Multiplication Principle, ∣S∣=m⋅d|S| = m \cdot d. Dividing both sides by dd yields m=∣S∣/dm = |S| / d. ■\blacksquare

The Division Principle turns uniform overcounting into a deliberate problem-solving technique: if it is easy to count an auxiliary set SS in which every distinct target object appears the exact same number of times dd, we simply compute ∣S∣|S| and divide by dd. We will use this exact technique to derive combinations, circular permutations, multiset permutations, and distributions into identical boxes.

Example 10 (Handshakes in a Room): Ten people meet in a room, and every pair of people shakes hands exactly once. How many handshakes take place?

Solution: First count all ordered pairs (P,Q)(P, Q) of distinct people: 1010 choices for PP and 99 choices for QQ give ∣S∣=10×9=90|S| = 10 \times 9 = 90. Because the handshake between AA and BB is identical to the handshake between BB and AA, the set SS partitions into equivalence classes {(A,B),(B,A)}\{(A, B), (B, A)\} of equal size d=2d = 2. By the Division Principle, the number of distinct handshakes is:

902=45\frac{90}{2} = 45

Example 11 (Diagonals of a Convex Polygon): How many diagonals does a convex nn-sided polygon (n≥3n \ge 3) have?

Solution: Choose any of the nn vertices as a starting point. It cannot connect by a diagonal to itself or to its 22 adjacent vertices, leaving n−3n - 3 valid endpoints. This gives n(n−3)n(n - 3) directed diagonals PQ→\overrightarrow{PQ}. Because every geometric diagonal PQPQ is counted twice—once as PQ→\overrightarrow{PQ} and once as QP→\overrightarrow{QP}—the Division Principle gives:

Number of diagonals=n(n−3)2\text{Number of diagonals} = \frac{n(n - 3)}{2}

(Checking small cases: for a triangle n=3n = 3, 3×02=0\frac{3 \times 0}{2} = 0; for a quadrilateral n=4n = 4, 4×12=2\frac{4 \times 1}{2} = 2; for a pentagon n=5n = 5, 5×22=5\frac{5 \times 2}{2} = 5.)


The Bijection Principle§

Sometimes we want to count the elements of a set AA, yet counting AA directly feels awkward. In such cases, we can often pair each element of AA with an element of a completely different—and much simpler—set BB.

Think about selecting a starting lineup from a squad of 55 players, {P1,P2,P3,P4,P5}\{P_1, P_2, P_3, P_4, P_5\}. Suppose the coach wants to know how many ways there are to choose 33 players to play (call this set of choices AA), and also how many ways there are to choose 22 players to sit on the bench (call this set BB).

Notice that every choice of 33 players to play automatically decides the exact 22 players who sit on the bench:

  • Choosing {P1,P2,P3}\{P_1, P_2, P_3\} to play pairs uniquely with {P4,P5}\{P_4, P_5\} on the bench.
  • Choosing {P1,P2,P4}\{P_1, P_2, P_4\} to play pairs uniquely with {P3,P5}\{P_3, P_5\} on the bench.
  • Choosing {P1,P3,P5}\{P_1, P_3, P_5\} to play pairs uniquely with {P2,P4}\{P_2, P_4\} on the bench, and so on.

Check the two properties of this pairing:

  1. One-to-one (Injective): Two different starting teams of 33 players can never leave the exact same 22 players on the bench.
  2. Onto (Surjective): Every possible pair of 22 players on the bench corresponds to a valid starting team (the remaining 33 players)—no pair in BB is left unpaired.

Bijection Pairing Between 3-Player Teams and 2-Player Benches

Because every element of AA is matched with a unique partner in BB and nothing is left over on either side, the two sets must have the exact same number of elements: ∣A∣=∣B∣|A| = |B|—without even needing to compute either count.

A pairing that is both one-to-one and onto is called a bijection.

Theorem (Bijection Principle): If there exists a bijection f:A→Bf : A \to B between two finite sets AA and BB, then:

∣A∣=∣B∣|A| = |B|

The power of the Bijection Principle lies in translation: whenever a set AA is difficult to count directly, design a clean one-to-one and onto rule matching AA with a simpler set BB, and count BB instead.

Example 12 (Counting All Subsets via Binary Strings): Prove that a finite set X={x1,x2,…,xn}X = \{x_1, x_2, \dots, x_n\} of nn elements has exactly 2n2^n subsets.

Solution: Associate every subset T⊆XT \subseteq X with an nn-bit binary string (b1,b2,…,bn)(b_1, b_2, \dots, b_n) where bi=1b_i = 1 if xi∈Tx_i \in T and bi=0b_i = 0 if xi∉Tx_i \notin T. For n=3n = 3 with X={x1,x2,x3}X = \{x_1, x_2, x_3\}, the bijection pairs all 88 subsets cleanly:

Subset T⊆{x1,x2,x3}T \subseteq \{x_1, x_2, x_3\} Binary String (b1,b2,b3)(b_1, b_2, b_3)
∅\emptyset 000
{x3}\{x_3\} 001
{x2}\{x_2\} 010
{x2,x3}\{x_2, x_3\} 011
{x1}\{x_1\} 100
{x1,x3}\{x_1, x_3\} 101
{x1,x2}\{x_1, x_2\} 110
{x1,x2,x3}\{x_1, x_2, x_3\} 111

In general, every subset corresponds to a unique nn-bit string and every nn-bit string corresponds to a unique subset. By the Multiplication Principle, there are 2n2^n binary strings of length nn; by the Bijection Principle, XX has exactly 2n2^n subsets. ■\blacksquare

Example 13 (Knockout Tournament): A single-elimination tennis tournament begins with 100100 players. In each match, the winner advances and the loser is eliminated (with byes granted whenever an odd number of players remain in a round). How many matches are played to determine the champion?

Solution: Tracking rounds and byes is unnecessary. Every match eliminates exactly one player, and every eliminated player loses exactly one match—a bijection between the set of matches played and the set of eliminated players. To leave 11 champion out of 100100 players, exactly 9999 players must be eliminated; hence exactly 9999 matches must be played, regardless of how the bracket is structured.


The Pigeonhole Principle§

Unlike the previous principles, which compute exact counts, the Pigeonhole Principle (also called Dirichlet's Box Principle) guarantees the existence of an overlap or shared property.

If 55 letters are placed into 44 mailboxes, it is impossible for every mailbox to receive at most 11 letter (that would account for at most 44 letters). Hence at least one mailbox must contain at least 22 letters.

Pigeonhole Principle with n+1 Pigeons and n Pigeonholes

Theorem (Simple Pigeonhole Principle): If n+1n + 1 or more objects (pigeons) are placed into nn boxes (pigeonholes), then at least one box contains at least 22 objects.

Proof (By Contradiction): Suppose every one of the nn boxes contains at most 11 object. Then the total number of objects is at most n⋅1=nn \cdot 1 = n, contradicting the hypothesis that there are at least n+1n + 1 objects. ■\blacksquare

Theorem (Generalized Pigeonhole Principle): If NN objects are placed into kk boxes, then at least one box contains at least ⌈N/k⌉\lceil N / k \rceil objects, where ⌈x⌉\lceil x \rceil denotes the smallest integer greater than or equal to xx.

Proof (By Contradiction): Suppose every box contained at most ⌈N/k⌉−1\lceil N / k \rceil - 1 objects. Since ⌈N/k⌉−1<N/k\lceil N / k \rceil - 1 < N / k, the total number of objects across all kk boxes would be at most:

k(⌈Nk⌉−1)<k⋅Nk=Nk \left(\left\lceil \frac{N}{k} \right\rceil - 1\right) < k \cdot \frac{N}{k} = N

which contradicts the total count NN. ■\blacksquare

The art of applying the Pigeonhole Principle lies in choosing the pigeonholes cleverly so that two objects landing in the same box automatically satisfy the property you wish to prove.

Example 14 (Minimum Crowd for Shared Birth Months): What is the minimum number of students needed in an auditorium to guarantee that at least 44 students share the same birth month?

Solution: Take the k=12k = 12 calendar months as pigeonholes and the students as pigeons. In the worst case, each of the 1212 months could contain 33 students (12×3=3612 \times 3 = 36 students) without any month reaching 44. Adding one more student forces at least one month to hold 44 students. Thus the minimum number is 36+1=3736 + 1 = 37 (confirming ⌈37/12⌉=4\lceil 37 / 12 \rceil = 4).

Example 15 (Guaranteed Consecutive Integers): From {1,2,3,…,2n}\{1, 2, 3, \dots, 2n\}, any n+1n + 1 distinct integers are chosen. Prove that at least two of the chosen integers are consecutive.

Solution: Partition {1,2,…,2n}\{1, 2, \dots, 2n\} into nn disjoint consecutive pairs to serve as pigeonholes:

H1={1,2},H2={3,4},H3={5,6},…,Hn={2n−1,2n}H_1 = \{1, 2\}, \quad H_2 = \{3, 4\}, \quad H_3 = \{5, 6\}, \quad \dots, \quad H_n = \{2n - 1, 2n\}

Assign each of the n+1n + 1 chosen integers to the pair containing it. By the Pigeonhole Principle, at least one pair Hj={2j−1,2j}H_j = \{2j - 1, 2j\} receives both of its elements, producing two consecutive integers. ■\blacksquare

Example 16 (Guaranteed Divisibility): From {1,2,3,…,2n}\{1, 2, 3, \dots, 2n\}, any n+1n + 1 distinct integers are chosen. Prove that at least one of the chosen integers divides another.

Solution: Every positive integer mm can be written uniquely as a power of 22 times an odd integer, called its odd part:

m=2a⋅q(a≥0,  q odd)m = 2^a \cdot q \qquad (a \ge 0,\; q \text{ odd})

Since every chosen integer lies in {1,2,…,2n}\{1, 2, \dots, 2n\}, its odd part qq belongs to the set {1,3,5,…,2n−1}\{1, 3, 5, \dots, 2n - 1\}, which contains exactly nn odd numbers. Label nn pigeonholes by these nn odd numbers, and place each of the n+1n + 1 chosen integers into the box matching its odd part.

By the Pigeonhole Principle, two distinct chosen integers xx and yy must share the same odd part qq:

x=2a⋅qandy=2b⋅q(a≠b)x = 2^a \cdot q \qquad \text{and} \qquad y = 2^b \cdot q \qquad (a \neq b)

Without loss of generality, let a<ba < b. Then y=2b−a⋅xy = 2^{b - a} \cdot x, so xx divides yy. ■\blacksquare


Summary of Fundamental Counting Principles§

Principle Mathematical Statement Core Intuition & Application
Addition Principle ∣S∣=∑i=1k∣Si∣\lvert S \rvert = \sum_{i=1}^k \lvert S_i \rvert for pairwise disjoint, exhaustive SiS_i Split SS into non-overlapping, exhaustive cases (OR); prevents overcounting and undercounting
Multiplication Principle ∣S∣=n1⋅n2⋯nk\lvert S \rvert = n_1 \cdot n_2 \cdots n_k Special case of Addition with equal-sized parts (AND); requires independent counts (satisfy strictest constraints first)
Subtraction Principle ∣A∣=∣U∣−∣A′∣\lvert A \rvert = \lvert U \rvert - \lvert A' \rvert Count the unrestricted universe UU and subtract the opposite condition A′A' (ideal for "at least one")
Division Principle m=∣S∣/dm = \lvert S \rvert / d When every target object is overcounted by the exact same factor dd, divide ∣S∣\lvert S \rvert by dd
Bijection Principle ∣A∣=∣B∣\lvert A \rvert = \lvert B \rvert if f:A→Bf: A \to B is bijective Pair an unfamiliar set one-to-one with a simpler set of the same size
Pigeonhole Principle NN objects in kk boxes   ⟹  \implies some box has ≥⌈N/k⌉\ge \lceil N/k \rceil Prove existence of overlaps or structural patterns by designing clever pigeonholes
Section 1 of 11 · Combinatorics

Mark this section complete when you have worked through its proofs.