1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 7 Functions Instructor: Hayk Melikyan Today we will...

Post on 18-Jan-2018

224 views 0 download

description

3 Melikyan/DM/Fall09 If more pigeons than pigeonholes, Pigeonhole Principle

transcript

1Melikyan/DM/Fall09

Discrete Mathematics

Ch. 7 Functions

Instructor: Hayk Melikyanmelikyan@nccu.edu

Today we will review sections 7.3, 7.4 and 7.5

2Melikyan/DM/Fall09

Pigeonhole PrincipleIf n pigeons fly into m pigeonholes and n > m, then at least

onehole must contain two or more pigeons

3Melikyan/DM/Fall09

If more pigeons

than pigeonholes,

Pigeonhole Principle

4Melikyan/DM/Fall09

Pigeonhole Principlethen some hole must have at least two pigeons!

Pigeonhole principleA function from a larger set to a smaller set cannot be one-to-one injective.(There must be at least two elements in the domain that havethe same image in the codomain.)

5Melikyan/DM/Fall09

Examples:A function from one finite set to a smaller finite set

cannot be one-to-one

In a group of 13 people must there be at least two who have birthday in the same month?

A drawer contains 10 black and 10 white socks. How many socks need to be picked to ensure that a pair is found?

Let A = {1, 2, 3, 4, 5, 6, 7, 8}. If 5 integers are selected must at least one pair have sum of 9?

There is no FSA that accepts the following language: L = {s = akbk, for positive k}

6Melikyan/DM/Fall09

Pigeonhole PrincipleGeneralized Pigeonhole Principle: For any function f : X Yacting on finite sets, if n(X) > k * n(Y), then there exists somey from Y so that there are at least k + 1 distinct x’s so that f(x) = y

There are 42 students who are to share 12 computers. Each student uses exactly 1 computer and no computer is used by more than 6 students. Show that at least 5 computers are used by 3 or more students.

Generalized Pigeonhole Principle( contrapositive form): For any function f : X Y acting on finite sets and any positive integer k, if for each y Y, f-1(y) has at most k elements, then X has at most k * n(Y) elements

7Melikyan/DM/Fall09

♠ ♥ ♣ ♦

If n pigeons and h holes,then some hole has at least n

h

Cannot have < 3 cards in every hole.

Generalized Pigeonhole Principle

8Melikyan/DM/Fall09

Exercises

Let f : X Y and n(X) = n(Y), then f is bijective iff f is surjective

Let A be a set of 6 integers less than 13. Show that there must be two

distinct subsets of A whose sum of elements adds up to the samenumber

Given 52 distinct integers, show that there must be two whose sum or

difference is divisible by 100

Show that if 101 integers are chosen from 1 to 200 inclusive, there must

be two with the property that one is divisible by the other

Suppose a1, a2, …, an is a sequence of n integers none of which isdivisible by n. Show that at least one difference ai – aj is divisible by n

9Melikyan/DM/Fall09 9

Cardinality and Countability

Up to now cardinality has been the number of elements in a finite sets. Really, cardinality is a much deeper concept. Cardinality allows us to generalize the notion of number to infinite collections and it turns out that many type of infinities exist.

EG:– {,}– { , }– {Ø , {Ø,{Ø,{Ø}}} }

These all share “2-ness”.

10Melikyan/DM/Fall09L6 10

Cardinality and CountabilityFor finite sets, can just count the elements to get

cardinality. Infinite sets are harder.

First Idea: Can tell which set is bigger by seeing if one contains the other.– {1, 2, 4} N– {0, 2, 4, 6, 8, 10, 12, …} N

So set of even numbers ought to be smaller than theset of natural number because of strict containment.Q: Any problems with this?

11Melikyan/DM/Fall09L6 11

Cardinality and Countability Set of even numbers is obtained from N by

multiplication by 2. I.e.{even numbers} = 2•N

For finite sets, since multiplication by 2 is a one-to-one function, the size doesn’t change.

EG: {1,7,11} – 2 {2,14,22}

Another problem: set of even numbers is disjointfrom set of odd numbers. Which one is bigger?

12Melikyan/DM/Fall09L6 12

