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 magic square below, the integers through are arranged so that every row, column, and diagonal sums to :

Mathematicians have constructed far more elaborate magic squares, including Srinivasa Ramanujan's famous birthday magic square—whose top row displays his birth date 22 12 18 87 (22 December 1887) while its rows, columns, diagonals, corner blocks, and central block all sum to . Filling a Sudoku grid, determining the number of valid -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 girls and boys in a queue so that no two girls stand adjacent and no two boys stand adjacent.
Let the two girls be and the two boys be . 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: , , , .
- Starting with a boy: , , , .
Each valid arrangement is a solution of the problem. Gathering all solutions into a single set gives the solution set:
The count we seek is simply the cardinality of , namely .
Direct enumeration works when is tiny, but it collapses almost immediately as the number of objects grows. Even a supercomputer cannot list all possible orderings of a standard -card deck. The central goal of combinatorics is therefore clear: develop logical methods to compute exactly without writing out the individual elements of .
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 () are to be seated in a row of chairs so that the two girls occupy the first two chairs. In how many ways can they be seated?
Let be the solution set of all valid seatings. Rather than attempting to list all elements of at once, fix the first two chairs first.
Suppose Alexa sits on Chair and Siri sits on Chair . Now only the three boys remain for Chairs and . To count their arrangements systematically, fix who sits on Chair :
- If sits on Chair , the remaining two boys arrange on Chairs and in ways: or .
- If sits on Chair , the remaining two boys arrange in ways: or .
- If sits on Chair , the remaining two boys arrange in ways: or .
Hence there are ways to seat the three boys.
Next, swap the two girls so that Siri sits on Chair and Alexa sits on Chair . By the exact same reasoning, the three boys again arrange themselves on Chairs and in ways.

Adding the two cases yields valid seatings.
Expressing this divide-and-rule strategy in set notation reveals why the count is exact. We split into two subsets:
- : all arrangements with Alexa on Chair and Siri on Chair ().
- : all arrangements with Siri on Chair and Alexa on Chair ().
Two essential conditions hold:
- : No seating belongs to both and .
- : Together, and account for every valid seating.
Because both conditions are satisfied, .
Overcounting and Undercounting§
In larger problems we do not list the elements of ; we split 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 (). Any arrangement lying in more than one part is counted two or more times.
- Undercounting occurs when the parts fail to cover all of (). 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 boys can sit on chairs in ways. Use that single fact to solve the next case without listing a single arrangement.
Illustrative Problem 3: In how many ways can boys () sit in a row of chairs?
Let be the solution set. Split logically into four subsets , where consists of all seatings with boy on Chair .
1. No overlap: Because Chair holds only one boy at a time, all six pairwise intersections are empty:
2. No omissions: Every seating places one of the four boys on Chair , so:
In each subset , one boy is fixed on Chair and the remaining boys arrange themselves on the remaining chairs in ways. Thus , giving:
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 forms a partition of a set if:
- Pairwise Disjoint (Mutually Exclusive): for all ().
- Exhaustive: .
Each subset is called a part (or block) of the partition.

Core Strategy of Combinatorics:
To count a complicated solution set , construct a mutually exclusive and exhaustive partition of into simpler parts whose sizes can be counted cleanly.
Theorem (Addition Principle): If a finite solution set is partitioned into pairwise disjoint, exhaustive parts , then:
In concise operational form: if a choice can be made from one group in ways or from another completely disjoint group in ways, then there are ways to make the choice.
Example 1: Class A has students, , and Class B has students, , 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 partitions cleanly into the two disjoint sets () and (). By the Addition Principle:
Example 2 (Non-Disjoint Groups — Avoiding Overcounting): A student may choose one elective from a list of Science courses or Mathematics courses. If interdisciplinary courses appear on both lists, how many distinct electives are available?
Solution: Adding overcounts because the two lists overlap in courses. To build a valid disjoint partition, split the courses into three mutually exclusive parts: Science only (), Mathematics only (), and both lists (). By the Addition Principle, the number of distinct electives is (equivalently ). 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 ( students, ) and the second from Class B ( students, ).
- If the first student is , the second can be chosen in ways.
- If the first student is , the second can again be chosen in ways.
- For every choice of (), there are always choices for the second student from .
Writing out the entire solution set displays a rectangular array of ordered pairs:
Each row contains all pairs whose first entry is . These rows form a pairwise disjoint, exhaustive partition of in which every part has equal size . Applying the Addition Principle:
Theorem (Multiplication Principle):
- Ordered-Pair Form: If a finite set has elements and a finite set has elements, the number of ordered pairs with and is .
- Partition Form: If a finite solution set is partitioned into pairwise disjoint, exhaustive parts of equal size , then .
Generalization to Steps: Given finite sets containing elements respectively, choosing one element independently from each set produces ordered -tuples.
Example 3: A room contains men, women, boys, and 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 , , , and choices respectively, and each count is completely independent of the others regardless of selection order. By the Multiplication Principle:
Example 4 (Combining Addition and Multiplication): Three cities , , and are connected by roads: there are roads from to , roads from to , and direct highways from to that bypass . How many distinct routes lead from to ?
Solution: Partition all routes from to into two mutually exclusive cases:
- Case 1 (Passing through ): Choose a road ( ways) and a road ( ways). By the Multiplication Principle, this gives routes.
- Case 2 (Direct from to ): routes.
By the Addition Principle, there are 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 boys and 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 choices for head boy.
- If any of the other girls is chosen as head girl, all 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 pairs whereas the other rows each contain pairs.

