01 / 20

The Pigeonhole
Principle

A deceptively simple idea with surprisingly powerful consequences: if you have more objects than containers, at least one container must hold more than one object.

Discrete Math

What Is the Pigeonhole Principle?

Imagine you have 5 pigeons but only 4 pigeonholes. No matter how you assign pigeons to holes, at least one hole must contain 2 or more pigeons. This observation is the Pigeonhole Principle: one of the most fundamental tools in combinatorics and discrete mathematics.

Hole 1 Hole 2 Hole 3 Hole 4 1 2 3 4 5 At least 2 here! 5 pigeons → 4 holes
Some hole must hold \( \ge 2 \)

Why Does This Matter?

The Pigeonhole Principle seems obvious, but it is an existence proof tool: it guarantees that something must exist without telling you exactly where. It appears throughout mathematics, computer science, and everyday life.

Combinatorics
Prove that certain configurations are unavoidable in counting problems
Computer Science
Hash collisions are guaranteed when more keys than slots exist
Number Theory
Prove results about divisibility, remainders, and digit patterns

Everyday Illustrations

Socks in a Drawer
If you have 3 colors of socks and pull out 4, at least 2 must match
Birthdays
In a group of 367 people, at least 2 share a birthday (only 366 possible days)

The Formal Statement

Here \( \lceil x \rceil \) is the ceiling function: the smallest integer \( \ge x \). For example, \( \lceil 7/3 \rceil = 3 \), so distributing 7 items among 3 bins guarantees at least one bin has \( \ge 3 \) items.

Visualizing \( \left\lceil \frac{n}{k} \right\rceil \)

Bin 1 Bin 2 Bin 3 1 2 3 4 5 6 7
\( \ge 3 \) objects
7 objects → 3 bins
\( \lceil 7/3 \rceil = 3 \): some bin holds \( \ge 3 \)

Simple vs Generalized Form

Simple Form Generalized Form
Condition \( n > k \) \( n \) objects, \( k \) containers
Conclusion Some container has \( \ge 2 \) Some container has \( \ge \lceil n/k \rceil \)
Best for Quick existence proofs Counting exact minimums
Example 13 people → 12 months: 2 share a month 50 people → 12 months: \( \ge \lceil 50/12 \rceil = 5 \) share a month

How to Apply the Principle

1
Identify the "pigeons": What are the objects being distributed or assigned?
2
Identify the "holes": What are the categories, containers, or properties they can fall into?
3
Count and compare: Verify that the number of pigeons exceeds the number of holes (or compute \( \lceil n/k \rceil \) for the generalized form).
4
State the conclusion: Therefore, at least one hole must contain \( \ge 2 \) pigeons (or \( \ge \lceil n/k \rceil \)).

Example 1: Handshakes

Problem: In a room of \( n \) people where \( n \ge 2 \), prove that at least two people have shaken the same number of hands.

1
Pigeons: the \( n \) people, each with a handshake count.
2
Holes: possible handshake counts. Each person shook 0 to \( n-1 \) hands. But 0 and \( n-1 \) cannot both occur (if someone shook everyone's hand, no one shook zero hands). So there are only \( n-1 \) possible values.
3
Compare: \( n \) people \( > \) \( n-1 \) possible counts.
4
Conclude: At least two people must have the same handshake count. ✓

Example 2: Remainders

Problem: Given any 5 integers, prove that at least two of them have the same remainder when divided by 4.

1
Pigeons: the 5 integers.
2
Holes: possible remainders \( \pmod 4 \), which are \( \{0, 1, 2, 3\} \). That gives 4 holes.
3
Compare: \( 5 > 4 \).
4
Conclude: At least two integers share the same remainder \( \pmod 4 \). ✓

Example 3: Subset Sums

Problem: Given \( n \) integers \( a_1, a_2, \ldots, a_n \), prove there exists a consecutive subsequence \( a_{i+1} + a_{i+2} + \cdots + a_j \) whose sum is divisible by \( n \).

1
Define prefix sums: \( S_0 = 0 \), \( S_k = a_1 + a_2 + \cdots + a_k \) for \( k = 1, \ldots, n \). This gives \( n + 1 \) values.
2
Holes: remainders \( \pmod n \), which are \( \{0, 1, \ldots, n-1\} \). That is \( n \) holes.
3
Compare: \( n + 1 \) prefix sums \( > \) \( n \) remainders. By PHP, two prefix sums share the same remainder: \( S_i \equiv S_j \pmod{n} \).
4
Conclude: Then \( S_j - S_i = a_{i+1} + \cdots + a_j \) is divisible by \( n \). ✓

Visualizing Prefix Sums mod \( n \)

Example: \( n = 5 \), sequence = (3, 1, 4, 1, 5)
Prefix sums:
\( S_0 = 0 \)
\( \pmod 5 = 0 \)
\( S_1 = 3 \)
\( \pmod 5 = 3 \)
\( S_2 = 4 \)
\( \pmod 5 = 4 \)
\( S_3 = 8 \)
\( \pmod 5 = 3 \)
\( S_4 = 9 \)
\( \pmod 5 = 4 \)
\( S_5 = 14 \)
\( \pmod 5 = 4 \)
Same remainder 3
\( S_3 - S_1 = 8 - 3 = 5 \), divisible by 5 ✓
Same remainder 4
\( S_4 - S_2 = 9 - 4 = 5 \), divisible by 5 ✓
6 prefix sums → 5 possible remainders → collision guaranteed

Example 4: Points in a Square

Problem: If 5 points are placed inside a unit square (side length 1), prove that at least two points are within distance \( \frac{\sqrt{2}}{2} \) of each other.

Q1 Q2 Q3 Q4 close! Key Setup Pigeons: 5 points Holes: 4 quadrants
\( 5 > 4 \): some quadrant
has \( \ge 2 \) points
Max distance in a half-unit square:
\( \sqrt{1/4 + 1/4} = \frac{\sqrt{2}}{2} \)

Common Mistakes

✕ Wrong Direction
Saying "if \( n < k \) then every hole is empty" is false. PHP only guarantees something when \( n > k \): it says nothing about the \( n \le k \) case.
✕ Swapping Pigeons/Holes
Mixing up which objects are the "pigeons" and which are the "holes." The principle requires objects > containers. Reversing them invalidates the argument.
✕ Forgetting Edge Cases
Not checking that all items are truly distinct or that all categories are truly possible (like the 0 and \( n-1 \) conflict in the handshake problem).

Summary of Key Applications

Application Pigeons Holes Conclusion
Birthday problem 367 people 366 days 2 share a birthday
Remainders \( \pmod k \) \( k+1 \) integers \( k \) remainders 2 share a remainder
Consecutive sums \( n+1 \) prefix sums \( n \) remainders Divisible subsequence
Points in square 5 points 4 sub-squares 2 points are close
Hash collisions \( n \) keys \( m < n \) slots Collision guaranteed

Question 1 of 5

A drawer contains socks of 5 different colors. What is the minimum number of socks you must pull out (blindfolded) to guarantee that at least two socks are the same color?

Question 2 of 5

In a group of 50 people, what is the minimum guaranteed number of people who share the same birth month?

Question 3 of 5

Among any 6 integers, which of the following is guaranteed by the Pigeonhole Principle?

Question 4 of 5

You place 10 points inside an equilateral triangle with side length 1. You divide it into 9 smaller congruent equilateral triangles. What can you conclude?

Question 5 of 5

In applying the Pigeonhole Principle to prove that among \( n+1 \) integers, at least two have the same remainder mod \( n \), what serves as the "holes"?