Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cardinality of Sets Section 2.5.

Similar presentations


Presentation on theme: "Cardinality of Sets Section 2.5."— Presentation transcript:

1 Cardinality of Sets Section 2.5

2 Section Summary Cardinality Countable Sets Computability

3 Cardinality Definition A set S is finite with cardinality n  N if there is a bijection from the set {0, 1, …, n1} to S. A set is infinite if it is not finite. Theorem The set N of natural numbers is an infinite set. Proof Consider the injection f : N  N defined as f(x) = 3x. The range of f is a subset of the domain of f.

4 Some facts which could easily be seen are:
If S is infinite and is a subset of S, S is infinite. Every subset of a finite set is finite. If f : S  T be an injection and S is infinite, then T is infinite. If S is an infinite set P(S) is infinite. If S and T are infinite sets. S  T is infinite. If S is infinite and T  , then S  T is infinite. If S is infinite and T  , the set of functions from T to S is infinite.

5 Definition The sets A and B have the same cardinality if and only if there is a one-to-one correspondence from A to B. When A and B have the same cardinality, we write |A| = |B|. For infinite sets the definition of cardinality provides a relative measure of the sizes of two sets, rather than a measure of the size of one particular set. We can also define what it means for one set to have a smaller cardinality than another set.

6 Cardinality If there is a one-to-one function (i.e., 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|. When |A| ≤ |B| and A and B have different cardinality, we say that the cardinality of A is less than the cardinality of B and write |A| < |B|, (there exists an injection but no bijection from A to B).

7 Countable Sets 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. When an infinite set is countable (countably infinite) its cardinality is ℵ0 (where ℵ is aleph, the 1st letter of the Hebrew alphabet). We write |S| = ℵ0 and say that S has cardinality “aleph null.” The set of real numbers R is an uncountable set.

8 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) – an enumeration without repetitions. The reason for this is that a one-to-one correspondence 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),…

9 Hilbert’s Grand Hotel David Hilbert The Grand Hotel (example due to David Hilbert) has countably infinite number of rooms, each occupied by a guest. We can always accommodate a new guest at this hotel. How is this possible? Explanation: Because the rooms of Grand Hotel are countable, we can list them as Room 1, Room 2, Room 3, and so on. When a new guest arrives, we move the guest in Room 1 to Room 2, the guest in Room 2 to Room 3, and in general the guest in Room n to Room n + 1, for all positive integers n. This frees up Room 1, which we assign to the new guest, and all the current guests still have rooms. The hotel can also accommodate a countable number of new guests, all the guests on a countable number of buses where each bus contains a countable number of guests (see exercises).

10 Showing that a Set is Countable
Example 1: Show that the set of positive even integers E is countable set. Solution: Let f(x) = 2x … …… Then f is a bijection from Z+ to E since f is both one-to-one and onto. To show that it is one-to-one, suppose that f(n) = f(m). Then 2n = 2m, and so n = m. To see that it is onto, suppose that t is an even positive integer. Then t = 2k for some positive integer k and f(k) = t.

11 Showing that a Set is Countable
Example 2: Show that the set of integers Z is countable. Solution: Can list in a sequence: 0, 1, − 1, 2, − 2, 3, − 3 ,……….. Or can define a bijection from N to Z: When n is even: f(n) = n/2 When n is odd: f(n) = −(n−1)/2

12 The Positive Rational Numbers are Countable
Definition: A rational number can be expressed as the ratio of two integers p and q such that q ≠ 0. ¾ is a rational number √2 is not a rational number. Example 3: Show that the positive rational numbers are countable. Solution:The positive rational numbers are countable since they can be arranged in a sequence: r1 , r2 , r3 ,… The next slide shows how this is done →

13 The Positive Rational Numbers are Countable
First row q = 1. Second row q = 2. etc. Constructing the List First list p/q with p + q = 2. Next list p/q with p + q = 3 And so on. 1, ½, 2, 3, 1/3,1/4, 2/3, ….

14 Strings are countable Example 4: Show that the set of strings * over a finite alphabet  is countably infinite. Assume an alphabetical ordering of symbols in  Solution: Show that the strings can be listed in a sequence. First list All the strings of length 0 in alphabetical order. Then all the strings of length 1 in lexicographic (as in a dictionary) order. Then all the strings of length 2 in lexicographic order. And so on. This implies a bijection from Z+ to S and hence it is a countably infinite set.

15 Example Let  = {a, b}. The set of strings * over  is a countably infinite set. An enumeration  of * is possible. (1) = , the empty string. Assuming a comes before b in , (2) = a and (3) = b. (4) to (7) are strings of length 2 and so on. What is the 50th string in the sequence? (1) – string of length 0 (2)  (3) – string of length 1 (4)  (7)  string of length 2 (8)  (15) – string of length 3 (16)  (31)  string of length 4 (32)  (63)  string of length 5 Hence the 50th string is of length 5. Among these (32) to (47) begin with a and (48) to (63) begin with b. (48) = b a a a a (49) = b a a a b (50) = b a a b a Hence the 50th string in the sequence is b a a b a.

16 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 Z+ to the set of Java programs. Hence, the set of Java programs is countable.