Method 1 (Partitioning into Uniform Blocks): Split the solution set into two disjoint, exhaustive parts based on the exceptional girl:
- : valid pairs in which Amaara is head girl. Excluding Max leaves boys:
- : valid pairs in which Amaara is not head girl. Each of the remaining girls can pair with all boys, forming a uniform block:
By the Addition Principle, .
Method 2 (Complementary Shortcut): Ignoring the restriction gives a complete grid of pairs. Removing the single forbidden pair leaves 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 —only the same count.
Example 6 (Unrestricted Roles): From a class of 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 ways. Although the identity of the remaining students depends on who became captain, the number of remaining choices for monitor is always . Every part of the partition has equal size , so the Multiplication Principle gives . 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 students has girls and 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):
- Choose the monitor from the girls: ways.
- Choose the captain from the remaining girls and boys: ways—always , regardless of which girl was chosen as monitor.
By the Multiplication Principle:
Method 2 (Captain First — Uneven Partition): If we instead choose the captain first ( ways), the number of choices left for the monitor is no longer constant:
- If a boy becomes captain ( ways), all girls remain eligible for monitor.
- If a girl becomes captain ( ways), only girls remain eligible for monitor.
Because parts have size while parts have size , direct multiplication fails. We must partition into two disjoint cases:
- Case 1 (Boy is captain): .
- Case 2 (Girl is captain): .
By the Addition Principle, .
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 be the finite universal set of all configurations obtained when a restriction is relaxed, let be the subset of configurations satisfying the given restriction, and let be its complement (the configurations satisfying the opposite restriction). Then:

Example 8 (Repeated Letters in a Password): How many -letter passwords can be formed using the letters of the English alphabet such that at least one letter is repeated?
Solution: Counting 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:
- (Unrestricted universe): All -letter passwords. Each of the positions has independent choices, so .
- (Target restriction): Passwords with at least one repeated letter.
- (Opposite restriction): Passwords with no repeated letter (all letters distinct). Filling the positions from left to right gives , then , then , ..., down to choices:
Therefore, the number of passwords with at least one repeated letter is:
The Essence of the Subtraction Principle:
Notice how counting directly in Example 8 was nearly impossible, while computing both the unrestricted total and the opposite case 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 on at least one die?
Solution: Without restriction, each die has outcomes, so . For the opposite restriction (no die shows a ), each die has outcomes ( or ), giving . By the Subtraction Principle:
The Division Principle§
Consider a simple farm calculation: if tomatoes are harvested from a field in which every single plant bears exactly tomatoes, then the number of plants in the field is immediately:
This observation generalizes into one of the most useful tools in combinatorics.
Theorem (Division Principle): If a finite set is partitioned into pairwise disjoint, exhaustive parts of equal size , then:
Proof: By the Multiplication Principle, . Dividing both sides by yields .
The Division Principle turns uniform overcounting into a deliberate problem-solving technique: if it is easy to count an auxiliary set in which every distinct target object appears the exact same number of times , we simply compute and divide by . 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 of distinct people: choices for and choices for give . Because the handshake between and is identical to the handshake between and , the set partitions into equivalence classes of equal size . By the Division Principle, the number of distinct handshakes is:
Example 11 (Diagonals of a Convex Polygon): How many diagonals does a convex -sided polygon () have?
Solution: Choose any of the vertices as a starting point. It cannot connect by a diagonal to itself or to its adjacent vertices, leaving valid endpoints. This gives directed diagonals . Because every geometric diagonal is counted twice—once as and once as —the Division Principle gives:
(Checking small cases: for a triangle , ; for a quadrilateral , ; for a pentagon , .)
The Bijection Principle§
Sometimes we want to count the elements of a set , yet counting directly feels awkward. In such cases, we can often pair each element of with an element of a completely different—and much simpler—set .
Think about selecting a starting lineup from a squad of players, . Suppose the coach wants to know how many ways there are to choose players to play (call this set of choices ), and also how many ways there are to choose players to sit on the bench (call this set ).
Notice that every choice of players to play automatically decides the exact players who sit on the bench:
- Choosing to play pairs uniquely with on the bench.
- Choosing to play pairs uniquely with on the bench.
- Choosing to play pairs uniquely with on the bench, and so on.
Check the two properties of this pairing:
- One-to-one (Injective): Two different starting teams of players can never leave the exact same players on the bench.
- Onto (Surjective): Every possible pair of players on the bench corresponds to a valid starting team (the remaining players)—no pair in is left unpaired.

