Chapter 5
The Pigeonhole Principle
Theorem 5.0.1 (The Pigeonhole Principle). If n objects are placed into
k (k < n) boxes, then some box contains at least d nk e objects.
Problem 5.0.1. Among 61 students in a classroom, show that there are at
least 6 students born in the same month.
Solution. Consider each month as a box and each student as an object. Then
there are n = 12 boxes and 61 objects. By pigeonhole principle, there are at
61
least d 12 e = 6 students were born in the same month.
Problem 5.0.2. How many students must be in a class to guarantee that
at least 2 students receive the same score on the final examination, if the
examination is graded on a scale from 0 to 100 points.
Solution. To use the pigeonhole principle, consider each score in the final
exam as a box and each student as an object. Thus, the number of boxes is
k = 101, so by the pigeonhole principle, the number of students must be at
least 102.
Problem 5.0.3. What is the minimum number of students required in a
discrete mathematics class to be sure that at least 6 will receive the same
grade, if there are five possible grades: A, B, C, D and F.
Solution. To use the pigeonhole principle, consider each grade as a box and
each student as an object. Thus the number of boxes is k = 5, by the
pigeonhole principle, to have at least 6 = d n5 e students at the same box, the
total number of the students must be at least n = 26.
Problem 5.0.4. A multiple choice test has 6 questions with 4 possible an-
swers each. Students taking the test also have the option to leave answers
11
12 CHAPTER 5. THE PIGEONHOLE PRINCIPLE
blank. How many students must take the test in order to guarantee that at
least two students have the exact same answers?
Solution. There are 6 questions and 5 ways to answer each question, making
for 56 = 15625 ways to respond to the test. Therefore, 15626 students need
to take the test in order to guarantee that two students will have the exact
same answers.
Problem 5.0.5. 51 numbers are chosen from the integers between 1 and 100
inclusively. Show that 2 of the chosen integers are consecutive.
Solution. Since the existence of consecutive integers is the main theme of
the problem, it is natural to form pigeonholes using consecutive integers. We
partition the 100 integers into 50 pairs of consecutive integers as pigeonholes:
{1, 2}, {3, 4}, {5, 6}, . . . , {99, 100}.
Let the 51 chosen integers be pigeons. By Pigeonhole Principle, when we
choose 51 integers, there is at least 1 pigeonhole (a pair of integers) contain-
51
ing d 50 e = 2 pigeons (chosen integers). Therefore, there are 2 consecutive
integers among the 51 chosen integers.
Problem 5.0.6. If 101 integers are chosen from the set {1, 2, . . . , 200}, then
show that one of the chosen integers divides at least one of the chosen integers.
Solution. Let the chosen integers be a1 , a2 , . . . , a101 . For each k = 1, 2, . . . , 101,
write
ak = 2mk bk ,
where bk is odd integer and mk is an non-negative integer. Then 101 members
b1 , b2 , . . . , bn are all odd integers and lie in the 100-element set {1, 3, . . . , 199},
and so some pairs of the numbers bk must be equal. Say bk = bl with mk ≤ ml .
Then ak divides al .
Problem 5.0.7. Suppose we have 27 distinct odd positive integers all less
than 100. Show that there is a pair of numbers whose sum is 102.
Solution. There are 50 positive odd numbers less than 100:
1, 3, 5, . . . , 99.
We can partition these into subsets as follows:
{1}, {3, 99}, {5, 97}, {7, 95}, {9, 93}, · · · , {49, 53}, {51}.
Note that the sets of size 2 have elements which add to 102. There are 26
subsets (boxes) and 27 odd numbers (objects). So at least two numbers (in
fact, exactly two numbers) must lie in the same subset, and therefore these
add to 102.
13
Practice Set on the Pigeonhole Principle
1. Among 100 people, show that at least 9 were born in the same month.
2. Show that in a group of 15 people, at least three people were born on
the same day of the week.
3. A man has a certain number of friends; he wants to invite three of them
for dinner every day of the year. How many friends must he have at
least if he does not want to invite the same three friends twice?
14 CHAPTER 5. THE PIGEONHOLE PRINCIPLE
Chapter 6
Inclusion-Exclusion Principle
6.1 Inclusion-Exclusion Principle for Two Sets
Let A and B be two sets. Then
|A ∪ B| = |A| + |B| − |A ∩ B|.
Problem 6.1.1. In a discrete mathematics class, every student is a ma-
jor in computer science or mathematics or both. The number of students
having computer science as a major (possibly along with mathematics) is
25; the number of students having mathematics as a major (possibly along
with computer science) is 13; and the number of students majoring in both
computer science and mathematics is 8. How many students are in the class?
Solution. Let
A := the set of students having computer science as a major
B := the set of students having mathematics as a major .
Then A ∩ B is the of students havingboth computer science and mathematics
as major. Therefore |A| = 25, |B| = 13, and |A ∩ B| = 8. Hence
|A ∪ B| = |A| + |B| − |A ∩ B|
= 25 + 13 − 8
= 30.
15
16 CHAPTER 6. INCLUSION-EXCLUSION PRINCIPLE
6.2 Inclusion-Exclusion Principle for Three
Sets
Let A, B and C be three sets. Then
|A ∪ B ∪ C| = |A| + |B| + |C| − |A ∩ B| − |A ∩ C| − |B ∩ C| + |A ∩ B ∩ C|.
Problem 6.2.1. A total of 1232 students have taken a course in Spanish,
879 have taken a course in French, and 114 have taken a course in Russian.
Further, 103 have taken courses in both Spanish and French, 23 have taken
courses in both Spanish and Russian, and 14 have taken courses in both
French and Russian. If 2092 students have taken a course in at least one of
Spanish French and Russian, how many students have taken a course in all
3 languages.
Solution. Let
A := the set of students have taken a course in Spanish
B := the set of students have taken a course in French
C := the set of students have taken a course in Russian .
Then
A∩B := Set of students have taken a course in both Spanish and French
A∩C := Set of students have taken a course in both Spanish and Russian
B∩C := Set of students have taken a course in both French and Russian
A∪B∪C := Set of students have taken a course in at least one of three languages.
Therefore |A| = 1292, |B| = 879, |C| = 114, |A ∩ B| = 103, |A ∩ C| =
23, |B ∩ C| = 14, and |A ∪ B ∪ C| = 2092. Hence
|A ∪ B ∪ C| = |A| + |B| + |C| − |A ∩ B| − |A ∩ C| − |B ∩ C| + |A ∩ B ∩ C|
2092 = 1292 + 879 + 114 − 103 − 23 − 14 + |A ∩ B ∩ C|.
Solving for |A ∩ B ∩ C| yields 7.
Practice Set on the Inclusion-Exclusion Prin-
ciple for Three Sets
1. Among 18 students in a room, 7 study mathematics, 10 study science,
and 10 study computer programming. Also, 3 study mathematics and
6.2. INCLUSION-EXCLUSION PRINCIPLE FOR THREE SETS 17
science, 4 study mathematics and computer programming, and 5 study
science and computer programming. We know that 1 student studies
all three subjects. How many of these students study none of the three
subjects?
2. In a survey of the chewing gum tastes of a group of baseball players, it
was found that:
• 22 liked juicy fruit;
• 25 liked spearmint;
• 39 like bubble gum;
• 9 like both spearmint and juicy fruit;
• 17 liked juicy fruit and bubble gum;
• 20 liked spearmint and bubble gum;
• 6 liked all three.
Given that four liked none of the above, how many baseball players
were surveyed?
3. How many integers between 1 and 2005 are NOT multiples of any of
the numbers 2, 3 or 5?