Mathematics · Article
Pigeonhole principle and counting arguments
Assign each object to one category, count how much those categories can hold, and prove that a repeated category or a large group must exist. Separate a universal guarantee from one displayed arrangement.
Back to MathematicsAfter reading, you can
- Identify finite objects, categories and a single assignment rule, then prove when a collision must occur.
- Use ceiling, floor and strict capacity thresholds, with sharp examples and the zero-object case handled correctly.
- Apply counting to socks, integer remainders, class partitions and distances while distinguishing existence from a specified witness.
Four socks, three colours: what must repeat?
A drawer contains socks in exactly three possible colours. You take four socks without looking; assume at least four are available. Each sock has one colour. Could all four have different colours? The first three could use all three colours, but a fourth cannot introduce a fourth colour. At least two of the four socks share a colour, though you cannot yet say which colour or which socks.
The objects are the individual socks, not the colours. The three categories are colour labels. Even two socks that look alike are different objects when counting how many were taken. In the diagram, numbers identify the socks and boxes identify their categories; the drawn arrangement is one example, rather than a prediction of the actual draw.
Useful preparation is integer division with remainders, comparing inequalities, functions with a declared input and target, and reasoning from a general rule. The linked lessons are already published. Every mapping and counting definition needed here is stated locally; the later set and proof lessons are optional background, not prerequisites.
On a first reading, follow the socks, single-assignment proof, ceiling bound and capacity examples. Then choose the remainder application or the square diagram. Return to the floor proof and the general spatial inequality after you can explain why each object belongs to exactly one category. The choice tree is a short reminder of how to count categories accurately.
Every object goes into exactly one category
Let A be a finite set of n distinct objects and B a finite set of m categories. Here n is a nonnegative integer and m is a positive integer. The notation |A| = n gives the number of elements of A. A function f: A → B assigns exactly one category in B to each object in A. Categories may be empty; an object may not be left unassigned or counted in two categories.
For category i, let aᵢ be its number of assigned objects. The counts are nonnegative integers and a₁+⋯+aₘ = n. This sum is the bridge from the assignment to the conclusion. If categories overlap before assignment, specify a unique ownership rule first; otherwise their separate counts can double-count an object.
Three objects, one each
- Circle: ordinary object or point
Counts are 1, 1, 1. Equal totals can avoid every collision; this is an injective assignment.
| Category | Object positions | Count |
|---|---|---|
| 0 | 1 | 1 |
| 1 | 2 | 1 |
| 2 | 3 | 1 |
Equal totals with a collision
- Circle: ordinary object or point
- Diamond: revealed witness pair
Counts are 2, 0, 1. Equal totals do not prohibit a collision: objects 1 and 2 already share category 0.
| Category | Object positions | Count |
|---|---|---|
| 0 | 1, 2 | 2 |
| 1 | ∅ | 0 |
| 2 | 3 | 1 |
Compare the one-each arrangement with a repeated category. Both have n = m = 3, so totals alone cannot decide injectivity.
The finite pigeonhole principle says: if n > m, then at least one category contains at least two objects. Suppose instead that every category contains at most one. Adding the m counts would give n ≤ m, contradicting n > m. Therefore there are different objects x and y with f(x) = f(y). This is called a collision; the objects remain distinct even though their categories agree.
The condition is strict. When n = m, one object per category is possible. A collision is also possible, as counts (2, 0, 1) show when n = m = 3. When n < m, a collision can still occur, but the counts alone do not force it. The theorem gives a sufficient condition, not an if-and-only-if test for actual collisions.
| Objects n | Categories m | Example counts | What the totals force |
|---|---|---|---|
| 4 | 3 | 2, 1, 1 | Some collision in every assignment |
| 3 | 3 | 1, 1, 1 | A collision need not occur |
| 3 | 3 | 2, 0, 1 | This assignment has a collision |
| 0 | 3 | 0, 0, 0 | There are no two objects to collide |
Distinct outputs require enough available categories
A function is injective when different inputs always have different outputs. Equivalently, each output category holds at most one input. For a function between finite sets, injectivity therefore implies n ≤ m. This is the contrapositive of n > m forcing noninjectivity: if no collision occurs, the source cannot be larger than the target.
Do not reverse that implication. The inequality n ≤ m does not make a particular function injective: two inputs can both be assigned to the first category even when many others are unused. With no additional restrictions, n ≤ m does allow some injective assignment, obtained by choosing n different categories. Existence of an injective assignment and injectivity of the assignment in front of you are different claims.
If m = 0, a nonempty source has no function into that target at all; an empty source has the empty function. We require m ≥ 1 for the box averages below so that division by m and a statement about some category make sense. The argument is finite: an infinite source and infinite target cannot be compared by subtracting or averaging their sizes in this way.
The average forces a large category and a small one
For a real number t, ⌈t⌉ is the smallest integer at least t and ⌊t⌋ is the largest integer at most t. For example ⌈11/4⌉ = 3 and ⌊11/4⌋ = 2, while both rounded values of 12/4 equal 3. Counts are integers, so the rounding directions matter.
With n ≥ 0 objects assigned to m ≥ 1 categories, some category has at least ⌈n/m⌉ objects. Write c = ⌈n/m⌉. If all categories had fewer than c, each would have at most c−1. Their total would be at most m(c−1), which is strictly smaller than n because c−1 < n/m. This contradicts their actual total n.
Some category also has at most ⌊n/m⌋ objects. Put q = ⌊n/m⌋. If every category had more than q, each integer count would be at least q+1. The total would be at least m(q+1) > n because q+1 > n/m. Thus that assumption is impossible.
For n = 0, every category is empty: both guarantees say that some category has at least 0 and some has at most 0. They do not produce an object or a pair. If m = 1, its sole count is exactly n. For n > m, the ceiling is at least 2, recovering the basic principle.
For eleven objects in four categories, the ceiling guarantees a category of size at least 3 and the floor guarantees a category of size at most 2. These may be different categories. The conclusion is not that every category has 3, nor that any chosen category has 3. Counts (8, 1, 1, 1) satisfy both guarantees just as counts (3, 3, 3, 2) do.
A capacity bound becomes a strict forcing threshold
Choose a nonempty family of m categories. Suppose each count is required to lie between integers L and U, where 0 ≤ L ≤ U. Summing the individual bounds gives mL ≤ n ≤ mU. These bounds are necessary for that requirement to be possible. With unrestricted assignment among the categories they are also sufficient: start with L in each, then distribute the n−mL remaining objects into at most U−L free places per category.
If n > mU, some count must exceed U; equality n = mU does not force an excess. In integer terms the first forcing total is mU+1. If n < mL, some count must fall below L; equality n = mL does not force a shortage. This lower-threshold statement has a possible antecedent only when L > 0, because n cannot be negative.
Six meet an upper capacity
- Circle: ordinary object or point
- Diamond: revealed witness pair
Dashed line: count requirement, not an object
All three counts are 2. The total equals 3×2 = 6 and no count exceeds the upper capacity 2.
| Category | Object positions | Count |
|---|---|---|
| 0 | 1, 2 | 2 |
| 1 | 3, 4 | 2 |
| 2 | 5, 6 | 2 |
Seven cross an upper capacity
- Circle: ordinary object or point
- Diamond: revealed witness pair
Dashed line: count requirement, not an object
Counts are 3, 2, 2. Seven exceeds 3×2 = 6, forcing some count above the upper capacity 2.
| Category | Object positions | Count |
|---|---|---|
| 0 | 1, 2, 3 | 3 |
| 1 | 4, 5 | 2 |
| 2 | 6, 7 | 2 |
Six meet a lower requirement
- Circle: ordinary object or point
- Diamond: revealed witness pair
Dashed line: count requirement, not an object
All three counts are 2. The total equals the lower required sum 3×2 = 6 and no category falls below 2.
| Category | Object positions | Count |
|---|---|---|
| 0 | 1, 2 | 2 |
| 1 | 3, 4 | 2 |
| 2 | 5, 6 | 2 |
Five miss a lower requirement
- Circle: ordinary object or point
- Diamond: revealed witness pair
Dashed line: count requirement, not an object
Counts are 2, 2, 1. Five is below the lower required sum 3×2 = 6, so some count must fall below 2.
| Category | Object positions | Count |
|---|---|---|
| 0 | 1, 2 | 2 |
| 1 | 3, 4 | 2 |
| 2 | 5 | 1 |
Compare equality with one beyond or below it. Crossing the strict total threshold forces a violation; meeting the equality total does not.
To force at least k objects in one category, with integer k ≥ 1, rule out the avoidance arrangement in which every count is at most k−1. The sharp threshold is n ≥ m(k−1)+1. At n = m(k−1), putting k−1 in every category avoids the goal. For k = 1, one object suffices; zero objects do not.
For three categories and a maximum of two each, six objects can fit as (2, 2, 2), whereas seven force some category above two. For a minimum of two each, six permit (2, 2, 2), whereas five force a count below two. A capacity requirement is not a physical promise that an impossible arrangement will somehow fit; crossing the bound proves that at least one requirement must fail.
Add disjoint cases; multiply successive choices
Before applying a counting bound, count the categories accurately. If each object is in exactly one of several disjoint groups, add the group sizes. Disjoint means no object belongs to two of the groups. If two groups overlap, adding their sizes counts shared objects twice; first give them unique ownership or subtract the shared count once.
For successive choices, count the complete paths. If a first choice has two possibilities and each has three possible second choices, the six ordered outcomes are (1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3). The product 2×3 counts each path once. It requires three continuations for every first choice; no probabilistic independence assumption is involved.
Two branches with three continuations each
| First choice | Second choice |
|---|---|
| 1 | 1 |
| 1 | 2 |
| 1 | 3 |
| 2 | 1 |
| 2 | 2 |
| 2 | 3 |
Read each leaf as an ordered pair. Equal continuation counts permit multiplication; unequal branch counts are added.
Three continuations, then two
| First choice | Second choice |
|---|---|
| 1 | 1 |
| 1 | 2 |
| 1 | 3 |
| 2 | 1 |
| 2 | 2 |
Read each leaf as an ordered pair. Equal continuation counts permit multiplication; unequal branch counts are added.
If the first branch has three continuations but the second has only two, the total is 3+2 = 5, not 2×3. The tree makes the missing path visible. Once you have identified six genuinely distinct categories, seven objects assigned to them force a collision; if you accidentally count one category twice, that guarantee can be weakened or misapplied.
Equal remainders give a divisible difference
Fix a positive integer m. Each integer a, including a negative one, has a unique expression a = qm+r with integer q and remainder 0 ≤ r < m. Assign a to its remainder r. There are exactly m categories, labelled 0, 1, …, m−1; a negative integer does not create a new negative-remainder category.
Among m+1 distinct integers, two must have the same remainder. If a = qm+r and b = pm+r, subtracting gives b−a = (p−q)m, a multiple of m. The integers are distinct, so their difference is nonzero. The theorem does not say that one of the original integers is divisible by m, nor that their sum is divisible by m.
Six signed integers modulo five
- Circle: ordinary object or point
- Diamond: revealed witness pair
The remainders are 3, 3, 0, 3, 3, 1. Distinct integers −7 and −2 form a witness with difference 5. The tables list every same-remainder pair.
| Category | Object positions | Count |
|---|---|---|
| 0 | 3 | 1 |
| 1 | 6 | 1 |
| 2 | ∅ | 0 |
| 3 | 1, 2, 4, 5 | 4 |
| 4 | ∅ | 0 |
| Position | Integer a | Quotient q | Remainder r |
|---|---|---|---|
| 1 | -7 | -2 | 3 |
| 2 | -2 | -1 | 3 |
| 3 | 0 | 0 | 0 |
| 4 | 3 | 0 | 3 |
| 5 | 8 | 1 | 3 |
| 6 | 11 | 2 | 1 |
| First position | Second position | Shared remainder | Difference b−a | Multiple of m |
|---|---|---|---|---|
| 1 | 2 | 3 | 5 | 1 |
| 1 | 4 | 3 | 10 | 2 |
| 1 | 5 | 3 | 15 | 3 |
| 2 | 4 | 3 | 5 | 1 |
| 2 | 5 | 3 | 10 | 2 |
| 4 | 5 | 3 | 5 | 1 |
For negative integers choose a remainder between 0 and 4. The quotient changes sign as needed; the remainder is still one of five categories.
For m = 5, the six integers −7, −2, 0, 3, 8 and 11 have remainders 3, 3, 0, 3, 3 and 1. One witness is −7 and −2: their difference is 5. The assignment table finds actual witnesses; the counting argument establishes that a witness exists for every choice of six distinct integers.
If the inputs are repeated observations rather than a set of distinct integer values, treat their positions as the objects. Two observations of 2 share a remainder and have difference 0, which is divisible by m. That is a valid collision of positions, but it is not a pair of distinct integer values with a nonzero difference. State which kind of object the application requires.
A large group is not necessarily your group
A partition of a finite set separates its members into nonempty disjoint groups whose union is the whole set. The groups can be the categories in the principle. If a class of 25 learners is partitioned into six project groups, some group contains at least ⌈25/6⌉ = 5 learners. The theorem does not identify that group or say that all six contain five.
A month-of-birth assignment has twelve possible categories even if some are empty. Thirteen people force two with the same birth month. Twelve people may already have many shared months, but one per month avoids a collision. This is a deterministic guarantee; no randomness, equal likelihood of months or independence of birthdays is needed.
You cannot infer that another person shares your own month. All twelve other people could have one different month. More generally, existence of some repeated category does not select a prescribed category, the final object, or a prescribed pair. To find a witness in a finite dataset, compute the categories and compare their members; the proof and the search answer different questions.
Compare an arrangement with its counting guarantee
Predict what the totals force, then reveal the actual category counts. The arrangement can contain more repetition than the universal lower bound promises.
What minimum size must some category have? Does a collision have to occur?
- Circle: ordinary object or point
Choosing another case resets the prediction.
The exact tables and witness highlights appear after reveal. The original arrangement remains visible so you can make your prediction.
These are complete finite arrangements. The general guarantee comes from summing all category counts, not from how often a sample arrangement happens to collide.
Five points in a square force a close pair
Take five distinct points in the closed unit square: coordinates satisfy 0 ≤ x ≤ 1 and 0 ≤ y ≤ 1, in the same length unit. Divide each coordinate interval into a low half [0, 1/2) and a high half [1/2, 1]. The bracket includes an endpoint and the parenthesis excludes it. A midpoint belongs to the high half; an outer endpoint belongs to its containing half.
Assign a point by its low-or-high x and low-or-high y. These four categories are disjoint and include every point, including points on the dividing lines. In the diagram category labels are 0 for low-low, 1 for high-low, 2 for low-high and 3 for high-high. Since 5 > 4, two points share a category.
Four corners and centre
- Circle: ordinary object or point
- Diamond: revealed witness pair
The centre belongs only to category 3, along with corner point 4. Their squared distance is exactly 1/2; the inclusive bound is sharp.
| Category | Object positions | Count |
|---|---|---|
| 0 | 1 | 1 |
| 1 | 2 | 1 |
| 2 | 3 | 1 |
| 3 | 4, 5 | 2 |
| Point | x | y | Owned category |
|---|---|---|---|
| 1 | 0 | 0 | 0 |
| 2 | 1 | 0 | 1 |
| 3 | 0 | 1 | 2 |
| 4 | 1 | 1 | 3 |
| 5 | 1/2 | 1/2 | 3 |
Each midpoint coordinate belongs to the high half. The four cells are disjoint even though their closed bounding squares touch. Coordinates and distances use the same length unit.
The centre is assigned to the high-high category only. The corner-and-centre case attains squared distance 1/2 and prevents replacing the inclusive bound by a strict one.
For two points in one category, |Δx| ≤ 1/2 and |Δy| ≤ 1/2. The Pythagorean distance d satisfies d² = (Δx)²+(Δy)² ≤ 1/4+1/4 = 1/2, hence d ≤ √2/2 length units. The drawn axes use the same scale. Choosing a unique boundary owner supplies a valid function; closed bounding squares still give the inclusive distance bound.
The conclusion cannot be strengthened to d < √2/2 for every set of five points. Put points at the four outer corners and the centre. Centre-to-corner distances equal √2/2; corner-to-corner distances are 1 or √2, so the shortest distance is exactly √2/2. Nor does the principle identify which two points will share a category before their coordinates are supplied.
Four corner points occupy four different categories and have no distance at most √2/2. This shows why five is needed for this guarantee. The distance proof concerns arbitrary points in the continuous square; the finite plotted cases illustrate its assignment and witnesses, rather than proving the general result by sampling.
Worked examples
Prove both sufficiency and minimality
With three possible sock colours, how many socks force two of one colour? Assume enough socks are available.
- Use individual socks as objects and their three colour labels as categories. Each sock belongs to exactly one category.
- Four objects exceed three categories, so at least one colour occurs twice.
- Three do not force a pair: one sock of each colour avoids repetition. This valid avoidance case proves that a smaller universal threshold is impossible.
Four socks are sufficient and are the smallest universal threshold. The pair need not have a colour specified beforehand.
Read a ceiling without prescribing every count
What largest-category guarantee follows from eleven objects in four categories? Can it be improved using only these totals?
- Compute 11/4 = 2.75 and ⌈11/4⌉ = 3. If every count were at most 2, the total would be at most 8, contradicting 11.
- Integer division gives 11 = 4×2+3. The balanced counts (3, 3, 3, 2) have maximum 3 and total 11.
- That arrangement prevents a guarantee of 4. Other arrangements, such as (8, 1, 1, 1), can have a larger maximum but do not change the universal bound.
Some category has at least 3 objects. The bound is sharp; neither every category nor a specified category is guaranteed to have 3.
Find the first total beyond an avoidance capacity
What total forces at least four objects in one of five categories?
- To avoid four, each category can have at most three. Five categories can then hold at most 5×3 = 15 objects.
- Sixteen crosses that capacity, so at least one count is at least four.
- Fifteen objects can be distributed as (3, 3, 3, 3, 3), avoiding the goal. This proves minimality.
The sharp threshold is 16 = 5(4−1)+1. At total 15 the desired group may exist, but it is not forced.
Use the same remainder range for both signs
Show a divisible difference among −7, −2, 0, 3, 8 and 11, using modulus 5.
- Write −7 = (−2)×5+3 and −2 = (−1)×5+3. Their remainders are both 3, not −2.
- All six values are assigned to the five remainder categories. Some pair must collide; these first two already provide a witness.
- Subtract: (−2)−(−7) = 5 = 1×5. The shared remainder cancels, exactly as in the general proof.
−7 and −2 are distinct values with difference 5. The guarantee concerns a divisible difference, not a divisible sum or a specified original value.
Handle a centre point without counting it four times
For the four corners and the centre of the unit square, assign categories and check the distance guarantee.
- The corners (0, 0), (1, 0), (0, 1), (1, 1) go to categories 0, 1, 2, 3. The centre (1/2, 1/2) goes only to category 3 because equality belongs to the high half.
- The centre and (1, 1) share category 3. Their squared distance is (1/2)²+(1/2)² = 1/2.
- Their distance is √2/2. All other centre-to-corner distances are the same, and distinct corners are at distance at least 1.
The bound d ≤ √2/2 is attained. Assigning the centre to four categories would break the sum-of-counts argument; unique ownership preserves it.
Try it yourself
Five objects are assigned to five categories. Must the assignment be injective? Must it have a collision? Give arrangements supporting your answer.
Show the answer and reasoning
Neither is forced. Counts (1, 1, 1, 1, 1) are injective; (2, 0, 1, 1, 1) contain a collision.
Both arrangements have five objects and five categories. The theorem requires n > m to force noninjectivity. The necessary condition n ≤ m for injectivity does not establish that a particular assignment is injective.
What do the ceiling and floor statements say for zero objects in four categories, and for seven objects in one category?
Show the answer and reasoning
For zero objects every count is 0, so both bounds are 0 and no pair exists. With one category its count is exactly 7.
The family of categories is nonempty in both cases, so statements about some category are meaningful. For m = 1, both rounded values equal n. The zero-object guarantee is about empty counts, not the existence of an object.
Find the ceiling and floor guarantees for 25 objects in six categories. Give a balanced arrangement proving both bounds sharp.
Show the answer and reasoning
Some category has at least 5, and some has at most 4. Counts (5, 4, 4, 4, 4, 4) attain these bounds.
25 = 6×4+1, so one balanced category gets 5 and the remaining five get 4. The maximum is 5 and minimum 4. These are statements about some categories, potentially different ones, rather than about every category.
Twelve objects occupy four categories. Does divisibility by four force all counts to equal three? What additional upper bound would force this?
Show the answer and reasoning
No: (9, 1, 1, 1) is possible. If each count is at most 3, their total 12 forces all four to equal 3.
Four counts each at most three have maximum possible total twelve. If one were smaller, the others could not compensate without exceeding three. The individual bound together with the total proves equality; divisibility alone does not.
Each of four categories must contain between two and five objects. What total range is possible with unrestricted assignment? What do totals 7 and 21 force?
Show the answer and reasoning
The possible totals are every integer from 8 through 20. Total 7 forces a count below 2; total 21 forces a count above 5.
Start with two objects in each category, totalling eight, and add up to three per category. This achieves all intermediate totals. Seven is below the lower sum; twenty-one exceeds the upper sum. Equality at eight or twenty does not force a violation.
One first choice has three continuations and another has two. How many complete paths exist? Separately, two groups have sizes four and three with two shared objects: how many distinct objects are in their union?
Show the answer and reasoning
There are 3+2 = 5 paths. The union has 4+3−2 = 5 distinct objects.
The branch counts are unequal, so multiplying two by three invents a missing path. For the union, the shared objects are counted in both group totals and must each be subtracted once. In each problem, count every final object once.
Why do any eight distinct integers contain two whose nonzero difference is divisible by seven? Can you instead conclude that their sum is divisible by seven?
Show the answer and reasoning
Eight objects exceed seven remainder categories, so a pair has the same remainder and a nonzero difference divisible by 7. The sum conclusion does not follow.
Subtracting equal remainders cancels them. Adding would give twice that remainder, which need not be zero modulo seven. Distinctness of the integer values makes the difference nonzero; repeated positions alone would not ensure this.
In a group of thirteen people including you, must someone else share your birth month? What shared-month statement is guaranteed?
Show the answer and reasoning
Your own month need not repeat. Some two people share a month, but the pair may exclude you.
The other twelve could all have one month different from yours, so a specified category is not guaranteed a second member. Thirteen people assigned to twelve possible months do force some repeated month, regardless of birthday probabilities.
Which category owns (1/2, 1/4), (1/4, 1/2) and (1/2, 1/2)? Can five arbitrary points always guarantee a distance strictly less than √2/2?
Show the answer and reasoning
They belong to categories 1, 2 and 3 respectively. No: the four corners and centre have shortest distance exactly √2/2.
Equality at a midpoint belongs to the high coordinate half, giving unique ownership. The same-category calculation proves an inclusive bound. The exact corner-and-centre arrangement disproves a universal strict bound while attaining the inclusive one.
What to carry forward
- Count finite distinct objects, use a nonempty family of categories, and assign every object exactly once.
- n > m forces a collision. Injectivity implies n ≤ m; the converse does not describe a particular assignment.
- Some count is at least ⌈n/m⌉ and some at most ⌊n/m⌋. Balanced counts show both universal bounds are sharp.
- Exceeding mU forces a count above U; going below mL forces a count below L. Equality alone does not force a violation.
- Identify the categories and ownership rule in each application. Existence of a witness does not specify your category or a chosen pair.
References
Sources for the concepts and teaching approaches in this article.
- Combinatorics · Version 2.1.1 (March 2023), PDF editionJoy MorrisTextbook chapter · PDF2.1 The product rule2.2 The sum rule10.1 The Pigeonhole Principle
- Pigeonhole Principle, Math 184A · Winter 2019Glenn TeslerCourse notes · PDFFloor, ceiling and generalized boundsWhat existence does not identify
- A Math Problem about Points in the Unit SquareWilliam GasarchTeaching resource · PDFFive points and a sharp distance bound