1 Lecture 3 (part 2) Functions – Pigeonhole Principle Reading: Epp Chp 7.4.

Slides:



Advertisements
Similar presentations
Functions Reading: Epp Chp 7.1, 7.2, 7.4
Advertisements

The Pigeon hole problem
Lecture 4 4.1,4.2 Counting. 4.1 Counting Two Important Principles: Product Rule and Sum Rule. Product Rule: Assume we need to perform procedure 1 AND.
The Pigeonhole Principle
The Pigeonhole Principle Alan Kaylor Cline. The Pigeonhole Principle Statement Children’s Version: “If k > n, you can’t stuff k pigeons in n holes without.
Chapter 5 Relations and Functions
COUNTING AND PROBABILITY
The Pigeonhole Principle
Functions, Pigeonhole Principle Lecture 14: Nov 4 A B f( ) =
The Pigeonhole Principle 6/11/ The Pigeonhole Principle In words: –If n pigeons are in fewer than n pigeonholes, some pigeonhole must contain at.
Discrete Structures Chapter 5 Pigeonhole Principle Nurul Amelina Nasharuddin Multimedia Department.
The Pigeonhole Principle
Copyright © Zeph Grunschlag, Counting Techniques Zeph Grunschlag.
Discrete Structures Chapter 5 Relations and Functions Nurul Amelina Nasharuddin Multimedia Department.
Discrete Mathematics Lecture 7 Alexander Bukharovich New York University.
CSE115/ENGR160 Discrete Mathematics 04/10/12
Functions f( ) = A B Lecture 15: Nov 4.
Pigeonhole.
Discrete Math for CS Chapter 5: Functions. Discrete Math for CS New Relation Operations: Given R, a relation on A x B, we define the inverse relation,
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
1 CSE 20 Lecture 13 Analysis: Counting with Pigeonhole Principle CK Cheng, May 17, 2011.
1 The Pigeonhole Principle CS/APMA 202 Rosen section 4.2 Aaron Bloomfield.
Chapter 7 Functions Dr. Curry Guinn. Outline of Today Section 7.1: Functions Defined on General Sets Section 7.2: One-to-One and Onto Section 7.3: The.
1 CMSC 250 Chapter 7, Functions. 2 CMSC 250 Function terminology l A relationship between elements of two sets such that no element of the first set is.
Functions A B f( ) =. This Lecture We will define a function formally, and then in the next lecture we will use this concept in counting. We will also.
Relations & Functions CISC1400, Fall 2011 Fordham Univ.
Discrete Mathematics CS 2610 March 26, 2009 Skip: structural induction generalized induction Skip section 4.5.
Fall 2015 COMP 2300 Discrete Structures for Computation
The Pigeonhole (Dirichlet’s box) Principle
1 Relations and Functions Chapter 5 1 to many 1 to 1 many to many.
1 Lecture 3 (part 3) Functions – Cardinality Reading: Epp Chp 7.6.
Week 7 - Friday.  What did we talk about last time?  Set disproofs  Russell’s paradox  Function basics.
Math 170 Project #11 Part 2 Jeffrey Martinez Bianca Orozco Omar Monroy.
September1999 CMSC 203 / 0201 Fall 2002 Week #8 – 14/16 October 2002 Prof. Marie desJardins.
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesFunctions.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Copyright  The McGraw-Hill Companies, Inc. Permission required for reproduction.
1 Annoucement n Skills you need: (1) (In Thinking) You think and move by Logic Definitions Mathematical properties (Basic algebra etc.) (2) (In Exploration)
Chap. 5 Relations and Functions. Cartesian Product For sets A, B the Cartesian product, or cross product, of A and B is denoted by A ╳ B and equals {(a,
Symmetry Problem What is the sum of the values 1 to 100? Hint: Look for the symmetry!
CS201: Data Structures and Discrete Mathematics I
Discrete Structures Li Tak Sing ( 李德成 ) Lectures
5.2 The Pigeonhole Principle
Unit II Discrete Structures Relations and Functions SE (Comp.Engg.)
Functions (Mappings). Definitions A function (or mapping)  from a set A to a set B is a rule that assigns to each element a of A exactly one element.
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 7 Functions Instructor: Hayk Melikyan Today we will review sections 7.3, 7.4 and 7.5.
1 Chapter 2 Pigeonhole Principle. 2 Summary Pigeonhole principle –simple form Pigeonhole principle –strong form Ramsey’s theorem.
FUNCTIONS COSC-1321 Discrete Structures 1. Function. Definition Let X and Y be sets. A function f from X to Y is a relation from X to Y with the property.
1 The Pigeonhole Principle CS 202 Epp section 7.3.
The Pigeonhole Principle Alan Kaylor Cline. The Pigeonhole Principle Statement Children’s Version: “If k > n, you can’t stuff k pigeons in n holes without.
Functions CSRU1400 Spring 2008Ellen Zhang 1 CISC1400, Fall 2010 Ellen Zhang.
1 The Pigeonhole Principle CS 202 Epp section ??? Aaron Bloomfield.
CS 104: Discrete Mathematics
The Pigeonhole Principle. Pigeonhole principle The pigeonhole principle : If k is a positive integer and k+1 or more objects are placed into k boxes,
Pigeonhole Principle. If n pigeons fly into m pigeonholes and n > m, then at least one hole must contain two or more pigeons A function from one finite.
Main Menu Main Menu (Click on the topics below) Pigeonhole Principle Example Generalized Pigeonhole Principle Example Proof of Pigeonhole Principle Click.
FUNCTIONS.
Discrete Mathematics Lecture # 17 Function. Relations and Functions  A function F from a set X to a set Y is a relation from X to Y that satisfies the.
ICS 253: Discrete Structures I Counting and Applications King Fahd University of Petroleum & Minerals Information & Computer Science Department.
COUNTING Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) 1.
The Pigeonhole Principle
Is There Something to CS Theory?
COUNTING AND PROBABILITY
The Pigeonhole Principle
CS 220: Discrete Structures and their Applications
The Pigeonhole Principle
Functions Rosen 2.3, 2.5 f( ) = A B Lecture 5: Oct 1, 2.
The Pigeon hole problem
Pigeon-Hole Principle ( PHP )
The Pigeonhole Principle
Presentation transcript:

1 Lecture 3 (part 2) Functions – Pigeonhole Principle Reading: Epp Chp 7.4

2 Outline 1.Pigeonhole principle (PHP) 2.Generalized PHP

3 1. Pigeonhole Principle Pigeonhole principle n If n pigeons fly into m pigeonholes and n > m, then at least one hole must contain two or more pigeons. …or if you want to be more technical… n A function from one finite set to a smaller finite set cannot be one-to-one: there must be at least two elements in the domain that have the same image in the co-domain.

4 1. Pigeonhole Principle f Finite set n elements m elements > Pigeonhole principle

5 1. Pigeonhole Principle n The PHP may seem innocuous (harmless) and common-sensical. You may even think that teaching you such a simple thing is an insult to your intelligence. n But such an attitude of pride toward the PHP is a sure step to failure. n Do not underestimate the difficulty of it. n “What’s so difficult?” you may ask. n The difficulty is NOT the PHP. n The difficulty is that YOU CAN’T SEE WHAT ARE THE PIGEONS AND WHAT ARE THE HOLES. It’s a problem with your observation powers…and hence the application of the principle.

6 The obvious ones…

7 1. Pigeonhole Principle: Example 1 n Prove that in any group of eight people, at least two have birthdays which fall on the same day of the week in any given year. Mon Tue Wed Thur Fri Sat Sun Y X p1 p2 p3 p4 p5 p6 p7 p8 f Let X be the set of people. |X| = 8. Let Y be the set of days in the week. |Y| = 7. Define f : X  Y, such that f maps the person to the day of week in which he was born. By PHP, at least two people will have birthdays which fall on the same day of the week.

8 1. Pigeonhole Principle: Example 2 n Given any set of four integers, there must be at least two that have the same remainder when divided by three. X a b c d Y f Let X be the set of any four integers selected. |X| = 4. Let Y be the set of possible remainders when divided by 3. |Y| = 3. Define f : X  Y, such that f(x) = y if x leaves a remainder of y when divided by 3. By PHP ( |X|>|Y| ), at least two integers will have the same remainder when divided by 3.

9 The not so obvious ones… (“I can’t see the pigeons or holes or both…”)

10 1. Pigeonhole Principle: Example 3 Let A = {1,2,3,4,5,6,7,8}. Prove that if 5 distinct integers are selected from A, at least one pair of integers have a sum of 9. n Try some examples: –select 1,3,4,6,7. Then we can find at least a pair: 3+6 = 9 –select 2,3,5,6,7. Then we can find at least a pair: 2+7 = 9 (Of course, we can also find another: 3+6 = 9 but it’s ok… the claim is that you can find at least one pair). n So can you see the pigeons? And the holes?

11 1. Pigeonhole Principle: Example 3 Let A = {1,2,3,4,5,6,7,8}. Prove that if 5 distinct integers are selected from A, at least one pair of integers have a sum of 9. Y {1,8} {2,7} {3,6} {4,5} f X a b c d e Let X be the set of any five distinct integers selected from 1 to 8. |X| = 5. Let Y = { {1,8}, {2,7}, {3,6}, {4,5} }. |Y| = 4. Define f : X  Y, such that f(x) = y if x  y. By PHP ( |X|>|Y| ), at least two elements (say a and b ) in X will map to one element {i,j} in Y. Meaning that a  {i,j} and b  {i,j}. Since a  b,  then either a=i and b=j or vice versa. In any case, a + b = 9.

12 1. Pigeonhole Principle: Example 4 n During a month with 30 days, a baseball team plays at least 1 game a day, but no more that 45 games in total for that month. Show that there must be a period of some number of consecutive days, during which the team must play exactly 14 games. n Try an example: –Day 1: 1Day 7: 1Day 13: 2Day 19: 2Day 25: 1 –Day 2: 2Day 8: 2Day 14:2Day 20: 1Day 26: 1 –Day 3: 1Day 9: 1Day 15:1Day 21: 1Day 27: 1 –Day 4: 2Day 10: 3Day 16: 2Day 22: 1Day 28: 1 –Day 5: 1Day 11: 3Day 17: 1Day 23: 1Day 29: 1 –Day 6: 2Day 12: 1Day 18: 2Day 24: 1Day 30: 1 n Total = 43 games Hmmm… 13 games (or 15 if extend to day 10)

13 1. Pigeonhole Principle: Example 4 n During a month with 30 days, a baseball team plays at least 1 game a day, but no more that 45 games in total for that month. Show that there must be a period of some number of consecutive days, during which the team must play exactly 14 games. n Try an example: –Day 1: 1Day 7: 1Day 13: 2Day 19: 2Day 25: 1 –Day 2: 2Day 8: 2Day 14:2Day 20: 1Day 26: 1 –Day 3: 1Day 9: 1Day 15:1Day 21: 1Day 27: 1 –Day 4: 2Day 10: 3Day 16: 2Day 22: 1Day 28: 1 –Day 5: 1Day 11: 3Day 17: 1Day 23: 1Day 29: 1 –Day 6: 2Day 12: 1Day 18: 2Day 24: 1Day 30: 1 n Total = 43 games Hmmm… 12 games (or 15 if extend to day 10)

14 1. Pigeonhole Principle: Example 4 n During a month with 30 days, a baseball team plays at least 1 game a day, but no more that 45 games in total for that month. Show that there must be a period of some number of consecutive days, during which the team must play exactly 14 games. n Try an example: –Day 1: 1Day 7: 1Day 13: 2Day 19: 2Day 25: 1 –Day 2: 2Day 8: 2Day 14:2Day 20: 1Day 26: 1 –Day 3: 1Day 9: 1Day 15:1Day 21: 1Day 27: 1 –Day 4: 2Day 10: 3Day 16: 2Day 22: 1Day 28: 1 –Day 5: 1Day 11: 3Day 17: 1Day 23: 1Day 29: 1 –Day 6: 2Day 12: 1Day 18: 2Day 24: 1Day 30: 1 n Total = 43 games Hmmm… 13 games (or 16 if extend to day 11)

15 1. Pigeonhole Principle: Example 4 n During a month with 30 days, a baseball team plays at least 1 game a day, but no more that 45 games in total for that month. Show that there must be a period of some number of consecutive days, during which the team must play exactly 14 games. n Try an example: –Day 1: 1Day 7: 1Day 13: 2Day 19: 2Day 25: 1 –Day 2: 2Day 8: 2Day 14:2Day 20: 1Day 26: 1 –Day 3: 1Day 9: 1Day 15:1Day 21: 1Day 27: 1 –Day 4: 2Day 10: 3Day 16: 2Day 22: 1Day 28: 1 –Day 5: 1Day 11: 3Day 17: 1Day 23: 1Day 29: 1 –Day 6: 2Day 12: 1Day 18: 2Day 24: 1Day 30: 1 n Total = 43 games Hmmm… 12 games (or 16 if extend to day 11)

16 1. Pigeonhole Principle: Example 4 n During a month with 30 days, a baseball team plays at least 1 game a day, but no more that 45 games in total for that month. Show that there must be a period of some number of consecutive days, during which the team must play exactly 14 games. n Try an example: –Day 1: 1Day 7: 1Day 13: 2Day 19: 2Day 25: 1 –Day 2: 2Day 8: 2Day 14:2Day 20: 1Day 26: 1 –Day 3: 1Day 9: 1Day 15:1Day 21: 1Day 27: 1 –Day 4: 2Day 10: 3Day 16: 2Day 22: 1Day 28: 1 –Day 5: 1Day 11: 3Day 17: 1Day 23: 1Day 29: 1 –Day 6: 2Day 12: 1Day 18: 2Day 24: 1Day 30: 1 n Total = 43 games Found it! Day 8 – Day 14: Exactly 14 games.

17 1. Pigeonhole Principle: Example 4 n During a month with 30 days, a baseball team plays at least 1 game a day, but no more that 45 games in total for that month. Show that there must be a period of some number of consecutive days, during which the team must play exactly 14 games. n Try ANOTHER example –Day 1: 1Day 7: 1Day 13: 3Day 19: 1Day 25: 1 –Day 2: 1Day 8: 1Day 14:2Day 20: 1Day 26: 1 –Day 3: 1Day 9: 1Day 15:3Day 21: 1Day 27: 1 –Day 4: 1Day 10: 1Day 16: 2Day 22: 1Day 28: 1 –Day 5: 1Day 11: 1Day 17: 3Day 23: 1Day 29: 1 –Day 6: 1Day 12: 2Day 18: 4Day 24: 1Day 30: 1 n Total = 42 games Day 3 – Day 13: Exactly 14 games. n So can you see the pigeons? And the holes? (Not obvious right?)

18 1. Pigeonhole Principle: Example 4 n During a month with 30 days, a baseball team plays at least 1 game a day, but no more that 45 games in total for that month. Show that there must be a period of some number of consecutive days, during which the team must play exactly 14 games. n We will have to ‘extract out’ the pigeons and the holes. Let the number of games played on the i -th day by a i. Let b i be the total number of games played from the first day to the i -th day. –Meaning that… b 1 = a 1 b 2 = a 1 + a 2 b 3 = a 1 + a 2 + a 3 … b 30 = a 1 + a 2 + … + a 30 So we know that (1) b 1 < b 2 < b 3 < …< b 30 ; (2) 1  b i  45

19 1. Pigeonhole Principle: Example 4 n During a month with 30 days, a baseball team plays at least 1 game a day, but no more that 45 games in total for that month. Show that there must be a period of some number of consecutive days, during which the team must play exactly 14 games. n We therefore form another increasing sequence: b b b … b And this will also have the property that –(1) b < b < b < … < b ; –(2) 15  b i +14  59 (Since 1  b i  45 )

20 1. Pigeonhole Principle: Example 4 n During a month with 30 days, a baseball team plays at least 1 game a day, but no more that 45 games in total for that month. Show that there must be a period of some number of consecutive days, during which the team must play exactly 14 games. Let X be the set { b 1, …, b 30, b 1 +14, …, b }. |X| = 60. Let Y be the set of {1,2,…,59}. |Y| = 59. Define f : X  Y, s.t. f(x) = y iff x = y X b1b1 b2b2 b3b3 b 30 b b b b f Y By PHP ( |X|>|Y| ), at least two elements in X will map to the the same element in Y. Q: Which two elements? Both of the elements cannot be of the form of b i and b j since the sequence of b i ’s are strictly increasing ( b i  b j ). Similarly, both of the elements cannot be of the form of b i +14 and b j +14.

21 1. Pigeonhole Principle: Example 4 n During a month with 30 days, a baseball team plays at least 1 game a day, but no more that 45 games in total for that month. Show that there must be a period of some number of consecutive days, during which the team must play exactly 14 games. Y X f b1b1 b2b2 b3b3 b 30 b b b b Therefore one of the elements is of the form b i and the other is of the form b j +14. So b i = b j +14 Which means that b i - b j = 14 So the 14 games are played from day j+1 to day i.

22 1. Pigeonhole Principle: Example 5 n Consider a 2D cartesian plane (N x N). You are given 5 distinct points on the plane. Prove that at least one of the line segments determined by these points has a midpoint which falls nicely in N x N. n Try some examples:

23 1. Pigeonhole Principle: Example 5 n Consider a 2D cartesian plane (N x N). You are given 5 distinct points on the plane. Prove that at least one of the line segments determined by these points has a midpoint which falls nicely in N x N. n Are you able to see the pigeons and the holes? n Not obvious right? n This is what makes the APPLICATION of the PHP difficult – note: the difficulty does not lie in understanding PHP… It’s the APPLICATION of the principle that’s difficult. n It requires keen observation skills, through examples.

24 1. Pigeonhole Principle: Example 5 n Consider a 2D cartesian plane (N x N). You are given 5 distinct points on the plane. Prove that at least one of the line segments determined by these points has a midpoint which falls nicely in N x N. n First, a question: How do you calculate the midpoint of a line from (a,b) to (c,d)? n Ans: ((a+c)/2, (b+d)/2) n Still… –What are the pigeons? –What are the holes?

25 1. Pigeonhole Principle: Example 5 n Consider a 2D cartesian plane (N x N). You are given 5 distinct points on the plane. Prove that at least one of the line segments determined by these points has a midpoint which falls nicely in N x N. Y holes are the ‘parity’ of the x,y number (odd,odd) (odd,even) (even,odd) (even,even) f X pigeons are the 5 points (x 1,y 1 ) (x 2,y 2 ) (x 3,y 3 ) (x 4,y 4 ) (x 5,y 5 )

26 1. Pigeonhole Principle: Example 5 n Consider a 2D cartesian plane (N x N). You are given 5 distinct points on the plane. Prove that at least one of the line segments determined by these points has a midpoint which falls nicely in N x N. Let X be the set of any 5 points on the plane. |X| = 5. Let Y be the set {(odd,odd), (odd,even), (even,odd), (even,even)}. |Y| = 4. Define f : X  Y, such that f(a,b) = (i,j) where i = ‘odd’ if a is odd and i = ‘even’ if a is even; j = ‘odd’ if b is odd and j = ‘even’ if b is even. By PHP ( |X|>|Y| ), at least two (of the five points) say (a,b) and (c,d), will map to the same element in Y. Either a and c are (1) both odd or (2) both even. In either case, (a+c) is even. And so (a+c)/2 is an integer. Either b and d are (1) both odd or (2) both even. In either case, (b+d) is even. And so (b+d)/2 is an integer. So ((a+c)/2, (b+d)/2) lie on the N x N plane.

27 2. Generalized Pigeonhole Principle GENERALIZED Pigeonhole principle n If n pigeons fly into m pigeonholes and n > km, (where k is some positive integer) then at least one hole must contain k+1 or more pigeons. …or if you want to be more technical… n For any function f from a finite set X to a finite set Y such that |X| > k.|Y|, then there is some y in Y such that y is the image of at least k+1 (or ceiling of |X| / |Y|) distinct elements of X. (Contrapositive form) For any function f from a finite set X to a finite set Y, if for each y in Y, f -1 (y) has at most k elements, then X has at most k.|Y| elements.

28 2. Generalized Pigeonhole Principle GENERALIZED Pigeonhole principle n If n pigeons fly into m pigeonholes and n > km, (where k is some positive integer) then at least one hole must contain k+1 or more pigeons. n Example: –If 32 pigeons fly into 10 pigeonholes, then at least one hole must contain 4 or more pigeons (4 = 32/10 and take the ceiling). –(contrapositive form) If each pigeonhole has at most 7 pigeons, then 10 pigeonholes have at most 70 pigeons.

29 The obvious ones…

30 2. Generalized Pigeonhole Principle n (Eg. 1) There are 44 chairs in a room and five tables. Prove that some table must have at least 9 chairs around it. Let X be the set of 44 chairs. |X| = 44. Let Y be the set of tables. |Y| = 5. Define f : X  Y, such that f(x) = (y) if chair x is placed at table y. f Y holes are the 5 tables X pigeons are the 44 chairs By Generalized PHP ( |X|> 8|Y| ), there is a y  Y (some table) such that y is the image of at least 9 distinct points in X … meaning that there is a table with at least 9 chairs around it.

31 2. Generalized Pigeonhole Principle n (Eg. 2) In a group of 85 people, at least 4 must have the same last initial. Let X be the set of people. |X| = 85. Let Y be the set of alphabets. |Y| = 26. Define f : X  Y, such that f(x) = (y) if the last initial of person x is y. f X pigeons are the 85 people By Generalized PHP ( |X|> 3|Y| ), there is a y  Y (some alphabet) such that y is the image of at least 4 distinct points in X … meaning that there is a group of at least 4 people who have the same last initial. Y holes are the 26 alphabets

32 The not so obvious ones… (“I can’t see the pigeons or holes or both…”)

33 2. Generalized Pigeonhole Principle n (Eg. 3) There are 42 students who are to share 12 computers. Each student uses exactly 1 computer, and no computer is used by more that 6 students. Show that at least 5 computers are used by 3 or more students. Let X be the set of 42 students. |X| = 42. Let Y be the set of 12 computers. |Y| = 12. Define f : X  Y, such that f(x) = y if x uses computer y. f We can divide the computers in Y into those which are used by 3 or more students ( k ), and those used by 2 or less ( 12-k ). k computers serve at most 6k students. 12-k computers serve at most 2(12-k) students. By Generalized PHP (Contrapositive form), 6k + 2(12-k)  |X|. (Now, |X|=42 ) So k  4.5 … And since k is an integer, k  5. X pigeons are the 42 students Y holes are the 12 computers k

34 2. Generalized Pigeonhole Principle n (Eg. 4) Assume that in a group of 6 people, each pair of individuals consists of two friends or two enemies. Show that there are either 3 mutual friends or 3 mutual enemies Let X be the set of the other 5 people. |X| = 5. Let Y be the set of {0,1}. |Y| = 2. Define f : X  Y, such that f(x) = 1 if x is a friend of A ; otherwise f(x) = 0. f By Generalized PHP ( |X|> 2|Y| ), there is a y  Y such that y is the image of at least 3 distinct points in X … meaning that A has either at least 3 friends or at least 3 enemies. (We’re not done yet… ) Let A be one of the 6 people. X pigeons are the other 5 people B C D E F Y 2 holes – friend or enemy with A A’s friend A’s enemy

35 2. Generalized Pigeonhole Principle n (Eg. 4) Assume that in a group of 6 people, each pair of individuals consists of two friends or two enemies. Show that there are either 3 mutual friends or 3 mutual enemies Ok, we know that A has either at least 3 friends or at least 3 enemies. But are these who are friends with A, also friends with each other? (keyword ‘mutual’)… still some more to prove… Case 1: ( A has at least 3 friends) –Without loss of generality, say these 3 friends are B, C, D. –Either there is or there is not a friendship between two persons in the group B, C, D. If there is a friendship between two persons in the group B, C, D, then those two persons, together with A, form the 3 mutual friends. If there is NO friendship between two persons in the group B, C, D, then B, C, D, form the 3 mutual enemies. Case 2: ( A has at least 3 enemies) –…for you to fill in…reasoning similar with case 1… n In either case, we have shown that there are either 3 mutual friends or 3 mutual enemies.

36 n End of Lecture