Probability & Combinatorics
Intermediate

Pigeonhole Principle

If n items go into k containers, some container holds at least this many.

Formula

⌈n/k⌉\lceil n/k \rceil

Variables

nItems
kContainers

Example

10 socks, 3 colors: some color has ≥ 4

How it works

This principle says that if you distribute n items among k containers, then at least one container must contain at least the average number of items, rounded up. It works because if every container had fewer than \u230a n/k \u2309? Actually, if every container had at most one less than the ceiling, the total would fall short of n, so that is impossible. In other words, uneven distribution forces one container to reach or exceed the ceiling of n/k.

When to use it

Use it whenever you need to guarantee that some group, box, day, person, or category has a minimum count without knowing the exact distribution. It is common in counting, scheduling, graph theory, and "at least one must..." proof problems.

Worked example, step by step

Example: 23 students are placed into 5 project teams. Step 1: Identify n = 23 items and k = 5 containers. Step 2: Compute n/k = 23/5 = 4.6. Step 3: Round up: \u230823/5\u2309 = 5. Step 4: Conclusion: at least one team must have 5 students or more. Step 5: Check the logic: if every team had only 4 students, the total would be 5 \u00d7 4 = 20, which is not enough for 23 students.

Common mistakes to avoid

  • Using floor instead of ceiling, which gives a value that is too small
  • Forgetting that the guarantee is "at least one container," not that every container has that many
  • Applying the rule without correctly identifying what counts as an item and what counts as a container

Did You Know?

A simple idea that proves surprisingly deep results.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026