20
Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

Embed Size (px)

Citation preview

Page 1: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

Application: The Pigeonhole Principle

Lecture 37

Section 7.3

Wed, Apr 4, 2007

Page 2: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

The Pigeonhole Principle

Pigeon version: If you put n pigeons into m pigeonholes, and n > m, then at least at least two pigeons are in the same pigeonhole.

Mathematical version: If A and B are finite sets and |A| > |B| and f : A B, then f is not one-to-one.

Page 3: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

Example

If a drawer contains 10 black socks and 12 blue socks, how many socks must you draw at random in order to guarantee that you have two socks of the same color?

Page 4: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

Example

A bag of jellybeans contains dozens of jelly beans of each of 8 different colors. How many jellybeans must we choose in order to guarantee that we have at least two jellybeans of the same color?

To guarantee three of the same color? To guarantee four of the same color?

Page 5: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

The PowerMod function

Define the PowerMod() function as

PowerMod(n, a, m) = na mod m. Then the sequence of numbers

PowerMod(3, i, 7), 0 i 10,

must contain at least one repeated value.

Page 6: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

Example

If we choose 6 distinct integers from 1 to 9, at least one pair of them adds to 10.

Why?

Page 7: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

Example

If we choose 6 distinct integers from 1 to 9, at least two pairs of the chosen integers have the same total.

Why?

Page 8: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

Example

How many integers must we choose from 1 to 99 in order to guarantee that at least two distinct pairs of them will have the same total?

Page 9: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

Functions of Finite Sets

Theorem: Let A and B be finite sets with |A| = |B| and let f : A B. Then f is one-to-one if and only if f is onto.

Proof: Suppose that f is not onto. Let f(A) be the set {f(a) | a A}.Then f : A f(A) and |f(A)| < |A|.

Page 10: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

Functions of Finite Sets

By the mathematical version of the pigeonhole principle, there are at least two distinct members a1, a2 A with the same image in f(A).

That is, f(a1) = f(a2) for some a1 a2.Thus, f is not one-to-one.By the contrapositive, if f is one-to-one,

then f is onto.

Page 11: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

Functions of Finite Sets

We also need to prove that if f is onto, then f is one-to-one. (Exercise)

Page 12: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

The Locker Problem

A hallway has 1000 lockers, numbered 1 through 1000.

We have 1000 students, numbered 1 through 1000.

For each k from 1 to 1000, we send student #k down the hallway, with instructions to reverse the open/closed status every kth locker door, beginning with locker #k.

Page 13: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

The Locker Problem

After all the students are done, which lockers doors will be open?

Did it matter in which order the students were dispatched?

Page 14: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

The Locker Problem

Suppose we have only 10 doors and 10 students.

We wish to leave open doors 2, 4, 5, 8, 9, and no others.

Which students do we send down the hallway so that in the end only doors 2, 4, 5, 8, and 9 are open?

Page 15: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

The Locker Problem

Clearly, we must not send student #1 down the hallway.

Thus, clearly, we must send student #2 down the hallway.

That will leave open doors 2, 4, 6, 8, 10. Thus, clearly, we must not send student #3

down the hallway.

Page 16: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

The Locker Problem

Thus, clearly, neither should we send student #4 down the hallway.

Thus, clearly, we must send student #5 down the hallway.

That will leave open doors 2, 4, 5, 6, 8. Thus, clearly, we must send student #6

down the hallway.

Page 17: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

The Locker Problem

Thus, clearly, we must not send students #7 or #8 down the hallway.

Thus, clearly, we must send student #9 down the hallway and we must not send student #10 down the hallway.

Page 18: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

The Locker Problem

Given an arbitrary subset D of the 1000 locker doors, is it possible to send some subset S of the 1000 students down the hallway with their instructions such that in the end, only the doors in set D are open?

Page 19: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

The Locker Problem

Let A be the set of choices of which students to send down the hallway.

Let B be the set of choices of which locker doors to be left open in the end.

How many elements are in A and B?

Page 20: Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007

The Locker Problem

Let f : A B by defining f(A) = the set of doors left open when the students in A are sent down the hallway.

If we can show that f is one-to-one, then it follows that it is onto.

How can we show that f is one-to-one?