Presentation on theme: "Turn in HW7 (put your name on it) Return HW6 –Avg: 77Adj Avg: 82.5Median: 85 –Emmanuel graded Section 3.1 (green) –Pascal graded Section 3.2 (red) –http://www.cs.virginia.edu/~cmt5n/cs202/hw6http://www.cs.virginia.edu/~cmt5n/cs202/hw6."— Presentation transcript:
Turn in HW7 (put your name on it) Return HW6 –Avg: 77Adj Avg: 82.5Median: 85 –Emmanuel graded Section 3.1 (green) –Pascal graded Section 3.2 (red) –http://www.cs.virginia.edu/~cmt5n/cs202/hw6http://www.cs.virginia.edu/~cmt5n/cs202/hw6 –#24: 8pts, #29: 6pts, #30: 6pts (grouped to 20) Test 2 is Wednesday, April 2 HW8 is posted (due Wednesday, April 9) –Covers 4.1, 4.2, and 4.3
Section 4.2: The Pigeonhole Principle The pigeonhole principle is a formalization of the rather obvious assertion that if you put n objects into m categories and n > m, then at least one of your categories will have more than one object in it. We have already applied the pigeonhole principle informally when we talked about one-to-one functions between two finite sets. Namely, a function from a set with n elements to a set with m elements could only be one-to-one if m n. Because if m > n then at least one of the n categories must have more than one of the m objects assigned to it.
The Pigeonhole Principle: If k + 1 or more objects are distributed into k boxes, then there is at least one box containing more than one object. Ex: Among any group of 367 people, there must be at least two who were born on the same day of the year since there are only 366 possible different birthdays. Ex: If an exam is scored from 0 to 100 (with no fractional points awarded) then how many students must be in the class to ensure that at least two students get the same score? We can think of the students as being each put into one of the 101 categories. So we need at least 102 students to ensure that at least two students get the same score. We can generalize the pigeonhole principle to know when we are guaranteed to have at least one box with more than 2, 3, 4, … objects in them.
The Generalized Pigeonhole Principle: If N objects are distributed into k boxes, then there is at least one box containing at least N/k objects. Ex: Let N = k + 1. Then the GPP tells us that if k + 1 objects are distributed into k boxes, then there is at least one box containing at least (k + 1)/k = 2 objects. This is the original pigeonhole principle. Ex: Among 100 people there are at least 100/7 = 15 who were born on the same day of the week. Ex: How many people must be present at a meeting to guarantee that at least 2 of them were born on Monday? No matter how many people are present, we can never guarantee this. All of the people present could be born on Tuesday for example. All the GPP guarantees is that at least one of the categories has at least a certain number of objects.
Ex: How many cards must be selected from a standard deck of 52 cards to ensure that we get at least 3 cards of the same suit? Since there are 4 suits, if we only select 8 cards then it is possible that we get 2 cards of each suit. So 8 is not enough to guarantee at least 3 cards of the same suit. However, if we select 9 cards then the GPP tells us that we will get at least 9/4 = 3 cards of the same suit. So 9 is the least we can select to guarantee at least 3 cards of the same suit. Ex: How many cards must be selected from a standard deck of 52 cards to ensure that we get at least 3 hearts? This seems like the same type of question as the one about Monday, but the difference here is that we have a finite universe to chose from. So we could be incredibly unlucky and first draw all 13 diamonds, all 13 spades, all 13 clubs, and only 2 hearts if we only take 13*3 + 2 = 41 cards. But if we take 42 cards then we must get at least 3 hearts.
Ex: Assume that in a group of 6 people, each pair of individuals are either friends or enemies. Show that there are either 3 mutual friends or 3 mutual enemies in the group. Proof: Let A be one of the 6 people. Of the other 5 people in the group, A must have at least 3 friends or at least 3 enemies (by the GPP). Case1: A has at least 3 friends. Call them B, C, and D. Then if any of these friends are friends with one another (e.g. B is friends with C) then we have a group of 3 mutual friends and we are done (e.g. A, B, C would be a group of 3 mutual friends). But if no pair of B, C, D are friends with one another, then B, C, D, forms a group of 3 mutual enemies and we are done. Case 2 is similar to case 1. So the result is established. Note that if we only had 5 people in the group, we couldnt conclude that there are at least 3 mutual friends or enemies.