Place objects into boxes, assigning each object to exactly one box. Here is a nonnegative integer and is a positive integer. The pigeonhole principle says that if , some box contains at least two objects. Equivalently, a function from an -element finite set to an -element finite set cannot be an injective function when . The boxes may stand for categories rather than physical containers. [ref]
https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-spring-2015/mit6_042js15_textbook.pdf#page=581. Lehman, Leighton and Meyer, Mathematics for Computer Science, section 14.8, rule 14.8.1
For thirteen objects and twelve boxes, a box containing at least two is unavoidable. Thinking of thirteen people and their birth months gives the same conclusion: at least two share a birth month. Twelve people could occupy the twelve months one apiece, so thirteen is the smallest number that forces a shared month. The generalized pigeonhole principle quantifies how many objects must share a box when there are still more objects.
The useful surprise is that the pigeonhole principle proves existence without needing to locate the objects involved. Choosing a good assignment rule is often the creative step: equal labels can mean equal remainders, nearby points, or repeated states of an algorithm. Once the rule is chosen, a short count can force a relationship among a much larger collection of objects. The pigeonhole principle itself does not name the crowded box. When the objects and their assignments are explicitly available, a simple algorithm finds one: scan the objects, keep the first object seen in each box, and stop when a later object enters an occupied box. At most scanned objects are needed when .
A geometric example. Any five points in a square of side one contain two whose Euclidean distance is at most . Give each point Cartesian coordinates . Divide both ranges into the intervals and , making four cells. Thus belongs to the left half and to the right half; belongs to the lower half and to the upper half. This convention assigns every boundary point to exactly one cell.
The pigeonhole principle puts two of the five points in the same cell. Their differences in Cartesian coordinates have magnitude at most , so the Pythagorean theorem gives their Euclidean distance the boundFor the plotted points , , , and , the first two occupy the lower-left cell and have Euclidean distance . These Cartesian coordinates exhibit the forced pair; the argument applies to every placement of five points.
The pigeonhole principle places two of five points in one of four cells of a square, bounding their Euclidean distance by
. Details. An arithmetic example. Assign eight integers to their seven residue classes modulo the integer modulus . The pigeonhole principle gives two with the same residue class, so is an integer divisor of their difference. In , for example, and satisfy the integer congruence , and . Likewise, assigning fractional parts to short intervals gives the Dirichlet approximation theorem; its existing article explains the approximation bound.
For any sequence of integers, some nonempty consecutive block has sum divisible by . Form the prefix sums . There are only residue classes modulo , so the pigeonhole principle gives for some . Subtraction proves that is the required block sum. Negative entries and repeated entries cause no difficulty. Applied after any ordering of a finite set, it also gives a nonempty subset whose sum is divisible by the size of the set.
Suppose a subset of a metric space is covered by sets, each of diameter at most . Assign each point to one covering set containing it, choosing a single set at shared boundaries. Among points, the pigeonhole principle puts two in a common set, and their distance is at most . The pieces need not be equal or congruent. This freedom permits better distance bounds than dividing a region only into equal rectangles.
For objects assigned to boxes, let be the number in box . The generalized pigeonhole principle statesThe ceiling function rounds up because box counts are integers. An equivalent threshold formulation says: for a positive integer , if , some box contains at least objects. For , putting objects in each box shows why the strict inequality matters. [ref]
https://ocw.mit.edu/courses/6-042j-mathematics-for-computer-science-spring-2015/mit6_042js15_textbook.pdf#page=583. Lehman, Leighton and Meyer, Mathematics for Computer Science, section 14.8.1, rule 14.8.2
Computed examples. For and , . Counts attain this bound. For and , , and the balanced counts sum to and have largest count exactly . The threshold version agrees: . In contrast, seven boxes each containing three hold only objects.
Two balanced arrangements attain the generalized pigeonhole principle bounds: thirteen objects in twelve boxes force two, and twenty-three in seven force four
. Details. The bound is sharp for every and . Use Euclidean division to write with integers and . Place objects in each of boxes and objects in each remaining box. The largest count is if , and if , exactly . This balanced arrangement makes the guarantee best possible even though other arrangements can be much more crowded.
Proof outline. If every count were at most , the total would be at most . This contradicts . Taking proves the displayed bound for ; for every count is zero.
The infinite pigeonhole principle says that if an infinite set has a partition of a set into finitely many parts, at least one part is an infinite set. Equivalently, assigning infinitely many objects to a finite number of boxes forces some box to contain infinitely many objects. For example, separating the natural numbers into their two residue classes modulo forces at least one class to be an infinite set; here both are, as the lists and show.
Proof outline. A union of finitely many finite sets is a finite set. If all the parts were finite sets, their union could not be the original infinite set.
The assumption of finitely many parts is essential. With one box labelled by each natural number, assigning to box puts exactly one object in every box. Infinitely many objects and infinitely many boxes therefore need not produce even a shared box. The infinite pigeonhole principle is useful whenever finitely many labels organize an endless collection: one label must keep occurring infinitely often, providing an infinite set on which that label is constant.

