What Is the Pigeonhole Principle? Examples and Applications

Pick any 13 people and I can guarantee two share a birth month, no questions asked. That guarantee has a name, the pigeonhole principle, and once you see how it works you'll spot it everywhere from sock drawers to hair counts.

By Petrus Sheya

August 12, 2026 · 6 min read

Pick any 13 people, anywhere. Ask nothing else about them. I can already guarantee two of them were born in the same month.

I don't need their names, their ages, or anything else about their lives. It works every single time, for every group of 13 or more. That's a strange thing to be able to say with total certainty about total strangers, and the reason it works has a name: the pigeonhole principle.

It sounds too obvious to be useful. Wait until you see what it can prove.


The idea is almost embarrassingly obvious

Picture an old writing desk with a row of small square slots built into it, the kind clerks once used to sort mail. Those slots are literally called pigeonholes, because they look like the little compartments people used to build into walls to house pigeons.

Now say you have 4 pigeonholes and 5 pigeons, and every pigeon has to go into some hole. At least one hole ends up with two or more pigeons in it. There's no way around it. Try every arrangement you like, and it happens every time.

Click a hole to drop the next pigeon into it. Try to keep every hole under two pigeons for as long as you can.

hole 1hole 2hole 3hole 4
Pigeons dropped0
First collision at pigeon #
Guaranteed bypigeon 5

Click a hole to send the next pigeon into it. Try to spread them out as evenly as you can, on purpose, and you'll still hit a hole with two pigeons by the time the 5th one drops. That's not luck. With 4 holes, pigeon number 5 is mathematically forced to double up somewhere.

That's the whole principle. If you have more items than containers, at least one container ends up holding more than one item. We write it formally as: if nn items are placed into kk containers and n>kn > k, then some container holds at least 2 items. Simple enough to say in one sentence. Powerful enough to prove things that look nowhere near this simple.


But what if I have way more pigeons than that?

Here's where it gets more useful. Knowing that some hole gets crowded is fine, but what if you want to know exactly how crowded, at minimum?

Say you spread your pigeons as evenly as humanly possible. With nn pigeons and kk holes, the fairest split gives some holes n/k\lfloor n/k \rfloor pigeons and gives the rest one extra, n/k\lceil n/k \rceil. That second number, always rounded up, is the least you can guarantee somewhere, no matter how hard you try to flatten things out.

This is the most evenly you could ever spread n pigeons across k holes, and even then, one hole always reaches ⌈n/k⌉.

⌈n/k⌉544444
⌈n/k⌉ guaranteed min5
Holes with the extra one1

Slide nn up and watch the bars. Even in the most balanced arrangement possible, at least one bar always reaches n/k\lceil n/k \rceil. Try to shrink that tallest bar by moving a pigeon out of it, and you just made a different bar taller instead. You can't flatten it below the ceiling.

That gives us the generalized pigeonhole principle:

some container holds at least nk items\text{some container holds at least } \left\lceil \frac{n}{k} \right\rceil \text{ items}

For our opening claim about birth months, n=13n = 13 people and k=12k = 12 months gives 13/12=2\lceil 13/12 \rceil = 2. That's the entire guarantee: at least one month has 2 people, every single time.


The real skill is naming the pigeons and the holes

Here's the part that trips people up. The pigeonhole principle itself isn't hard math, once you know the count it's one division and a round-up. The hard part, and the fun part, is figuring out what your pigeons and holes actually are in a real problem.

For the birth month claim, the pigeons are people and the holes are the 12 months. Let's watch it happen with actual random people instead of just trusting the formula.

Randomly assign each person a birth month. Below 13, a collision is possible but not certain. At 13 or more, it's forced.

Jan13
Feb0
Mar0
Apr0
May0
Jun0
Jul0
Aug0
Sep0
Oct0
Nov0
Dec0
This shuffle collided?Yes
Guaranteed to collide?Yes, always

Slide the room size down below 13 and reshuffle a few times. Sometimes you get lucky and every month is unique. Slide it up to 13 or beyond and reshuffle as many times as you like. You will never once see 12 empty gaps. Some month always doubles up. That's the difference between "probably" and "provably."

This is worth sitting with, because it's easy to confuse with a related but very different question: given a room of people, what's the chance two of them share the exact same birthday, not just the same month? That question has a genuinely surprising answer, and it lives in probability, not certainty. If that sounds interesting, the birthday paradox is the pigeonhole principle's louder, more famous cousin. Pigeonhole tells you something is certain. The birthday paradox tells you something unlikely turns out to be likely. Different tools, same neighborhood.


Guarantees come from the worst case, not the average case

One more example, because this is where the principle earns its keep in real problems: how many socks do you need to pull from a drawer, blind, to guarantee a matching pair?

Say the drawer has socks in kk different colors, plenty of each. If you're unlucky, or deliberately trying to avoid a match, you could pull one of every color before you're forced to double up. That's kk socks with zero pairs. The very next sock, sock number k+1k+1, has nowhere to go but a color you've already got. A match is forced.

Step through the worst possible draw order, one of every color first. Watch what has to happen on draw k + 1.

draw 1draw 2draw 3draw 4draw 5draw 6
Draws so far0
Matched?Not yet
Guaranteed by draw6

Step through the draws, or press play and watch it happen automatically. No matter which colors show up first, the (k+1)(k+1)th sock always repeats one. The socks you pull are the pigeons, the colors are the holes, and "worst case" just means an imaginary adversary trying to dodge a collision for as long as mathematically possible, which turns out to be exactly kk draws.

draws needed to guarantee a match=k+1\text{draws needed to guarantee a match} = k + 1

This kind of worst-case reasoning shows up constantly once you notice it. A famous non-obvious version: in a city where nobody has more than 1 million hairs on their head, and the population is over 1 million, at least two people must have the exact same number of hairs. You'll never find that pair. You don't need to. The pigeonhole principle already proved they exist, the same way it proved a birth month collision, or a sock match. The proof doesn't need to point at a specific pair. It just needs to make hiding from a collision impossible.


The short version

The pigeonhole principle says that when you have more items than containers, at least one container is forced to hold more than one item. Spread things as evenly as you like, the tallest container never drops below n/k\lceil n/k \rceil. The hard part is never the arithmetic. It's recognizing what counts as a pigeon and what counts as a hole in the problem sitting in front of you. Once you spot that, the guarantee falls out for free, no luck, no averages, no exceptions.

If you enjoyed the "certainty versus chance" contrast in this post, proof by contradiction is the other classic move mathematicians reach for to prove something exists without ever pointing at it directly, and it often works hand in hand with pigeonhole arguments.


All visualizations are interactive React components running entirely in your browser, computing every distribution and draw sequence live rather than looking up precomputed answers. No libraries beyond React.