Cardinality of sets (CSCI 2824, Spring 2015)

In this lecture we will talk about:

  • Cantor's Diagonalization Argument: No one-to-one correspondence between a set and its powerset.

    • Degrees of infinity: Countable and Uncountable Sets.

  • Countable Sets: Natural Numbers, Integers, Rationals, Java Programs (!!)

  • Uncountable Sets: Real Numbers, Functions over naturals,…

  • What all this means for computers.

(Section 4.3 of the textbook)

Comparing sizes using correspondences

We defined the cardinality of a finite set is the number of elements of that set. In general, we can define cardinality for infinite sets too.

Comparing Cardinalities using one-to-one correspondences

Two sets A,B have the same cardinality if and only if there is a one-to-one correspondence f: A rightarrow B.

Example-1

Let us say that a chef needs to make sure she has enough dinnerware for her guests. She does not need to count plates, knives, forks and so on. All she needs to do is to arrange the plates, knives, forks and so on along side each other neatly to see if there is a one-to-one correspondence.

Example-2

We established a one-to-one correspondence between natural numbers and odd numbers. f(n) = 2n +1.

We can do the same for mathbb{Z} the set of integers and mathbb{N} the natural numbers.

f(i) = left{ begin{array}{l} 2 |i| + 1, mbox{if} i  < 0  2i, mbox{if} {i geq 0} end{array} right.

Example-3

Let us now establish a one-to-one correspondence between natural numbers mathbb{N} and the set mathbb{N} times mathbb{N}. We just need to line up elements of mathbb{N} and mathbb{N} times mathbb{N} just like our chef does to knives and forks.

Cantor's Diagonalization Argument

We will now prove that no set can have the same cardinality as its power set.

Claim: The set of natural numbers mathbb{N} cannot be put in a one-to-one correspondence with its power set P(N).

Proof

We will prove by contradiction by assuming that such a correspondence exists between N and its power set P(N).

Suppose there is a one-to-one and onto function f: N rightarrow P(N). We note that f(j) = { j_1,ldots,j_k,ldots } subseteq N. We can represent f by the following table.

1? 2? 3? n?
f(1) 1 0 1 0 ….
f(2) 0 1 0 1 ….
. . . ….
f(n) 0 1 0 …. 0 ….
...

Each row represents the set f(i) and for every j, a “1” entry in (i,j) says that j in f(i). A “0” entry says that j notin f(i).

We will now prove that f is not onto by constructing S in P(N) such that f(j) not=S for all j in N. In other words, the set S we construct will not be mapped onto.

The idea is to construct S so that we go down the table and “spoil” each i as follows:

  • Take a look at diagonal entries (i,i) in the table for all i.

  • If entry (i,i) has a 1 in it we make sure that i notin S. If it has a zero in it, we add i in S.

We now claim that f(j) not = S for all j. Suppose it were, we know that either (1) j in f(j) or (2) j notin f(j).

  • If j in f(a_j) then we know that j notin S. Therefore, f(j) not= S.

  • If j notin f(j) then j in S. Again, once again f(j) not= S.

By making sure that the set S we construct disagrees with all f(j), we establish that the function f cannot be onto.

Therefore, the natural numbers cannot have the same cardinality as P(N). In fact, we have established an argument to say that |N| < |P({N})| by showing that any function f: N rightarrow P(N) cannot be onto.

Claim For every set A, there can be no one-to-one correspondence (bijection) between A and P(A).

This can be proved by extending the “diagonalization” argument to arbitrary sets A.

Proof

Suppose, for the sake of contradiction, F: A rightarrow P(A) is a one-to-one correspondence. We will contradict by construction a set B in P(A) such that no a in A maps onto to B.

For every x in A, we consider the question if x in F(x). If yes, we set x notin B. Otherwise, x in B.

B = { x in A | x notin F(x) } .

Since F is a one-to-one and onto function, B = F(a) for some a in A.

Is a in B?

If yes, then a in F(a) therefore by construction, a notin B.

If not, then a notin F(a) and therefore, a in B by our construction.

Either way, we get a contradiction.

Countable and Uncountable Sets

Countable Sets

A set is countable if it can be placed in one-to-one correspondence with the natural numbers.

A set is uncountable if it can be placed in one-to-one correspondence with a set such as P(N) (or in general, any set known not to be in one-to-one correspondence with N).

Cantor-Schroeder-Bernstein Theorem

We will use the following important lemma to make the process of establishing one-to-one correspondences easier.

Claim For any two sets A,B if there is a one to one function f: A rightarrow B and a one-to-one function g: B rightarrow A then there is a one-to-one onto function (a one-to-one correspondence, in other words) h: A rightarrow B. (Therefore |A| = |B|).

The proof for finite sets is easy. Since f exists, we conclude that |A| leq |B|. On the other hand, from the existence of g we conclude that |B| leq |A|. Combining, we conclude that |A| = |B|. For finite sets, this is enough to show that a one-to-one correspondence function h also exists.

Real Numbers

Claim The set of real numbers in the in the interval [0,1] has a one-to-one correspondence with P(N) (the power set of natural numbers).

Proof We will prove by using CSB theorem above by establishing one-to-one functions:

  • One-to-one function f between [0,1] and P(N).

  • One-to-one function g between P(N) and [0,1].

One-to-one Function

Let us first write down the function f: [0,1] rightarrow  P(N). The basic idea is that we take any number with the decimal expansion d = 0.34091609409409... and have a set of the form S(d) = { (1,3), (2,4), (3,0), (4,9),ldots } that describes the decimal expansion. A tuple (i,j) in S(d) says that the i^{th} position has the number j in it. However, S(d) subseteq Ntimes N. So we do a second trick called Godel Numbering. We represent each tuple (i,j) by a single number n=2^i 3^j.

Therefore the One-to-one function f constructs the decimal expansion for a given input d in [0,1] and derives the set S(d) subseteq N times N. Next it Godel numbers the elements of S(d) to give a set G(d) subseteq N.

Onto Function

Let us now take care of the one-to-one function g between P(N) and [0,1]. Take a set I in P(N). I is a set of natural numbers say I = {1,20,56,109,...}. We construct a number d in binary of the form d =0.1011101110111.. where the i^{th} position after the fixed point has a 1 if i in I and a 0 otherwise. We can verify in class that this gives a one-to-one mapping from P(N) to reals R.

Here is the flaw in the construction: the function g is not one-to-one. The problem is that the decimals d=0.0001 and d=0.000011111... mean the same thing. In fact an infinite sequence of trailing 1s is forbidden in binary number scheme. The reason g is not one-to-one is because two sets map onto d:

 S_1 ={4}, S_2={5,6,7,8,ldots }

How can we fix this flaw?

Simple, instead of binary, we interpret the number in decimal. We have 0.0000111111 to be a perfectly valid decimal number that is not the same as 0.00001. Therefore, to fix the proof, we just interpret the number d in decimal as opposed to binary.

Since we have one-to-one mapping both ways, we conclude from CSB theorem that there is some one-to-one correspondences. In other words, |R| = |P(N)| > |N|.

Rational Numbers

We show that the set of rational numbers Q is countable. By showing a one-to-one correspondence between Q and N times N.

Using CSB theorem, we instead show a one to one function f: Q rightarrow N times N and a function g: N times N rightarrow Q.

As a clarification, we note that rational numbers are numbers of the form frac{p}{q} where q not= 0. There are many representations for a rational number. Eg., frac{2}{3} = frac{4}{6} = frac{6}{9} = cdots all represent the same element of Qq. We will use the lowest terms representations where frac{p}{q} do not have prime factors in common.

Let us first derive the map f: Q rightarrow N times N. Given a rational number r = frac{p}{q} in Q in its lowest terms, we simply say f(frac{p}{q}) = (p,q). This map has to be one-to-one (it is not onto, but we do not need that since we are using CSB theorem).

Claim The function f is one-to-one.

The proof is very simple, can you try?

We now define the map g: Ntimes N mapsto Q as g(a,b) = frac{2^a}{3^b}.

Claim We claim that g is one-to-one.

Proof Let us assume that g(m,n) = g(a,b) for some (m,n) and (a,b) in N times N. We aim to prove that a=m and b=n.

Therefore 2^{m-a} = 3^{n-b}. Therefore, m-a = n-b = 0, or n = b and a=m (since 2 and 3 are relatively prime numbers).