Cardinality and Countability – Finite Sets

Definition: Two sets A and B have the same cardinality if there’s a bijection f : A B

For finite sets this is the same as the old definition:

{, }

{ , }

13Melikyan/DM/Fall09 13

Cardinality and Countability – Infinite Sets

Notation , the Hebrew letter Aleph is often used to denoteinfinite cardinalities. Countable sets are said to have cardinality

.Intuitively, countable sets can be counted in the sense that ifyou allocate 1 second to count each member, eventually anyparticular member will be counted after a finite time period.Paradoxically, you won’t be able to count the whole set in afinite time period!

0

Definition: If S is finite or has the same cardinality as N, S is called countable

14Melikyan/DM/Fall09L6 14

Countability – Examples

Q: Why are the following sets countable?1. {0,2,4,6,8,…}2. {1,3,5,7,9,…}

1. {1,3,5,7, }2. Z

100100100100100

15Melikyan/DM/Fall09L6 15

Countability – Examples

1. {0,2,4,6,8,…}: Just set up the bijection f (n ) = 2n

2. {1,3,5,7,9,…} : Because of the bijection f (n ) = 2n +1

3. {1,3,5,7, } has cardinality 5 so is therefore countable

4. Z: This one is more interesting. Continue on next page:

100100100100100

16Melikyan/DM/Fall09 16

Countability of the Integers

Let’s try to set up a bijection between N and Z. One way is tojust write a sequence down whose pattern shows that everyelement is hit (onto) and none is hit twice (one-to-one). Themost common way is to alternate back and forth between thepositives and negatives. I.e.: 0,1,-1,2,-2,3,-3,…

It’s possible to write an explicit formula down for thissequence which makes it easier to check for bijectivity:

2

