PIGEONHOLE
If more objects than containers exist, at least one container must hold more than one object — a simple idea with powerful consequences.
Overview
The Pigeonhole Principle says: if you distribute objects into containers and , then at least one container must contain at least two objects. The name comes from pigeons flying into holes — if 5 pigeons share 4 holes, one hole holds at least 2 pigeons.
Despite sounding trivial, the pigeonhole principle is one of the AMC's favorite tools for "guarantee" questions. The key phrase to watch for is "what is the minimum number you must pick to be certain that…" These are worst-case problems: you are not asking what usually happens, but what the adversary can force. Always imagine someone handing you items in the worst possible order before you "win."
The principle extends beautifully to structured settings. By choosing clever containers — residue classes, sums to a target, geometric regions — you can prove that collisions must occur even when the numbers look sparse.
Key facts
-
Basic pigeonhole: Distribute objects into containers. If , at least one container contains objects. Use when: proving existence, worst-case minimum-picks.
-
Generalized pigeonhole: If objects go into containers, at least one container holds objects. Use when: guaranteeing that some container holds many objects.
-
Worst-case formula for socks/gloves:
- Matching pair from colors: pick socks.
- Matching pair from colors of gloves (left + right): pick gloves (worst case is all left-hand or all right-hand first). Use when: drawing from a mixed pile, need a guaranteed match.
-
Remainders as pigeonholes: Among any integers, two must share the same remainder when divided by . Their difference is divisible by . Use when: divisibility or difference-divisible-by- arguments.
-
Pairs summing to a fixed value: To guarantee two numbers from that sum to , note the pairs , i.e. If is even there are clean pairs and choosing numbers forces a pair; if is odd, the middle element is unpaired, and choosing numbers forces a pair. Use when: sum-to- guarantee problems.
Worked example 1
Problem. A drawer contains socks in 6 different colors. You grab socks in the dark, one at a time. What is the minimum number of socks you must grab to guarantee a matching pair?
Solution. The 6 colors act as containers. In the worst case you could pick one sock of each color before getting a repeat: 6 socks with no match. The next sock (the 7th) must match one of the 6 colors already in your hand.
Answer: socks.
Why the formula works: You need picks to guarantee a pair from containers. The adversary tries to delay your win by always giving you a new color; after picks they are forced to repeat.
Worked example 2
Problem. Seven distinct integers are chosen from the set . Prove that two of them must sum to .
Solution. Partition into six pairs that each sum to : These six pairs are the containers. When you choose 7 integers, you place 7 objects into 6 containers (choosing a number "enters" its pair). By pigeonhole, at least one container holds both members — meaning both integers of some pair were chosen. Those two integers sum to .
Key insight: building the right containers (here, complementary pairs) is the creative step; once you have them the pigeonhole logic is automatic.
Common traps
-
Off-by-one on "guarantee" problems. If there are types, the minimum guarantee is , not . It is always possible (if unlikely) to be unlucky times in a row.
-
Confusing "could happen" with "must happen." Pigeonhole gives an existence guarantee — something must be true — but it doesn't tell you which container is overloaded or how to find it.
-
Gloves vs socks. For gloves (handed), one left and one right of the same color is a pair. Picking from colors gives a repeated color, but both could be left-hand gloves. The correct worst case is: take all left gloves, then all right gloves — that's with no complete pair. The -th glove must complete a pair: is the answer.
-
Forgetting to define the containers. The hard part of pigeonhole problems is identifying what plays the role of the holes. If you jump straight to a formula without constructing the partition, you may use the wrong .
-
Applying generalized pigeonhole incorrectly. guarantees at least one container holds that many — not that every container does.