1 the pigeonhole principle cs/apma 202 rosen section 4.2 aaron bloomfield
TRANSCRIPT
11
The Pigeonhole The Pigeonhole PrinciplePrinciple
CS/APMA 202CS/APMA 202
Rosen section 4.2Rosen section 4.2
Aaron BloomfieldAaron Bloomfield
22
The pigeonhole principleThe pigeonhole principle
Suppose a flock of pigeons fly into a set of Suppose a flock of pigeons fly into a set of pigeonholes to roostpigeonholes to roost
If there are more pigeons than pigeonholes, then If there are more pigeons than pigeonholes, then there must be at least 1 pigeonhole that has there must be at least 1 pigeonhole that has more than one pigeon in itmore than one pigeon in it
If If kk+1 or more objects are placed into +1 or more objects are placed into kk boxes, boxes, then there is at least one box containing two or then there is at least one box containing two or more of the objectsmore of the objects This is Theorem 1This is Theorem 1
33
Pigeonhole principle examplesPigeonhole principle examples
In a group of 367 people, there must be In a group of 367 people, there must be two people with the same birthdaytwo people with the same birthday As there are 366 possible birthdaysAs there are 366 possible birthdays
In a group of 27 English words, at least In a group of 27 English words, at least two words must start with the same lettertwo words must start with the same letter As there are only 26 lettersAs there are only 26 letters
44
Generalized pigeonhole principleGeneralized pigeonhole principle
If If NN objects are placed into objects are placed into kk boxes, then boxes, then there is at least one box containing there is at least one box containing NN//kk objectsobjects This is Theorem 2This is Theorem 2
55
Generalized pigeonhole principle Generalized pigeonhole principle examplesexamples
Among 100 people, there are at least Among 100 people, there are at least 100/12100/12 = 9 born on the same month = 9 born on the same month
How many students in a class must there How many students in a class must there be to ensure that 6 students get the same be to ensure that 6 students get the same grade (one of A, B, C, D, or F)?grade (one of A, B, C, D, or F)? The “boxes” are the grades. Thus, The “boxes” are the grades. Thus, kk = 5 = 5 Thus, we set Thus, we set NN/5/5 = 6 = 6 Lowest possible value for Lowest possible value for NN is 26 is 26
66
Rosen, section 4.2, question 4Rosen, section 4.2, question 4
A bowl contains 10 red and 10 yellow ballsA bowl contains 10 red and 10 yellow ballsa)a) How many balls must be selected to ensure 3 balls of How many balls must be selected to ensure 3 balls of
the same color?the same color? One solution: consider the “worst” caseOne solution: consider the “worst” case
Consider 2 balls of each colorConsider 2 balls of each colorYou can’t take another ball without hitting 3You can’t take another ball without hitting 3Thus, the answer is 5Thus, the answer is 5
Via generalized pigeonhole principleVia generalized pigeonhole principleHow many balls are required if there are 2 colors, and one color How many balls are required if there are 2 colors, and one color must have 3 balls?must have 3 balls?How many pigeons are required if there are 2 pigeon holes, and How many pigeons are required if there are 2 pigeon holes, and one must have 3 pigeons?one must have 3 pigeons?number of boxes: number of boxes: kk = 2 = 2We want We want NN//kk = 3 = 3What is the minimum What is the minimum NN??NN = 5 = 5
77
Rosen, section 4.2, question 4Rosen, section 4.2, question 4
A bowl contains 10 red and 10 yellow A bowl contains 10 red and 10 yellow ballsballs
b)b) How many balls must be selected to How many balls must be selected to ensure 3 yellow balls?ensure 3 yellow balls?
Consider the “worst” caseConsider the “worst” caseConsider 10 red balls and 2 yellow ballsConsider 10 red balls and 2 yellow balls
You can’t take another ball without hitting 3 You can’t take another ball without hitting 3 yellow ballsyellow balls
Thus, the answer is 13Thus, the answer is 13
88
Rosen, section 4.2, question 32Rosen, section 4.2, question 32
6 computers on a network are connected to at least 1 6 computers on a network are connected to at least 1 other computerother computerShow there are at least two computers that are have Show there are at least two computers that are have the same number of connectionsthe same number of connections
The number of boxes, The number of boxes, kk, is the number of computer , is the number of computer connectionsconnections
This can be 1, 2, 3, 4, or 5This can be 1, 2, 3, 4, or 5
The number of pigeons, The number of pigeons, NN, is the number of computers , is the number of computers That’s 6That’s 6
By the generalized pigeonhole principle, at least one By the generalized pigeonhole principle, at least one box must have box must have NN//kk objects objects
6/56/5 = 2 = 2 In other words, at least two computers must have the same In other words, at least two computers must have the same
number of connectionsnumber of connections
99
Rosen, section 4.2, question 10Rosen, section 4.2, question 10
Consider 5 distinct points (Consider 5 distinct points (xxii, , yyii) with integer values, where ) with integer values, where ii = 1, = 1, 2, 3, 4, 52, 3, 4, 5Show that the midpoint of at least one pair of these five points Show that the midpoint of at least one pair of these five points also has integer coordinatesalso has integer coordinates
Thus, we are looking for the midpoint of a segment from (Thus, we are looking for the midpoint of a segment from (aa,,bb) to ) to ((cc,,dd))
The midpoint is ( (The midpoint is ( (aa++cc)/2, ()/2, (bb++dd)/2 ))/2 )Note that the midpoint will be integers if Note that the midpoint will be integers if aa and and cc have the same have the same parity: are either both even or both oddparity: are either both even or both odd
Same for Same for bb and and ddThere are four parity possibilitiesThere are four parity possibilities
(even, even), (even, odd), (odd, even), (odd, odd)(even, even), (even, odd), (odd, even), (odd, odd)Since we have 5 points, by the pigeonhole principle, there must Since we have 5 points, by the pigeonhole principle, there must be two points that have the same parity possibilitybe two points that have the same parity possibility
Thus, the midpoint of those two points will have integer coordinatesThus, the midpoint of those two points will have integer coordinates
1010
More elegant applicationsMore elegant applications
Not going over…Not going over…
11
Quick surveyQuick survey
I felt I understood the material in this I felt I understood the material in this slide set…slide set…
a)a) Very wellVery well
b)b) With some review, I’ll be goodWith some review, I’ll be good
c)c) Not reallyNot really
d)d) Not at allNot at all
12
Quick surveyQuick survey
The pace of the lecture for this The pace of the lecture for this slide set was…slide set was…
a)a) FastFast
b)b) About rightAbout right
c)c) A little slowA little slow
d)d) Too slowToo slow
13
Quick surveyQuick survey
How interesting was the material in How interesting was the material in this slide set? Be honest!this slide set? Be honest!
a)a) Wow! That was SOOOOOO cool!Wow! That was SOOOOOO cool!
b)b) Somewhat interestingSomewhat interesting
c)c) Rather bortingRather borting
d)d) ZzzzzzzzzzzZzzzzzzzzzz
1414
Today’s demotivatorsToday’s demotivators