Because every element of is matched with a unique partner in and nothing is left over on either side, the two sets must have the exact same number of elements: —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 between two finite sets and , then:
The power of the Bijection Principle lies in translation: whenever a set is difficult to count directly, design a clean one-to-one and onto rule matching with a simpler set , and count instead.
Example 12 (Counting All Subsets via Binary Strings): Prove that a finite set of elements has exactly subsets.
Solution: Associate every subset with an -bit binary string where if and if . For with , the bijection pairs all subsets cleanly:
| Subset | Binary String |
|---|---|
000 |
|
001 |
|
010 |
|
011 |
|
100 |
|
101 |
|
110 |
|
111 |
In general, every subset corresponds to a unique -bit string and every -bit string corresponds to a unique subset. By the Multiplication Principle, there are binary strings of length ; by the Bijection Principle, has exactly subsets.
Example 13 (Knockout Tournament): A single-elimination tennis tournament begins with 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 champion out of players, exactly players must be eliminated; hence exactly 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 letters are placed into mailboxes, it is impossible for every mailbox to receive at most letter (that would account for at most letters). Hence at least one mailbox must contain at least letters.

Theorem (Simple Pigeonhole Principle): If or more objects (pigeons) are placed into boxes (pigeonholes), then at least one box contains at least objects.
Proof (By Contradiction): Suppose every one of the boxes contains at most object. Then the total number of objects is at most , contradicting the hypothesis that there are at least objects.
Theorem (Generalized Pigeonhole Principle): If objects are placed into boxes, then at least one box contains at least objects, where denotes the smallest integer greater than or equal to .
Proof (By Contradiction): Suppose every box contained at most objects. Since , the total number of objects across all boxes would be at most:
which contradicts the total count .
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 students share the same birth month?
Solution: Take the calendar months as pigeonholes and the students as pigeons. In the worst case, each of the months could contain students ( students) without any month reaching . Adding one more student forces at least one month to hold students. Thus the minimum number is (confirming ).
Example 15 (Guaranteed Consecutive Integers): From , any distinct integers are chosen. Prove that at least two of the chosen integers are consecutive.
Solution: Partition into disjoint consecutive pairs to serve as pigeonholes:
Assign each of the chosen integers to the pair containing it. By the Pigeonhole Principle, at least one pair receives both of its elements, producing two consecutive integers.
Example 16 (Guaranteed Divisibility): From , any distinct integers are chosen. Prove that at least one of the chosen integers divides another.
Solution: Every positive integer can be written uniquely as a power of times an odd integer, called its odd part:
Since every chosen integer lies in , its odd part belongs to the set , which contains exactly odd numbers. Label pigeonholes by these odd numbers, and place each of the chosen integers into the box matching its odd part.
By the Pigeonhole Principle, two distinct chosen integers and must share the same odd part :
Without loss of generality, let . Then , so divides .
Summary of Fundamental Counting Principles§
| Principle | Mathematical Statement | Core Intuition & Application |
|---|---|---|
| Addition Principle | for pairwise disjoint, exhaustive | Split into non-overlapping, exhaustive cases (OR); prevents overcounting and undercounting |
| Multiplication Principle | Special case of Addition with equal-sized parts (AND); requires independent counts (satisfy strictest constraints first) | |
| Subtraction Principle | Count the unrestricted universe and subtract the opposite condition (ideal for "at least one") | |
| Division Principle | When every target object is overcounted by the exact same factor , divide by | |
| Bijection Principle | if is bijective | Pair an unfamiliar set one-to-one with a simpler set of the same size |
| Pigeonhole Principle | objects in boxes some box has | Prove existence of overlaps or structural patterns by designing clever pigeonholes |
Mark this section complete when you have worked through its proofs.