MathematicsDiscrete MathematicsMedium

Pigeonhole Principle

Also known as:Dirichlet Drawer PrincipleBox Principle

The Pigeonhole Principle states that if n items are placed into m containers and n > m, then at least one container must hold more than one item. It is a fundamental combinatorial tool used to prove the existence of certain configurations without constructing them explicitly. Applications range from proving that two people in a city share a birthday to guaranteeing collisions in hash functions.

Worked Example

Problem

A drawer contains socks in 5 different colours. How many socks must you draw (without looking) to guarantee a matching pair?

Solution

Step 1: Identify the number of "pigeonholes" — there are 5 colours, so m = 5. Step 2: Apply the Pigeonhole Principle: to guarantee that at least one colour repeats, you need n > m items. Step 3: With n = 5 draws you might get one sock of each colour — no pair yet. Step 4: The 6th sock must match one of the 5 colours already drawn.

Answer

6 socks must be drawn to guarantee at least one matching pair.

Common Applications of the Pigeonhole Principle

ScenarioPigeonholes (m)Items (n)Guaranteed Conclusion
Birthday matching in a group365 days366 peopleAt least 2 share a birthday
Sock colour matching5 colours6 socksAt least one matching pair
Hair strand count in a city150,000 strands1,000,000 peopleTwo people have same count
Hash table collisionsk bucketsk+1 keysAt least one bucket has 2 keys
Card suit matching4 suits5 cardsAt least two cards share a suit

Interactive Tools

Brilliant — Pigeonhole Principle

Open Tool

Khan Academy — Combinatorics

Open Tool

Wolfram MathWorld — Pigeonhole Principle

Open Tool
Pigeons crowded into fewer pigeonholes than there are pigeons, illustrating the principle

Wikimedia Commons, CC BY-SA

Related Terms

The term derives from the literal image of pigeons (columba) being assigned to holes (nidi) in a dovecote. The principle was formalised by German mathematician Peter Gustav Lejeune Dirichlet in 1834 and is therefore also called the Dirichlet drawer principle (Schubfachprinzip in German).

combinatoricsexistence-proofcountingdiscrete-mathproof-technique