Download c3 - NUS Computing

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Click on the picture
Main Menu
(Click on the topics below)
Pigeonhole Principle
Example
Example
Example
Example
Example
Example
Generalized Pigeonhole Principle
Example
Proof of Pigeonhole Principle
Pigeonhole Principle
Sanjay Jain, Lecturer,
School of Computing
Pigeonhole Principle
If we place m balls in n boxes, m > n, then at least one
box gets  2 balls.
Another formulation:
Consider a function f from A to B, where
#(A) > #(B), and
A, B are finite.
Then f cannot be 1—1.
END OF SEGMENT
Example
In a group of 13 people, there are at least 2 who are
born in the same month.
S = set of people (13 elements)
M = months of the year (12 elements)
f: S —> M
f(x)= the month x was born.
Since #(S) > #(M), by pigeonhole principle, f cannot be
1—1.
That is, there exist x, y in S, x y, such that
f(x)=f(y)
In other words, x and y are born in the same month.
END OF SEGMENT
Example
Let A={1,2,3,…,8}
If we pick 5 integers from A, then there exist 2 integers among the
selected integers, which add up to 9.
Proof:
A1={1,8}; A2={2,7}; A3={3,6}; A4={4,5}
B: set of numbers picked.
C={1,2,3,4}
f: B --> C,
if xB, is a member of Ai then f(x)=i.
Since #(B) > #(C), by pigeonhole principle, f cannot be 1 —1.
Thus, there exist a, b, in B such that f(a) = f(b).
But then a+b = 9
END OF SEGMENT
Example
In a set of four numbers, two are same mod 3.
Proof:
A = Set of 4 numbers.
B={0,1,2}
f: A —> B
where f(x)=x mod 3.
Now #(A) > #(B). So f cannot be 1 —1.
Thus, there exists distinct x, y in A, such that f(x) = f(y).
In other words, x mod 3 = y mod 3.
END OF SEGMENT
Example
There are 600 students. Each of them takes 3
compulsory modules, and 1 of 2 electives.
In each module they can get a grade of A, B, C, or D.
Show that there are 2 students with identical grade
sheet.
Example
Proof:
A= set of students (600)
B= set of grade sheets.
How many grade sheets are there?
T1: select the elective.
T2: select the grade for module 1
T3: select the grade for module 2
T4: select the grade for module 3
T5: select the grade for module 4
T1 can be done in two ways. Each of T2 to T5 can be done
in four ways.
Using multiplication rule, the number of elements of B =
2*4*4*4*4 = 512
Example
A= set of students (600)
B= set of grade sheets. (512)
f: A —> B
where f(x)=grade sheet of x.
Since #(A) > #(B), f cannot be 1 — 1
Thus, there exist distinct x, y in A such that f(x) = f(y)
In other words, x and y have the same grade sheets.
END OF SEGMENT
Example
Suppose there are 19 people in a party.
Suppose friendship relation is mutual.
Show that there are 2 persons in the party with same
number of friends
Example
A= set of people in the party. B={0,1,2…,18}
f: A —> B
where f(x) = number of friends of x
#(A) = 19, #(B) = 19.
We cannot apply pigeonhole principle yet.
Note that, either
for all x, f(x)0, or
for all x, f(x)18
Why? Suppose for all x, f(x) 0 is false.
Then there is an a such that f(a)=0.
Thus a has no friends.
Then, a is not a friend of anyone.
Thus, for all x, f(x)18
Example
A= set of people in the party. B={0,1,2…,18}
f: A —> B
where f(x) = number of friends of x
#(A) = 19, #(B) = 19.
We cannot apply pigeonhole principle yet.
Note that, either
for all x, f(x)0, or
for all x, f(x)18
Let B’=B - {w},
where w = 0 or 18, based on which of above cases holds.
Note that #(B’)=18.
Thus f: A—> B’ cannot be 1—1.
Therefore, there exist distinct x and y in A, such that f(x)=f(y).
In other words, there are two people in A, with the same
number of friends.
END OF SEGMENT
Example
Let X={1,2,….,2n}
Let S be a subset of X containing n+1 elements.
Then, there exist distinct x and y in S, such that x divides y.
Example
Suppose the elements of S are s1, s2, …,sn+1
Let si=2riwi, where wi is odd.
Let B= set of odd numbers  2n.
Note that #(B)=n
Let f:S—> B
where f(si)=wi
Thus, f cannot be1— 1 (by PH principle)
Thus, there exist distinct i and j, such that
f(si)= f(sj)
In other words, wi= wj.
si=2riwi, sj=2rjwj
Now if, ri>rj then, sj divides si
otherwise, si divides sj.
END OF SEGMENT
Floors and Ceilings
w denotes the largest integer w.
For example: 6.9 = 6; -9.2 = -10;
w denotes the smallest integer  w.
For example: 6.9 =7;
-9.2 = -9;
9 = 9
9 = 9
END OF SEGMENT
Generalized Pigeonhole Principle
If I place m balls in n boxes, then at least one box will get
 m/n balls.
If I place m balls in n boxes, then at least one box will get
 m/n balls.
For any function f from a finite set X to a finite set Y, if
#(X) > k* #(Y), then
there exists a y in Y such that y is the image of at least k+1
distinct elements of X.
END OF SEGMENT
Example
Suppose I place 26 letters of English alphabet in a circle.
Then there exists a consecutive sequence of 5
consonants.
B1
B5
B4
B2
B3
21 consonants ---> balls.
B1,…, B5 boxes.
At least one box will get  21/5 =5 balls.
Thus there are 5 consecutive consonants.
END OF SEGMENT
Proof of Pigeonhole Principle
Recall the pigeonhole principle:
For any function f from a finite set X to a finite set Y, if #(X) >
#(Y), then f is not 1—1.
Proof: Suppose f is 1—1.
Let Y={y1, y2,…, ym}
f -1(y)={x  X | f(x)=y}
f -1(y1), f -1(y2), …,f -1(ym) are pairwise disjoint, whose union is
X.
Therefore by Addition Rule,
#(X) = #(f -1(y1)) + #(f -1(y2)) + … + #(f -1(ym) )
 1+ 1+……+1
=m
#(X)  #(Y)
a contradiction. Thus f is not 1—1.
END OF SEGMENT
Related documents