11
Section 2.5

Countability

Embed Size (px)

DESCRIPTION

Talks about countable sets and all of that other fun stuff.

Citation preview

Page 1: Countability

Section 2.5 

Page 2: Countability

Cardinality    (another) Definition: The cardinality of a set A is equal to the cardinality of a set B, denoted  

                  |A| = |B|,     if and only if there is a bijection from A to B.    If there is an injection from A to B, the cardinality of A is less than or the same as the cardinality of B and we write |A| ≤ |B|. 

 

Page 3: Countability

Cardinality   Definition: A set that is either finite or has the same cardinality as the set of positive integers (Z+) is called countable. A set that is not countable is uncountable. 

 The set of all finite strings over the alphabet of lowercase letters is countable.  

 The set of real numbers R  is an uncountable set.    

Page 4: Countability

Showing that a Set is Countable    An infinite set is countable if and only if it is possible to list the elements of the set in a sequence (indexed by the positive integers).  

 The reason for this is that a bijection f from the set of positive integers to a set S can be expressed in terms of a sequence         a1,a2,…, an ,… where a1 = f(1), a2  = f(2),…, an = f(n),…  

Page 5: Countability

Showing that a Set is Countable   Example 1: Show that the set of positive even integers is countable set. 

  Proof: Let E be the set of even integers and f(x) = 2x be a function from N to E.  

                 1    2    3    4    5     6  …..0

                  2    4    6    8    10  12  ……    Then f is a bijection from N to E since f is both one‐to‐one and onto.  To show that it is injective, suppose that     f(n) = f(m).   Then 2n  = 2m, and so n = m. To see that it is surjective, suppose that t is some even positive integer. Then t = 2k for some positive integer k and f(k) = t.  

 

Page 6: Countability

Showing that a Set is Countable   Example 2: Show that the set of all integers Z is countable. 

   Proof: We can list the integers in a sequence:       0, 1, − 1, 2, − 2, 3, − 3 ,………..0Let f be a function from N  to Z defined as  When n is even:    f(n) = n/2  When n is odd:     f(n) = −(n−1)/2 that generates this list.  We now show that this function  is a bijection. First we show that it is injective by case analysis on the parity of N. 

Page 7: Countability

Showing that a Set is Countable   Let m and n be two even natural numbers, then  f(m) = m/2 and f(n) = n/2, it follows that f(m)=f(n) implies m=n. 

  Let m and n be two odd natural numbers, then f(m) = ‐(m‐1)/2 and f(n) = ‐(n‐1)/2, it follows that f(m)=f(n) implies m=n. 

Therefore, f is injective. We now show that f is surjective by case analysis on the sign of some integer t in Z.   Let t be positive, then t will appear in an even position in the sequence, thus f(2k)=2k/2=t with t=k. This implies that for every positive value t in  Z there is a natural number 2k. 

  Let t be negative, then t will appear in an odd position in the sequence, thus f(2k‐1)=‐(2k‐1‐1)/2=t with t=‐k.  This implies that for every negative value t in Z there is a natural number 2k‐1. 

Therefore, f is surjective. (QED) 

Page 8: Countability

Strings    Example 4: Show that the set of finite strings S over the lowercase letters is countably infinite. Proof: Show that the strings can be listed in a sequence. First list 

1.  All the strings of length 0 in alphabetical order. 2.  Then all the strings of length 1 in lexicographic (as in 

a dictionary) order. 3.  Then all the strings of length 2 in lexicographic order.  4.  And so on. 

   This implies a bijection from N to S and hence it is a countably infinite set. 

Page 9: Countability

The set of all Java programs is countable.     Example 5:  Show that the set of all Java programs is countable.     Solution: Let S be the set of  strings constructed from the characters which can appear in a Java program. Use the ordering from the previous example. Take each string in turn:   Feed the string into a Java compiler. (A Java compiler will 

determine if the input program is a syntactically correct Java program.) 

  If the compiler says YES, this is a syntactically correct Java program, we add the program to the list. 

  We move on to the next string.     In this way we construct an implied bijection from N to the set of Java programs. Hence, the set of Java programs is countable. 

Page 10: Countability

The Real Numbers are Uncountable Example: Show that the real numbers are not countable. Proof: It is sufficient to show that the real numbers between 0 and 1 are not countable.  Proof by contradiction.  Assume that the real numbers between 0 and 1 are countable, then we can list them,       However, given this list we can now construct a new real number rq between 0 and 1 that does not appear on this list, 

r1= 0.d

11d12d13…d

1n…

r2= 0.d

21d22d23…d

2n…

r3= 0.d

31d32d33…d

3n…

!

rn= 0.d

n1dn2dn3…d

nn…

!

rq = 0.dq1dq2dq3…dqn…

with dq1! d

11,dq2

! d22

,dq3! d

33,…,dqn ! dnn,…

Page 11: Countability

The Real Numbers are Uncountable With this construction rq differs from any real number on the list in at least one position. This is a contradiction. Therefore, the real numbers between 0 and 1 are uncountable. (QED)