1)1( ia ii

17Melikyan/DM/Fall09 17

Demonstrating Countability. Useful Facts

Because is the smallest kind of infinity, it turns out that to

show that a set is countable one can either demonstrate an

injection into N or a surjection from N.

Theorem: Suppose A is a set. If there is an one-to-onefunction f : A N, or there is an onto function g : N A then A is countable.

The proof requires the principle of mathematical induction.

0

18Melikyan/DM/Fall09 18

Uncountability of RA: This is not a trivial matter. Here are some typical

reasoning:

1. R strictly contains N so has bigger cardinality. What’s wrong with this argument

1. R contains infinitely many numbers between any two numbers. Surprisingly, this is not a valid argument. Q has the same property, yet is countable.

1. Many numbers in R are infinitely complex in that they have infinite decimal expansions. An infinite set with infinitely complex numbers should be bigger than N.

19Melikyan/DM/Fall09 19

Uncountability of R

Last argument is the closest.Here’s the real reason: Suppose that R were countable. Inparticular, any subset of R, being smaller, would be countablealso. So the interval [0,1] would be countable. Thus it wouldbe possible to find a bijection from Z+ to [0,1] and hence listall the elements of [0,1] in a sequence.

What would this list look like? r1 , r2 , r3 , r4 , r5 , r6 , r7, …

20Melikyan/DM/Fall09L 20

Uncountability of R Cantor’s Diabolical Diagonal

So we have this listr1 , r2 , r3 , r4 , r5 , r6 , r7, …

supposedly containing every real number between 0 and 1.

Cantor’s diabolical diagonalization argument will take this

supposed list, and create a number between 0 and 1 which is

not on the list. This will contradict the countabilityassumption hence proving that R is not countable.

21Melikyan/DM/Fall09 21

Cantor's Diagonalization Argument

r1 0. r2 0. r3 0. r4 0. r5 0. r6 0. r7 0.:

revil 0.

Decimal expansions of ri

22Melikyan/DM/Fall09L6 22

Cantor's Diagonalization Argument

r1 0. 1 2 3 4 5 6 7 r2 0. r3 0. r4 0. r5 0. r6 0. r7 0.:

revil 0.

Decimal expansions of ri

23Melikyan/DM/Fall09L6 23

Cantor's Diagonalization Argument

r1 0. 1 2 3 4 5 6 7 r2 0. 1 1 1 1 1 1 1 r3 0. r4 0. r5 0. r6 0. r7 0.:

revil 0.

Decimal expansions of ri

24Melikyan/DM/Fall09 24

Cantor's Diagonalization Argument

r1 0. 1 2 3 4 5 6 7 r2 0. 1 1 1 1 1 1 1 r3 0. 2 5 4 2 0 9 0 r4 0. r5 0. r6 0. r7 0.:

revil 0.

Decimal expansions of ri

25Melikyan/DM/Fall09 25

Cantor's Diagonalization Argument

r1 0. 1 2 3 4 5 6 7 r2 0. 1 1 1 1 1 1 1 r3 0. 2 5 4 2 0 9 0 r4 0. 7 8 9 0 6 2 3 r5 0. r6 0. r7 0.:

revil 0.

Decimal expansions of ri

26Melikyan/DM/Fall09L6 26

Cantor's Diagonalization Argument

r1 0. 1 2 3 4 5 6 7 r2 0. 1 5 1 1 1 1 1 r3 0. 2 5 4 2 0 9 0 r4 0. 7 8 9 0 6 2 3 r5 0. 0 1 1 0 1 0 1 r6 0. r7 0.:

revil 0.

Decimal expansions of ri

27Melikyan/DM/Fall09L6 27

Cantor's Diagonalization Argument

r1 0. 1 2 3 4 5 6 7 r2 0. 1 5 1 1 1 1 1 r3 0. 2 5 4 2 0 9 0 r4 0. 7 8 9 0 6 2 3 r5 0. 0 1 1 0 1 0 1 r6 0. 5 5 5 5 5 5 5 r7 0.:

revil 0.

Decimal expansions of ri

28Melikyan/DM/Fall09 28

Cantor's Diagonalization Argument

r1 0. 1 2 3 4 5 6 7 r2 0. 1 5 1 1 1 1 1 r3 0. 2 5 4 2 0 9 0 r4 0. 7 8 9 0 6 2 3 r5 0. 0 1 1 0 1 0 1 r6 0. 5 5 5 5 5 5 5 r7 0. 7 6 7 9 5 4 4:

revil 0.

Decimal expansions of ri

29Melikyan/DM/Fall09L6 29

Cantor's Diagonalization Argument

r1 0. 1 2 3 4 5 6 7 r2 0. 1 5 1 1 1 1 1 r3 0. 2 5 4 2 0 9 0 r4 0. 7 8 9 0 6 2 3 r5 0. 0 1 1 0 1 0 1 r6 0. 5 5 5 5 5 5 5 r7 0. 7 6 7 9 5 4 4:

revil 0. 5 4 5 5 5 4 5

Decimal expansions of ri

30Melikyan/DM/Fall09 30

Uncountability of R Cantor’s Diabolical Diagonal

GENERALIZE: To construct a number not on the list“revil”, let ri,j be the j ’th decimal digit in the fractional part of ri.

Define the digits of revil by the following rule:The j ’th digit of revil is 5 if ri,j 5. Otherwise the j’ ’th digit is set to be 4.

his guarantees that revil is an anti-diagonal. I.e., it does notshare any elements on the diagonal. But every number on thelist contains a diagonal element. This proves that it cannot beon the list and contradicts our assumption that R was countableso the list must contain revil.//QED

31Melikyan/DM/Fall09 31

Impossible ComputationsNotice that the set of all bit strings is countable. Here’s howthe list looks:

0,1,00,01,10,11,000,001,010,011,100,101,110,111,0000,…

DEF: A decimal number 0.d1d2d3d4d5d6d7…

Is said to be computable if there is a computer program thatoutputs a particular digit upon request.EG:1. 0.11111111…2. 0.12345678901234567890…3. 0.10110111011110….

32Melikyan/DM/Fall09 32

Impossible Computations

Claim: There are numbers which cannot be computed by any computer.

Proof : It is well known that every computer program may berepresented by a bit-string (after all, this is how it’s storedinside). Thus a computer program can be thought of as a bitstring. As there are bit-strings yet R is uncountable, there canbe no onto function from computer programs to decimalnumbers. In particular, most numbers do not correspond toany computer program so are incomputable!