You are on page 1of 13

Pigeonhole Principle

Presented By:
Muhammad Bilal
Roll # 415
BS(IT) 2nd
History

 The first statement of the principle is


believed to have been made by Dirichlet in
1834 under the name "drawer principle" or
"shelf principle“.
 In Italian too, the original name "principio
dei cassetti" is still in use; in some other
languages (for example, Russian) this
principle is called the Dirichlet principle.
Where it is used?
 The pigeonhole principle often arises in computer
science. For example, collisions are inevitable in a
hash table (Hashing is used to convert an
identifier or key, meaningful to a user, into a
value for the location of the corresponding data in
a structure) because the number of possible keys
exceeds the number of indices in the array. No
hashing algorithm, no matter how clever, can avoid
these collisions. This principle also proves that any
lossless compression algorithm that makes at least
one input file smaller will make some other input file
larger. (Otherwise, two files would be compressed
to the same smaller file and restoring them would
be ambiguous.)
Basics of the Principle
 The basic pigeonhole principle says that if you have
n things and k categories (say, n pigeons and k
holes), and if n > k, there must be at least one
category that contains at least two things.
 Sometimes the pigeonhole principle is called the
Dirichlet box principle.
Examples
 There are 101 possible numeric grades (0%-100%)
rounded to the nearest integer. There are >101
students in this class. Therefore, there must be at
least one (rounded) grade that will be shared by at
least 2 students at the end of the semester.
 In a group of 367 people, there must be two people
with the same birthday.
 As there are 366 possible birthdays.

 In a group of 27 English words, at least two words


must start with the same letter.
 As there are only 26 letters.
Examples (Cont…)
 An example of the pigeonhole principle is to imagine
five people who want to play softball (n = 5 items),
with a limitation of only four softball teams (m = 4
holes) to choose from. A further limitation is
imposed in the form of each of the five refusing to
play on a team with any of the other four players. It
is impossible to divide five people among four teams
without putting two of the people on the same team,
and since they refuse to play on the same team, by
asserting the pigeonhole principle it is easily
deducible that at most four of the five possible
players will be able to play.
Pigeonhole Principle & Divisibility

Consider the following random list of 12 numbers say, 2, 4, 6,


8, 11, 15, 23, 34, 55, 67, 78 and 83. Is it possible to choose
two of them such that their difference is divisible by 11? Can we
provide an answer to the problem by applying the Pigeonhole
Principle?
There are 11 possible remainders when a number is divided by
11.But we have 12 numbers. If we take the remainders for
“pigeonholes” and the numbers for “pigeons”, then by the Pigeon-
Hole Principle, there are at least two pigeons sharing the same hole,
i.e two numbers with the same remainder. The difference of these
two numbers is thus divisible by 11!
In fact, in our example, there are several answers as the two
numbers whose difference is divisible by 11 could be 4 & 15; 34
& 67 or 6 & 83.
Generalizations of the pigeonhole
principle (G.P.P)

 A generalized version of this principle states


that, if n discrete objects are to be allocated to
m containers, then at least one container must
hold no fewer than objects denoting the smallest
integer larger than or equal to x.
 If N objects are placed into k boxes, then there is
at least one box containing  N/k objects.
Examples (G.P.P)
 Given: There are 280 students in the class.
Without knowing anybody’s birthday, what is the
largest value of n for which we can prove that at
least n students must have been born in the same
month?

Answer:
280/12 =  23.3 = 24
Sample Questions
 6 computers on a network are connected to at least
1 other computer. Show there are at least two
computers that are have the same number of
connections.
Solution:
 The number of boxes, k, is the number of computer

connections.
 This can be 1, 2, 3, 4, or 5

 The number of pigeons, N, is the number of

computers, that’s 6.
Sample Questions (Cont…)
 By the generalized pigeonhole principle, at least one box must
have  N/k objects
  6/5 = 2
 In other words, at least two computers must have
the same number of connections
 Seven darts are thrown onto a circular
dartboard of radius 10 units. Can we show that
there will always be two darts which are at
most 10 units apart?

Proof:
Question (Cont…)

To prove that the final statement is


always true, we first divide the circle into six equal
sectors as shown;
Allowing each sector to be a pigeonhole and each
dart to be a pigeon, we have seven pigeons to go into six
pigeonholes. By pigeonhole principle, there is at least one
sector containing a minimum of two darts. Since the
greatest distance between two points lying in a sector is
10 units, the statement is proven to be true in any case.
Thanks for Your
Attention!

You might also like