Discrete Math: Dirichlet's Principle

The Physics of
Counting

Also known as Dirichlet's Box Principle. It is a statement of simple finiteness: you cannot fit a large quantity into a smaller container without overlap.

While intuitively obvious, this principle is a profound tool in combinatorics and computer science. It proves that in a city like London, two people must have the exact same number of hairs on their heads, and that perfect, universal file compression is mathematically impossible.

01 / The Concept

Basic Definition

If n items are put into m containers, with n > m, then at least one container must contain more than one item.

Status: Empty
State
n = 0, m = 5
02 / The Math

Generalized Principle

The principle dictates not just the existence of a collision, but the magnitude.

If n objects are distributed into m boxes, then at least one box contains at least ⌈n/m⌉ objects. The notation ⌈x⌉ represents the ceiling function (rounding up).

10
3
Guaranteed Crowd
10 / 3⌉ = 4

At least one container must have 4 or more items, no matter how evenly you try to distribute them.

03 / Real World Application

The Hair of London

A classic proof of existence without finding the specific instance.

Proposition: There are at least two people in London with the exact same number of hairs on their heads.

Proof: The population of London (n) is ~9,000,000. The maximum number of hairs on a human head (m) is ~150,000. Since 9,000,000 > 150,000, by PHP, collisions are inevitable. In fact, we can calculate exactly how many people must share a count.

The Sock Drawer (Worst Case): Use PHP to solve daily problems. If you have socks of k colors, pulling k + 1 socks guarantees a matching pair.

Infinite Sets: While counting uses finite numbers, PHP also applies to infinity. If you put infinitely many items into a finite number of boxes, at least one box must contain infinitely many items.

Hairs (m)
150k
Population (n)
9,000,000
Calculation: ⌈9,000,000 / 150,000⌉
Guaranteed Matches
60
04 / Probability vs Certainty

The Birthday Problem

Distinguishing between high probability and the Pigeonhole Principle.

To guarantee two people share a birthday, you need 367 people (366 days + 1 pigeon). However, probability works faster. With just 23 people, there is a 50% chance of a collision. With 70 people, it's 99.9%. The PHP deals only with 100% certainty.

0
People
Prob: 0% No Match
05 / Geometric Proof

Points in a Square

Pick 5 points in a unit square (1x1). PHP proves that at least two points are within distance √2/2 of each other.

Logic: Divide the square into 4 smaller squares (bins). If you place 5 points (pigeons), one small square must contain at least 2 points. The max distance in a small square is its diagonal (√2/2 ≈ 0.707).

Points Placed
0 / 5
PHP Triggered.
Two points share Quadrant --.
06 / Computer Science

The Impossibility of Infinite Compression

Why "Pied Piper" from Silicon Valley is mathematically impossible.

If a compression algorithm guarantees that a file gets smaller, then there are fewer possible output files (holes) than input files (pigeons). Therefore, two different inputs must compress to the same output. Since you can't decompress one file into two different originals, lossless compression for all files is impossible.

All Files (N bits) 2ᴺ
Compressed 2ᴺ⁻¹

Error: Pigeonhole Overflow.
Multiple inputs map to single output. Data loss inevitable.

Glossary

Key Definitions

Pigeonhole Principle

The principle stating that if n items are put into m containers, with n > m, then at least one container must contain more than one item.

Mapping

A relationship between two sets of data (domain and codomain).

Collision

When two or more inputs map to the same output (pigeonhole).

Proof

A logical argument demonstrating that a statement is true in all cases.

Combinatorics

A branch of mathematics concerning the study of finite or countable discrete structures.

Function

A relation from a set of inputs to a set of possible outputs.

Lossless Compression

A class of data compression algorithms that allows the original data to be perfectly reconstructed.

Probability

The measure of the likelihood that an event will occur.

Ceiling Function

A mathematical function that maps x to the least integer greater than or equal to x (⌈x⌉).

Existence Proof

A proof that shows an object exists without necessarily constructing it or providing an example.

08 / Knowledge Check