17 The Real Numbers are Uncountable
Georg Cantor ( ) The Real Numbers are Uncountable Example: Show that the set of real numbers is uncountable. Solution: The method is called the Cantor diagnalization argument, and is a proof by contradiction. Suppose R is countable. Then the real numbers between 0 and 1 are also countable (any subset of a countable set is countable - an exercise in the text). The real numbers between 0 and 1 can be listed in order r1 , r2 , r3 ,… . Let the decimal representation of this listing be Form a new real number with the decimal expansion where r is not equal to any of the r1 , r2 , r3 ,... Because it differs from ri in its ith position after the decimal point. Therefore there is a real number between 0 and 1 that is not on the list since every real number has a unique decimal expansion. Hence, all the real numbers between 0 and 1 cannot be listed, so the set of real numbers between 0 and 1 is uncountable. Since a set with an uncountable subset is uncountable (an exercise), the set of real numbers is uncountable.

18 Schröder-Bernstein Theorem
Results about Cardinality Schröder-Bernstein Theorem If A and B are sets with |A| ≤ |B| and |B| ≤ |A|, then |A|=|B| . In other words, if there are one-to-one functions f from A to B, and g from B to A, then there is a one-to-one correspondence between A and B.

19 Theorem Every infinite set contains a countably infinite subset. Proof Let S be an infinite set. Select a sequence of elements <a0, a1, …> from S as follows: Select a0 from S Select a1 from S  {a0} Select a2 from S  {a0, a1} and so on. ai will be selected from S – {a0, a1, …, ai−1}. Each S – {a0, …, ai} is infinite. Otherwise (S – {a0, …, ai})  {a0, …, ai} = S will be finite. This set {a0, …, ai,…} is countably infinite subset of S.

20 Theorem The union of a countable collection of countable sets is countable. Proof Let S0, S1, S2, … be a countable collection of countable sets and each Si = <ai0, ai1, ai2, …> S0 : (a00 a01 a02 a03 …) S1 : (a10 a11 a12 a13 …) S2 : (a20 a21 a22 a23 …) S3 : (a30 a31 a32 a33 …) Enumerate the elements as shown in the diagram. Let b0, b1, … be the sequence of elements. b0 = a00, b1 = a01, b2 = a10 b3 = a02, b4 = a11, b5 = a20 and so on. This is an enumeration of the elements of and hence is countable.

21 Theorem Let  be a finite alphabet and * the set of all strings over . Then P(*) is uncountable. Proof Let <x0, x1, x2, …> be an enumeration of strings in * and if possible let <A0, A1, …> be an enumeration of the sets in P(*). Construct a binary matrix M as follows. x0 x1 x2 A0 a00 a01 a02 A1 a10 a11 a12 A2 a20 a21 a22

22 Cont Proof aij = 1 if xj  Ai and aij = 0 if xj  Ai. Now we construct a set A as follows xi  A if aii = 0. i.e., xi  Ai, A = {xi  A | xi  Ai, i  N} Now we can see that A cannot be any Aj and hence cannot appear in the enumeration <A0, A1, …> even though A  P(*). This is seen by the following contradiction. Suppose if possible let A = Aj. A consists of strings xj such that ajj = 0. So if xj  A, then ajj = 0 and by the way we constructed the matrix M, if ajj = 0, xj  Aj. Hence A  Aj. Hence we cannot have an enumeration of the sets in P(*) and so P(*) is an uncountable set.

23 Theorem If S is an infinite set, then ℵ0  |S|. Proof Case 1: S is countable: Trivial, since we know |S|= ℵ0 from definition Case 2: S is uncountable We have already seen that if S is infinite, then S contains a countably infinite subset S. Since the mapping f defined as f : S  S where f(x) = x for all x  S is an injection from S to S, we conclude that |S|  |S|. |S| = ℵ0. Hence ℵ 0  |S|. This leads us to the famous continuum hypothesis, which asserts that there is no cardinal number between ℵ0 and c. In other words, the continuum hypothesis states that there is no set A such that ℵ0, the cardinality of the set of positive integers, is less than |A| and |A| is less than c, the cardinality of real numbers.

24 Theorem Let S be a set. Then |S| < |P(S)|. Proof Consider the injection f : S P(S) defined as f(a) = {a} for all a  S. Since we have such an injection |S|  |P(S)|. Next we show |S|  |P(S)|. Let g be an arbitrary function from S to P(S). We can show that g is not surjective and hence not bijective. The function g maps each element of S to a subset of S. An element x may or may not be in the subset defined by g(x). Now let us define a subset A of S as follows:

25 A = {x | x  g(x)} A is a subset of S and hence A  P(S)
A = {x | x  g(x)} A is a subset of S and hence A  P(S). We show that for no a in S, g(a) = A. Suppose for some a, g(a) = A, then a  A  a  {x | x  g(x)}  a  g(a)  a  A and we arrive at a contradiction and the assumption that g(a) = A for some a in S is not correct. It follows that g is not surjective and hence not bijective. We have chosen g arbitrarily and hence we can conclude that no bijection exists from S to P(S) and therefore |S|  |P(S)|.

26 Hence |S| < |P (S)|. Using the above result, we see that we have an infinite hierarchy of uncountable set S. i.e., infinite sequence of cardinal numbers, each of which is smaller than the next in the sequence. ℵ0 = |N| < |P(N)| < |P (P(N))| < 

27 Computability (Optional)
Definition: We say that a function is computable if there is a computer program in some programming language that finds the values of this function. If a function is not computable we say it is uncomputable. There are uncomputable functions. We have shown that the set of Java programs is countable. Exercise 38 in the text shows that there are uncountably many different functions from a particular countably infinite set (i.e., the positive integers) to itself. Therefore (Exercise 39) there must be uncomputable functions.


Download ppt "Cardinality of Sets Section 2.5."

Similar presentations


Ads by Google