Pigeonhole Principle
Consider a flock of pigeons nestled in a set of pigeonholes. If there are pigeons, then it is possible for all of the pigeons to rest happily in separate pigeonholes. However, if at least one more pigeon arrives, making a total of more than pigeons, then at least one of the pigeonholes, inevitably, will end up with more than one pigeon.
The idea that having more pigeons than pigeonholes requires a pigeonhole with more than one pigeon is seemingly trivial, but it turns out to be important enough that it has a name:
Pigeonhole Principle (naive form):
If more than objects are placed into boxes, then at least one box must contain more than one object.
At first glance, the pigeonhole principle (also known as Dirichlet's principle in honor of the eponymous German mathematician) might appear to be too obvious to be useful; indeed, the power of the principle comes from cleverly choosing the "boxes" and "objects." Even though the principle itself is quite simple, it is not always clear if it is useful and, if so, how. For instance, consider the following example:
A box contains three pairs of socks colored red, blue, and white, respectively. Suppose I take out the socks without looking at them. How many socks must I take out to be sure that they will include a matching pair?
If I take only or socks, it is possible that they are all different. For example, they may be one red and one blue; or one red, one blue, and one white. But if I take out socks, these must include a matching pair. Here the chosen socks are the "objects" and the colors are the "boxes"; by PP1, it follows that at least two of the four chosen must have the same color and hence must be a matching pair. Thus the minimum number of socks to be taken out is .
How many students do you need in a school to guarantee that there are at least 2 students who have the same first two initials?
There are different possible sets of two initials that can be obtained using the 26 letters A, B, C, ..., Z, so the number of students should be greater than 676. Thus, the minimum number of students is .
Contents
Naive Pigeonhole Principle
In many situations, the "naive" form of the pigeonhole principle can be applied directly. In most problems, the "objects" and "boxes" are fairly obvious.
A box contains three pairs of socks colored red, blue, and green, respectively. If the socks are chosen without looking, how many socks must be drawn to guarantee at least one matching pair?
It is possible for any selection of three or fewer socks to consist of only distinct socks. Given a selection of three socks, it is less likely though to have one red, one blue, and one green sock. However, if four socks are chosen, the pigeonhole principle ensures that two socks must be the same. Each of the sock colors is a "box," with each sock drawn being an "object" to be sorted into the box. With three boxes, more than three items must be drawn to have two matching items.
Note that, strictly speaking, one must always verify if (or fewer) objects do not fit in boxes. The pigeonhole principle guarantees that there will be a collision if more than objects are placed in boxes; however, it does not specify if or fewer objects can fit in boxes, which may certainly not be true depending on the restrictions given in the problem (imagine that some pigeons do not like each other or, perhaps, that some of the pigeonholes contain blockages).
A school has students. What is the smallest such that at least two of the students have matching first and last initials?
There are distinct combinations of first and last initials. With students, it is certainly possible to assign each student a distinct set of first and last initials. However, by the pigeonhole principle, having students guarantees that at least two students must have matching initials.
Calvin has 13 pairs of shoes thrown around in his closet. The light has gone out, and he is unable to determine which shoe is which. What is the minimum number of shoes he must pick in order to guarantee that he has a matching pair among them?
Details and Assumptions:
- Each shoe that he removes is either a left or right shoe of one of the 13 pairs.
Show that given a set of positive integers, there exists a non-empty subset whose sum is divisible by .
Let the integers be denoted by . Form the sums
If one of these sums is divisible by , then we are done. Otherwise, by the pigeonhole principle, at least two of the sums must have the same remainder when divided by since only distinct remainders are possible Pick two such sums and , with . Then it follows that
must be divisible by .
Note: If and have the same remainder when divided by then is divisible by
A group of statistics professors hold a meet-and-greet over dinner. No new guests enter the dinner after it has begun, and no one leaves until the dinner has ended. Show that at least two professors shook the same number of distinct individuals' hands. (Hint: A professor cannot shake his or her own hand.)
If there are professors, then each individual could have shaken hands with at most other individuals. Furthermore, if there exists an individual who shook hands with other individuals, then there does not exist an individual who shook hands for no other individuals and vice versa. In other words, each of the professors can be thought of as an object to be sorted into one of boxes by the number of distinct individuals' hands shaken. By the pigeonhole principle, there exists at least one integer between and or and that equals the number of distinct individuals' hands shaken by at least two professors.
Suppose you randomly select of the first 2016 positive integers. What is the smallest that guarantees that at least one pair of the selected integers will sum to 2017?
Missy and Mussy are very messy sisters. Their dresser drawer consists of 43 white socks, 2 black socks, 23 blue socks and 8 red socks. What is the minimum number of socks they must remove from the drawer, in order to be certain that they have removed four socks of the same color?
Pigeonhole Principle on Continuous Spaces
The pigeonhole principle can also be applied to problems that take place on a "continuous" space if a clever partition of the space is chosen.
Given a line segment of length that contains points, let be the length of the shortest segment between consecutive points. What is the maximum value of over all possible configurations of points?
First, consider a trivial configuration of the points. Let all points be evenly spaced with one point at each end of the segment. In this case, the points divide up the line into segments, each of length .
![]()
Clearly, we can do no worse than , but is it possible to do better?
At first glance, it appears that the answer is no. Shifting any non-endpoint increases the length of one of the interior segments but always at the expense of shortening a neighboring segment.
Using the pigeonhole principle, we can approach the problem as follows: Consider each of the evenly spaced segments as a "box" and each of the points as an item to be placed into the boxes. The pigeonhole principle implies that at least one box (or segment) must have two items (or points), which guarantees that no two consecutive points can be farther apart than .
Ten points are placed within a unit equilateral triangle. Show that there exists two points with distance at most apart.
Consider the partition of the triangle into nine congruent equilateral triangles as shown below:
![]()
Each of the nine smaller triangles represents a box, with each of the ten points an item to be placed into the boxes. By the pigeonhole principle, at least one of the nine triangles must contain at least two points. Since the maximum distance between any two points in one of these triangles is , no two such points can be separated by greater than distance .
Let the average of a set of positive numbers be . Use the pigeonhole principle to show that there exists at least one number less than or equal to .
Choosing a set of numbers that average to is equivalent to placing points on a line segment of length with two points fixed as the endpoints. Each of the segments formed between consecutive points represents one of the numbers in the set.
Furthermore, partition the entire segment into sub-segments of length . The pigeonhole principle thus implies that at least one segment contains at least two points or, namely, that there must be at least one segment of length or less. It immediately follows that at least one number is less than or equal to .
Generalized Pigeonhole Principle
A more general form of the pigeonhole principle is as follows:
Pigeonhole Principle (general form):
If more than objects are placed into boxes then at least one box must contain more than objects.
The case of corresponds to the naive pigeonhole principle stated earlier.
Finally, let us prove the (generalized) pigeonhole principle. The argument is fairly straightforward.
For the sake of contradiction, suppose there are no boxes that contain more than pigeons. In that case, each pigeonhole may contain at most pigeons, and all pigeonholes may contain a total of at most pigeons. But this contradicts the assumption that there were more than objects. It follows that at least one box must contain more than pigeons.
It should be noted that contradiction permits only the weakest claim possible regarding the contents of the boxes. If it is not the case that every box has at most objects, all one can be certain of is that at least one box has at least one more than objects.
What is the minimum number of cards that must be drawn from a standard deck to guarantee at least three cards all of the same suit?
Let the four suits correspond to our "boxes." The pigeonhole principle implies that if we draw more than cards from the suits, then at least one suit must have more than drawn cards.
Lastly, we should note that, with eight cards drawn, it is possible to have exactly two cards of each suit, so the minimum number is indeed
Pigeonhole Principle - Problem Solving
I have 7 pairs of red socks, 6 pairs of blue socks, and 5 pairs of green socks in my drawer. If I randomly pick out 4 socks, what is the probability that I will get (at least) a matching pair?
Details and Assumptions:
- Besides the color, there is no difference between a left sock and a right sock.
If we pick 77 numbers randomly from the set , we are guaranteed to have at least pairs of numbers where the difference between each pair is 19. What is the maximum possible value of
Please treat a pair as a combination, not a permutation.
Given any 10-element subset of , does there exist 2 non-empty disjoint subsets of that have the same sum?
A lattice point is defined as a point in the two-dimensional plane with integral coordinates. We define the centroid of four points as point
What is the largest number of distinct lattice points in the plane such that the centroid of any four of them is not a lattice point?
Pigeonhole Principle (PP1)
If more than objects are distributed into boxes, then at least one box must have at least two objects.
This follows by noting that, if each of the boxes contained at most object, only then the boxes will receive at most objects contrary to the assumption that more than objects were put into the boxes.
This principle was first stated formally by Dirichlet and is therefore also called Dirichlet's box principle or Dirichlet's drawer principle. Let us apply it to some worked-out examples:
A box contains three pairs of socks colored red, blue, and white, respectively. Suppose I take out the socks without looking at them. How many socks must I take out to be sure that they will include a matching pair?
If I take out only or socks, it is possible that they are all different. For example, they may be one red and one blue; or one red, one blue, and one white. But if I take out socks, these must include a matching pair. Here the chosen socks are the "objects" and the colors are the "boxes"; by PP1, it follows that at least two of the four chosen must have the same color and hence must be a matching pair. Thus the minimum number of socks to be taken out is
How many students do you need in a school to guarantee that there are at least 2 students who have the same first two initials?
There are different possible sets of two initials that can be obtained using the 26 letters A, B, C, ..., Z. So by PP1, the number of students should be grater than 676, and thus the minimum number of students is
Second Form of Pigeonhole Principle (PP2)
For any positive integers and if or more objects are placed in boxes, then at least one box will contain more than objects.
If each of the boxes contained at most objects, then boxes will contain at most objects. This contradicts the fact that or more objects are placed in the boxes. Hence at least one box must contain more than objects.
Third Form of Pigeonhole Principle (PP3)
If the average of numbers is , then at least one of the numbers is greater than or equal to . Further, at least one of the numbers is less than or equal to .
Let be the numbers. Then by data
Proof by contradiction. Suppose none of the numbers is greather than or equal to , then the sum of these numbers will be strictly less than , contradicting
A similar argument shows that at least one of the numbers is less than or equal to .
If the numbers are integers, then PP3 says that at least one of them is , and at least one is , where and are the ceiling and floor functions, repectively.
Fourth Form of Pigeonhole Principle (PP4)
Let be positive integers. If objects are put into boxes, either the first box contains at least objects, or the second box contains at least objects, ..., or the the box contains at least objects.
Suppose we distribute objects in boxes. If for each the box contains less than objects, then the total number of objects in the boxes is
But this number is less than the number of objects placed in the boxes. For at least one , the box must contain at least objects.