PHP
PHP
1
The pigeonhole principle
Pigeonhole Principle: If n pigeonholes are occupied by n
+ 1 or more pigeons, then at least one pigeonhole is
occupied by more than one pigeon.
Proof by contradiction:
Suppose none of the k boxes contains more than one object.
So, the total number of objects would be at most k.
This is a contradiction, because there are at least k+1 objects.
2
The Pigeonhole Principle
4
Example
Show that in any group of 27 English words, there must
be at least two that begin with the same letter.
Proof:
To use pigeonhole principle, first find boxes and objects.
Suppose that for each letter, we have a box that
contains a word that begins with that letter.
The number of boxes is 26 and the number of objects is
27.
By the pigeonhole principle, at least one of these boxes
contains two or more words.
So, there must be at least two words that begin with the
same letter.
5
Example
How many students must be in a class to guarantee
that at least two students receive the same score
on the final exam, if the exam is graded on a scale
from 0 to 100 points.
Proof:
To use pigeonhole principle, first find boxes and objects.
Suppose that for each score, we have a box that
contains a student which got that score in the final
exam.
The number of boxes is 101, so by the pigeonhole
principle, the number of students must be 102 or more.
6
The socks pair matching problem
The Pigeonhole Principle
Problem: In a box there are 10 black socks and 12 blue socks and you need to get one
pair of socks of the same colour. Supposing you can take socks out of the box without
looking, what is the minimum number of socks you'd have to pull out in order to
guarantee a pair of the same color?
18
The generalized pigeonhole
principle
Assume 25 pigeons fly into 12 pigeonholes to roost.
A least one of 12 pigeonholes must have at least
three pigeons in it.
7
The generalized pigeonhole
principle
The generalized pigeonhole principle:
Assume N objects are placed into k boxes.
So, there is at least one box containing at least ⎡N/k]
objects.
Proof by contradiction:
Assume none of the boxes contains more than ⎡N/k] - 1
objects.
So, the total number of objects is at most
k(⎡N/k]-1) < k ((N/k+1)-1) = N.
This is a contradiction because there are a total of N objects.
8
If 10 objects are placed into 3 boxes, then there is at
least one box containing 4 objects
Do you agree?
10/3 = 4
In general N/k
Example
Show among 100 people there are at least 9 who were born in
the same month.
Solution:
To use pigeonhole principle, first find boxes and objects.
Suppose that for each month, we have a box that
contains persons who was born in that month.
The number of boxes is 12 and the number of objects is
100.
By the generalized pigeonhole principle, at least one of
these boxes contains at least ⎡100/12] = 9 persons.
So, there must be at least 9 persons who were born in
the same month.
9
Example
What is the minimum number of students required in a
discrete mathematics class to be sure that at least six
will receive the same grade, if there are five possible
grades, A, B, C, D and F.
Solution:
To use pigeonhole principle, first find boxes and objects.
Suppose that for each grade, we have a box that
contains students who got that grade.
The number of boxes is 5, by the generalized
pigeonhole principle, to have at least 6 (= ⎡N/5])
students at the same box, the total number of the
students must be at least N = 5 . 5 + 1 = 26.
10
Example
Assume there is a standard deck of 52 cards.
a) How many cards must be selected to guarantee that at least
three cards of the same suit are chosen?
b) How many cards must be selected to guarantee that at least
three hearts are selected
Solution:
Part a:
Suppose that for each suite, we have a box that contains
cards of that suit.
The number of boxes is 4, by the generalized pigeonhole
principle, to have at least 3 (= ⎡N/4]) cards at the same box,
the total number of the cards must be at least N = 2 . 4 + 1 =
9.
11
Example
Assume there is a standard deck of 52 cards.
a) How many cards must be selected to guarantee that at
least three cards of the same suit are chosen?
b) How many cards must be selected to guarantee that at
least three hearts are selected
Solution:
Part b:
The worst case, we may selects all the clubs,
diamonds, and spades (39 cards) before any hearts.
So, to guarantee that at least three hearts are selected,
39+3=42 cards should be selected.
12
Another Problem
14
Recommended exercises
3,5,9,13,21,25,31
15