discrete mathematics & mathematical reasoning cardinality · finite and infinite sets a =...

54
Discrete Mathematics & Mathematical Reasoning Cardinality Colin Stirling Informatics Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 1 / 13

Upload: others

Post on 06-Jun-2020

4 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Discrete Mathematics & Mathematical ReasoningCardinality

Colin Stirling

Informatics

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 1 / 13

Page 2: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Finite and infinite sets

A = {1,2,3} is a finite set with 3 elements

B = {a,b, c,d} and C = {1,2,3,4} are finite sets with 4 elements

For finite sets, |X | ≤ |Y | iff there is an injection f : X → Y

For finite sets, |X | = |Y | iff there is an bijection f : X → Y

Z+, N, Z, Q, R are infinite sets

When do two infinite sets have the same size?

Same answer

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 2 / 13

Page 3: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Finite and infinite sets

A = {1,2,3} is a finite set with 3 elements

B = {a,b, c,d} and C = {1,2,3,4} are finite sets with 4 elements

For finite sets, |X | ≤ |Y | iff there is an injection f : X → Y

For finite sets, |X | = |Y | iff there is an bijection f : X → Y

Z+, N, Z, Q, R are infinite sets

When do two infinite sets have the same size?

Same answer

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 2 / 13

Page 4: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Finite and infinite sets

A = {1,2,3} is a finite set with 3 elements

B = {a,b, c,d} and C = {1,2,3,4} are finite sets with 4 elements

For finite sets, |X | ≤ |Y | iff there is an injection f : X → Y

For finite sets, |X | = |Y | iff there is an bijection f : X → Y

Z+, N, Z, Q, R are infinite sets

When do two infinite sets have the same size?

Same answer

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 2 / 13

Page 5: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Finite and infinite sets

A = {1,2,3} is a finite set with 3 elements

B = {a,b, c,d} and C = {1,2,3,4} are finite sets with 4 elements

For finite sets, |X | ≤ |Y | iff there is an injection f : X → Y

For finite sets, |X | = |Y | iff there is an bijection f : X → Y

Z+, N, Z, Q, R are infinite sets

When do two infinite sets have the same size?

Same answer

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 2 / 13

Page 6: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Finite and infinite sets

A = {1,2,3} is a finite set with 3 elements

B = {a,b, c,d} and C = {1,2,3,4} are finite sets with 4 elements

For finite sets, |X | ≤ |Y | iff there is an injection f : X → Y

For finite sets, |X | = |Y | iff there is an bijection f : X → Y

Z+, N, Z, Q, R are infinite sets

When do two infinite sets have the same size?

Same answer

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 2 / 13

Page 7: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Finite and infinite sets

A = {1,2,3} is a finite set with 3 elements

B = {a,b, c,d} and C = {1,2,3,4} are finite sets with 4 elements

For finite sets, |X | ≤ |Y | iff there is an injection f : X → Y

For finite sets, |X | = |Y | iff there is an bijection f : X → Y

Z+, N, Z, Q, R are infinite sets

When do two infinite sets have the same size?

Same answer

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 2 / 13

Page 8: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Finite and infinite sets

A = {1,2,3} is a finite set with 3 elements

B = {a,b, c,d} and C = {1,2,3,4} are finite sets with 4 elements

For finite sets, |X | ≤ |Y | iff there is an injection f : X → Y

For finite sets, |X | = |Y | iff there is an bijection f : X → Y

Z+, N, Z, Q, R are infinite sets

When do two infinite sets have the same size?

Same answer

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 2 / 13

Page 9: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Cardinality of sets

DefinitionTwo sets A and B have the same cardinality, |A| = |B|, iff thereexists a bijection from A to B

|A| ≤ |B| iff there exists an injection from A to B|A| < |B| iff |A| ≤ |B| and |A| 6= |B| (A smaller cardinality than B)

Unlike finite sets, for infinite sets A ⊂ B and |A| = |B|

Even = {2n | n ∈ N} ⊂ N and |Even| = |N|

f : Even→ N with f (2n) = n is a bijection

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 3 / 13

Page 10: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Cardinality of sets

DefinitionTwo sets A and B have the same cardinality, |A| = |B|, iff thereexists a bijection from A to B|A| ≤ |B| iff there exists an injection from A to B

|A| < |B| iff |A| ≤ |B| and |A| 6= |B| (A smaller cardinality than B)

Unlike finite sets, for infinite sets A ⊂ B and |A| = |B|

Even = {2n | n ∈ N} ⊂ N and |Even| = |N|

f : Even→ N with f (2n) = n is a bijection

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 3 / 13

Page 11: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Cardinality of sets

DefinitionTwo sets A and B have the same cardinality, |A| = |B|, iff thereexists a bijection from A to B|A| ≤ |B| iff there exists an injection from A to B|A| < |B| iff |A| ≤ |B| and |A| 6= |B| (A smaller cardinality than B)

Unlike finite sets, for infinite sets A ⊂ B and |A| = |B|

Even = {2n | n ∈ N} ⊂ N and |Even| = |N|

f : Even→ N with f (2n) = n is a bijection

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 3 / 13

Page 12: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Cardinality of sets

DefinitionTwo sets A and B have the same cardinality, |A| = |B|, iff thereexists a bijection from A to B|A| ≤ |B| iff there exists an injection from A to B|A| < |B| iff |A| ≤ |B| and |A| 6= |B| (A smaller cardinality than B)

Unlike finite sets, for infinite sets A ⊂ B and |A| = |B|

Even = {2n | n ∈ N} ⊂ N and |Even| = |N|

f : Even→ N with f (2n) = n is a bijection

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 3 / 13

Page 13: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Cardinality of sets

DefinitionTwo sets A and B have the same cardinality, |A| = |B|, iff thereexists a bijection from A to B|A| ≤ |B| iff there exists an injection from A to B|A| < |B| iff |A| ≤ |B| and |A| 6= |B| (A smaller cardinality than B)

Unlike finite sets, for infinite sets A ⊂ B and |A| = |B|

Even = {2n | n ∈ N} ⊂ N and |Even| = |N|

f : Even→ N with f (2n) = n is a bijection

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 3 / 13

Page 14: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Cardinality of sets

DefinitionTwo sets A and B have the same cardinality, |A| = |B|, iff thereexists a bijection from A to B|A| ≤ |B| iff there exists an injection from A to B|A| < |B| iff |A| ≤ |B| and |A| 6= |B| (A smaller cardinality than B)

Unlike finite sets, for infinite sets A ⊂ B and |A| = |B|

Even = {2n | n ∈ N} ⊂ N and |Even| = |N|

f : Even→ N with f (2n) = n is a bijection

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 3 / 13

Page 15: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Countable sets

DefinitionA set S is called countably infinite, iff it has the same cardinality asthe positive integers, |Z+| = |S|

A set is called countable iff it is either finite or countably infiniteA set that is not countable is called uncountable

N is countably infinite; what is the bijection f : Z+ → N?

Z is countably infinite; what is the bijection g : Z+ → Z?

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 4 / 13

Page 16: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Countable sets

DefinitionA set S is called countably infinite, iff it has the same cardinality asthe positive integers, |Z+| = |S|A set is called countable iff it is either finite or countably infinite

A set that is not countable is called uncountable

N is countably infinite; what is the bijection f : Z+ → N?

Z is countably infinite; what is the bijection g : Z+ → Z?

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 4 / 13

Page 17: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Countable sets

DefinitionA set S is called countably infinite, iff it has the same cardinality asthe positive integers, |Z+| = |S|A set is called countable iff it is either finite or countably infiniteA set that is not countable is called uncountable

N is countably infinite; what is the bijection f : Z+ → N?

Z is countably infinite; what is the bijection g : Z+ → Z?

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 4 / 13

Page 18: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Countable sets

DefinitionA set S is called countably infinite, iff it has the same cardinality asthe positive integers, |Z+| = |S|A set is called countable iff it is either finite or countably infiniteA set that is not countable is called uncountable

N is countably infinite; what is the bijection f : Z+ → N?

Z is countably infinite; what is the bijection g : Z+ → Z?

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 4 / 13

Page 19: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Countable sets

DefinitionA set S is called countably infinite, iff it has the same cardinality asthe positive integers, |Z+| = |S|A set is called countable iff it is either finite or countably infiniteA set that is not countable is called uncountable

N is countably infinite; what is the bijection f : Z+ → N?

Z is countably infinite; what is the bijection g : Z+ → Z?

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 4 / 13

Page 20: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

The positive rational numbers are countableConstruct a bijection f : Z+ → Q+

List fractions p/q with q = n in the nth row

f traverses this list in the order for m = 2,3,4, . . . visiting all p/q withp + q = m (and listing only new rationals)

P1: 1

CH02 Rosen-2311T rosen.cls July 9, 2012 14:50

172 2 / Basic Structures: Sets, Functions, Sequences, Sums, and Matrices

11

12

13

14

15

21

22

23

24

25

31

32

3

3

3

4

35

41

42

43

44

45

51

52

53

54

55

...

...

...

...

...

...............

Terms not circledare not listedbecause theyrepeat previouslylisted terms

FIGURE 3 The Positive Rational Numbers Are Countable.

reader to show that the function f (n) = n/2 when n is even and f (n) = −(n − 1)/2 when nis odd is such a function. Consequently, the set of all integers is countable. ▲

It is not surprising that the set of odd integers and the set of all integers are both countablesets (as shown in Examples 1 and 3). Many people are amazed to learn that the set of rationalnumbers is countable, as Example 4 demonstrates.

EXAMPLE 4 Show that the set of positive rational numbers is countable.

Solution: It may seem surprising that the set of positive rational numbers is countable, but wewill show how we can list the positive rational numbers as a sequence r1, r2, . . . , rn, . . . . First,note that every positive rational number is the quotient p/q of two positive integers. We canarrange the positive rational numbers by listing those with denominator q = 1 in the first row,those with denominator q = 2 in the second row, and so on, as displayed in Figure 3.

The key to listing the rational numbers in a sequence is to first list the positive rationalnumbers p/q with p + q = 2, followed by those with p + q = 3, followed by those withp + q = 4, and so on, following the path shown in Figure 3. Whenever we encounter a numberp/q that is already listed, we do not list it again. For example, when we come to 2/2 = 1 wedo not list it because we have already listed 1/1 = 1. The initial terms in the list of positiverational numbers we have constructed are 1, 1/2, 2, 3, 1/3, 1/4, 2/3, 3/2, 4, 5, and so on. Thesenumbers are shown circled; the uncircled numbers in the list are those we leave out becausethey are already listed. Because all positive rational numbers are listed once, as the reader canverify, we have shown that the set of positive rational numbers is countable. ▲

An Uncountable SetNot all infinite sets havethe same size! We have seen that the set of positive rational numbers is a countable set. Do we have a promising

candidate for an uncountable set? The first place we might look is the set of real numbers. InExample 5 we use an important proof method, introduced in 1879 by Georg Cantor and knownas the Cantor diagonalization argument, to prove that the set of real numbers is not countable.This proof method is used extensively in mathematical logic and in the theory of computation.

EXAMPLE 5 Show that the set of real numbers is an uncountable set.

Solution: To show that the set of real numbers is uncountable, we suppose that the set of realnumbers is countable and arrive at a contradiction. Then, the subset of all real numbers thatfall between 0 and 1 would also be countable (because any subset of a countable set is also

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 5 / 13

Page 21: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

The positive rational numbers are countableConstruct a bijection f : Z+ → Q+

List fractions p/q with q = n in the nth row

f traverses this list in the order for m = 2,3,4, . . . visiting all p/q withp + q = m (and listing only new rationals)

P1: 1

CH02 Rosen-2311T rosen.cls July 9, 2012 14:50

172 2 / Basic Structures: Sets, Functions, Sequences, Sums, and Matrices

11

12

13

14

15

21

22

23

24

25

31

32

3

3

3

4

35

41

42

43

44

45

51

52

53

54

55

...

...

...

...

...

...............

Terms not circledare not listedbecause theyrepeat previouslylisted terms

FIGURE 3 The Positive Rational Numbers Are Countable.

reader to show that the function f (n) = n/2 when n is even and f (n) = −(n − 1)/2 when nis odd is such a function. Consequently, the set of all integers is countable. ▲

It is not surprising that the set of odd integers and the set of all integers are both countablesets (as shown in Examples 1 and 3). Many people are amazed to learn that the set of rationalnumbers is countable, as Example 4 demonstrates.

EXAMPLE 4 Show that the set of positive rational numbers is countable.

Solution: It may seem surprising that the set of positive rational numbers is countable, but wewill show how we can list the positive rational numbers as a sequence r1, r2, . . . , rn, . . . . First,note that every positive rational number is the quotient p/q of two positive integers. We canarrange the positive rational numbers by listing those with denominator q = 1 in the first row,those with denominator q = 2 in the second row, and so on, as displayed in Figure 3.

The key to listing the rational numbers in a sequence is to first list the positive rationalnumbers p/q with p + q = 2, followed by those with p + q = 3, followed by those withp + q = 4, and so on, following the path shown in Figure 3. Whenever we encounter a numberp/q that is already listed, we do not list it again. For example, when we come to 2/2 = 1 wedo not list it because we have already listed 1/1 = 1. The initial terms in the list of positiverational numbers we have constructed are 1, 1/2, 2, 3, 1/3, 1/4, 2/3, 3/2, 4, 5, and so on. Thesenumbers are shown circled; the uncircled numbers in the list are those we leave out becausethey are already listed. Because all positive rational numbers are listed once, as the reader canverify, we have shown that the set of positive rational numbers is countable. ▲

An Uncountable SetNot all infinite sets havethe same size! We have seen that the set of positive rational numbers is a countable set. Do we have a promising

candidate for an uncountable set? The first place we might look is the set of real numbers. InExample 5 we use an important proof method, introduced in 1879 by Georg Cantor and knownas the Cantor diagonalization argument, to prove that the set of real numbers is not countable.This proof method is used extensively in mathematical logic and in the theory of computation.

EXAMPLE 5 Show that the set of real numbers is an uncountable set.

Solution: To show that the set of real numbers is uncountable, we suppose that the set of realnumbers is countable and arrive at a contradiction. Then, the subset of all real numbers thatfall between 0 and 1 would also be countable (because any subset of a countable set is also

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 5 / 13

Page 22: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

The positive rational numbers are countableConstruct a bijection f : Z+ → Q+

List fractions p/q with q = n in the nth row

f traverses this list in the order for m = 2,3,4, . . . visiting all p/q withp + q = m (and listing only new rationals)

P1: 1

CH02 Rosen-2311T rosen.cls July 9, 2012 14:50

172 2 / Basic Structures: Sets, Functions, Sequences, Sums, and Matrices

11

12

13

14

15

21

22

23

24

25

31

32

3

3

3

4

35

41

42

43

44

45

51

52

53

54

55

...

...

...

...

...

...............

Terms not circledare not listedbecause theyrepeat previouslylisted terms

FIGURE 3 The Positive Rational Numbers Are Countable.

reader to show that the function f (n) = n/2 when n is even and f (n) = −(n − 1)/2 when nis odd is such a function. Consequently, the set of all integers is countable. ▲

It is not surprising that the set of odd integers and the set of all integers are both countablesets (as shown in Examples 1 and 3). Many people are amazed to learn that the set of rationalnumbers is countable, as Example 4 demonstrates.

EXAMPLE 4 Show that the set of positive rational numbers is countable.

Solution: It may seem surprising that the set of positive rational numbers is countable, but wewill show how we can list the positive rational numbers as a sequence r1, r2, . . . , rn, . . . . First,note that every positive rational number is the quotient p/q of two positive integers. We canarrange the positive rational numbers by listing those with denominator q = 1 in the first row,those with denominator q = 2 in the second row, and so on, as displayed in Figure 3.

The key to listing the rational numbers in a sequence is to first list the positive rationalnumbers p/q with p + q = 2, followed by those with p + q = 3, followed by those withp + q = 4, and so on, following the path shown in Figure 3. Whenever we encounter a numberp/q that is already listed, we do not list it again. For example, when we come to 2/2 = 1 wedo not list it because we have already listed 1/1 = 1. The initial terms in the list of positiverational numbers we have constructed are 1, 1/2, 2, 3, 1/3, 1/4, 2/3, 3/2, 4, 5, and so on. Thesenumbers are shown circled; the uncircled numbers in the list are those we leave out becausethey are already listed. Because all positive rational numbers are listed once, as the reader canverify, we have shown that the set of positive rational numbers is countable. ▲

An Uncountable SetNot all infinite sets havethe same size! We have seen that the set of positive rational numbers is a countable set. Do we have a promising

candidate for an uncountable set? The first place we might look is the set of real numbers. InExample 5 we use an important proof method, introduced in 1879 by Georg Cantor and knownas the Cantor diagonalization argument, to prove that the set of real numbers is not countable.This proof method is used extensively in mathematical logic and in the theory of computation.

EXAMPLE 5 Show that the set of real numbers is an uncountable set.

Solution: To show that the set of real numbers is uncountable, we suppose that the set of realnumbers is countable and arrive at a contradiction. Then, the subset of all real numbers thatfall between 0 and 1 would also be countable (because any subset of a countable set is also

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 5 / 13

Page 23: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

The positive rational numbers are countableConstruct a bijection f : Z+ → Q+

List fractions p/q with q = n in the nth row

f traverses this list in the order for m = 2,3,4, . . . visiting all p/q withp + q = m (and listing only new rationals)

P1: 1

CH02 Rosen-2311T rosen.cls July 9, 2012 14:50

172 2 / Basic Structures: Sets, Functions, Sequences, Sums, and Matrices

11

12

13

14

15

21

22

23

24

25

31

32

3

3

3

4

35

41

42

43

44

45

51

52

53

54

55

...

...

...

...

...

...............

Terms not circledare not listedbecause theyrepeat previouslylisted terms

FIGURE 3 The Positive Rational Numbers Are Countable.

reader to show that the function f (n) = n/2 when n is even and f (n) = −(n − 1)/2 when nis odd is such a function. Consequently, the set of all integers is countable. ▲

It is not surprising that the set of odd integers and the set of all integers are both countablesets (as shown in Examples 1 and 3). Many people are amazed to learn that the set of rationalnumbers is countable, as Example 4 demonstrates.

EXAMPLE 4 Show that the set of positive rational numbers is countable.

Solution: It may seem surprising that the set of positive rational numbers is countable, but wewill show how we can list the positive rational numbers as a sequence r1, r2, . . . , rn, . . . . First,note that every positive rational number is the quotient p/q of two positive integers. We canarrange the positive rational numbers by listing those with denominator q = 1 in the first row,those with denominator q = 2 in the second row, and so on, as displayed in Figure 3.

The key to listing the rational numbers in a sequence is to first list the positive rationalnumbers p/q with p + q = 2, followed by those with p + q = 3, followed by those withp + q = 4, and so on, following the path shown in Figure 3. Whenever we encounter a numberp/q that is already listed, we do not list it again. For example, when we come to 2/2 = 1 wedo not list it because we have already listed 1/1 = 1. The initial terms in the list of positiverational numbers we have constructed are 1, 1/2, 2, 3, 1/3, 1/4, 2/3, 3/2, 4, 5, and so on. Thesenumbers are shown circled; the uncircled numbers in the list are those we leave out becausethey are already listed. Because all positive rational numbers are listed once, as the reader canverify, we have shown that the set of positive rational numbers is countable. ▲

An Uncountable SetNot all infinite sets havethe same size! We have seen that the set of positive rational numbers is a countable set. Do we have a promising

candidate for an uncountable set? The first place we might look is the set of real numbers. InExample 5 we use an important proof method, introduced in 1879 by Georg Cantor and knownas the Cantor diagonalization argument, to prove that the set of real numbers is not countable.This proof method is used extensively in mathematical logic and in the theory of computation.

EXAMPLE 5 Show that the set of real numbers is an uncountable set.

Solution: To show that the set of real numbers is uncountable, we suppose that the set of realnumbers is countable and arrive at a contradiction. Then, the subset of all real numbers thatfall between 0 and 1 would also be countable (because any subset of a countable set is also

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 5 / 13

Page 24: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Countable sets

TheoremIf A and B are countable sets, then A ∪ B is countable

Proof in book

TheoremIf I is countable and for each i ∈ I the set Ai is countable then

⋃i∈I Ai is

countable

Proof in book

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 6 / 13

Page 25: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Countable sets

TheoremIf A and B are countable sets, then A ∪ B is countable

Proof in book

TheoremIf I is countable and for each i ∈ I the set Ai is countable then

⋃i∈I Ai is

countable

Proof in book

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 6 / 13

Page 26: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Countable sets

TheoremIf A and B are countable sets, then A ∪ B is countable

Proof in book

TheoremIf I is countable and for each i ∈ I the set Ai is countable then

⋃i∈I Ai is

countable

Proof in book

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 6 / 13

Page 27: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Countable sets

TheoremIf A and B are countable sets, then A ∪ B is countable

Proof in book

TheoremIf I is countable and for each i ∈ I the set Ai is countable then

⋃i∈I Ai is

countable

Proof in book

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 6 / 13

Page 28: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Finite stringsTheoremThe set Σ∗ of all finite strings over a finite alphabet Σ is countablyinfinite

Proof.First define an (alphabetical) ordering on the symbols in ΣShow that the strings can be listed in a sequence

I First single string ε of length 0I Then all strings of length 1 in lexicographic orderI Then all strings of length 2 in lexicographic order

I...

I...

Each of these sets is countable; so is their union Σ∗

The set of Java-programs is countable; a program is just a finite string

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 7 / 13

Page 29: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Finite stringsTheoremThe set Σ∗ of all finite strings over a finite alphabet Σ is countablyinfinite

Proof.First define an (alphabetical) ordering on the symbols in ΣShow that the strings can be listed in a sequence

I First single string ε of length 0I Then all strings of length 1 in lexicographic orderI Then all strings of length 2 in lexicographic order

I...

I...

Each of these sets is countable; so is their union Σ∗

The set of Java-programs is countable; a program is just a finite string

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 7 / 13

Page 30: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Finite stringsTheoremThe set Σ∗ of all finite strings over a finite alphabet Σ is countablyinfinite

Proof.First define an (alphabetical) ordering on the symbols in ΣShow that the strings can be listed in a sequence

I First single string ε of length 0I Then all strings of length 1 in lexicographic orderI Then all strings of length 2 in lexicographic order

I...

I...

Each of these sets is countable; so is their union Σ∗

The set of Java-programs is countable; a program is just a finite string

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 7 / 13

Page 31: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Finite stringsTheoremThe set Σ∗ of all finite strings over a finite alphabet Σ is countablyinfinite

Proof.First define an (alphabetical) ordering on the symbols in ΣShow that the strings can be listed in a sequence

I First single string ε of length 0I Then all strings of length 1 in lexicographic orderI Then all strings of length 2 in lexicographic order

I...

I...

Each of these sets is countable; so is their union Σ∗

The set of Java-programs is countable; a program is just a finite stringColin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 7 / 13

Page 32: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Infinite binary strings

An infinite length string of bits 10010 . . .

Such a string is a function d : Z+ → {0,1}

With the property dm = d(m) is the mth symbol

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 8 / 13

Page 33: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Infinite binary strings

An infinite length string of bits 10010 . . .

Such a string is a function d : Z+ → {0,1}

With the property dm = d(m) is the mth symbol

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 8 / 13

Page 34: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Infinite binary strings

An infinite length string of bits 10010 . . .

Such a string is a function d : Z+ → {0,1}

With the property dm = d(m) is the mth symbol

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 8 / 13

Page 35: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Uncountable sets

TheoremThe set of infinite binary strings is uncountable

Proof.Let X be the set of infinite binary strings. For a contradiction assumethat a bijection f : Z+ → X exists. So, f must be onto (surjective).Assume that f (i) = d i for i ∈ Z+. So, X = {d1,d2, . . . ,dm, . . .}. Definethe infinite binary string d as follows: dn = (dn

n + 1) mod 2. But foreach m, d 6= dm because dm 6= dm

m . So, f is not a surjection.

The technique used here is called diagonalization

Similar argument shows that R via [0,1] is uncountable using infinitedecimal strings (see book)

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 9 / 13

Page 36: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Uncountable sets

TheoremThe set of infinite binary strings is uncountable

Proof.Let X be the set of infinite binary strings. For a contradiction assumethat a bijection f : Z+ → X exists. So, f must be onto (surjective).Assume that f (i) = d i for i ∈ Z+. So, X = {d1,d2, . . . ,dm, . . .}. Definethe infinite binary string d as follows: dn = (dn

n + 1) mod 2. But foreach m, d 6= dm because dm 6= dm

m . So, f is not a surjection.

The technique used here is called diagonalization

Similar argument shows that R via [0,1] is uncountable using infinitedecimal strings (see book)

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 9 / 13

Page 37: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Uncountable sets

TheoremThe set of infinite binary strings is uncountable

Proof.Let X be the set of infinite binary strings. For a contradiction assumethat a bijection f : Z+ → X exists. So, f must be onto (surjective).Assume that f (i) = d i for i ∈ Z+. So, X = {d1,d2, . . . ,dm, . . .}. Definethe infinite binary string d as follows: dn = (dn

n + 1) mod 2. But foreach m, d 6= dm because dm 6= dm

m . So, f is not a surjection.

The technique used here is called diagonalization

Similar argument shows that R via [0,1] is uncountable using infinitedecimal strings (see book)

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 9 / 13

Page 38: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Uncountable sets

TheoremThe set of infinite binary strings is uncountable

Proof.Let X be the set of infinite binary strings. For a contradiction assumethat a bijection f : Z+ → X exists. So, f must be onto (surjective).Assume that f (i) = d i for i ∈ Z+. So, X = {d1,d2, . . . ,dm, . . .}. Definethe infinite binary string d as follows: dn = (dn

n + 1) mod 2. But foreach m, d 6= dm because dm 6= dm

m . So, f is not a surjection.

The technique used here is called diagonalization

Similar argument shows that R via [0,1] is uncountable using infinitedecimal strings (see book)

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 9 / 13

Page 39: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Uncountable sets

TheoremThe set of infinite binary strings is uncountable

Proof.Let X be the set of infinite binary strings. For a contradiction assumethat a bijection f : Z+ → X exists. So, f must be onto (surjective).Assume that f (i) = d i for i ∈ Z+. So, X = {d1,d2, . . . ,dm, . . .}. Definethe infinite binary string d as follows: dn = (dn

n + 1) mod 2. But foreach m, d 6= dm because dm 6= dm

m . So, f is not a surjection.

The technique used here is called diagonalization

Similar argument shows that R via [0,1] is uncountable using infinitedecimal strings (see book)

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 9 / 13

Page 40: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

More on the uncountable

CorollaryThe set of functions F = {f | f : Z→ Z} is uncountable

The set of functions C = {f | f : Z→ Z is computable} is countable

Therefore, “most functions” in F are not computable!

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 10 / 13

Page 41: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

More on the uncountable

CorollaryThe set of functions F = {f | f : Z→ Z} is uncountable

The set of functions C = {f | f : Z→ Z is computable} is countable

Therefore, “most functions” in F are not computable!

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 10 / 13

Page 42: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

More on the uncountable

CorollaryThe set of functions F = {f | f : Z→ Z} is uncountable

The set of functions C = {f | f : Z→ Z is computable} is countable

Therefore, “most functions” in F are not computable!

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 10 / 13

Page 43: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Schröder-Bernstein Theorem

TheoremIf |A| ≤ |B| and |B| ≤ |A| then |A| = |B|

Example |(0,1)| = |(0,1]||(0,1)| ≤ |(0,1]| using identity function|(0,1]| ≤ |(0,1)| use f (x) = x/2 as (0,1/2] ⊂ (0,1)

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 11 / 13

Page 44: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Schröder-Bernstein Theorem

TheoremIf |A| ≤ |B| and |B| ≤ |A| then |A| = |B|

Example |(0,1)| = |(0,1]|

|(0,1)| ≤ |(0,1]| using identity function|(0,1]| ≤ |(0,1)| use f (x) = x/2 as (0,1/2] ⊂ (0,1)

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 11 / 13

Page 45: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Schröder-Bernstein Theorem

TheoremIf |A| ≤ |B| and |B| ≤ |A| then |A| = |B|

Example |(0,1)| = |(0,1]||(0,1)| ≤ |(0,1]| using identity function

|(0,1]| ≤ |(0,1)| use f (x) = x/2 as (0,1/2] ⊂ (0,1)

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 11 / 13

Page 46: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Schröder-Bernstein Theorem

TheoremIf |A| ≤ |B| and |B| ≤ |A| then |A| = |B|

Example |(0,1)| = |(0,1]||(0,1)| ≤ |(0,1]| using identity function|(0,1]| ≤ |(0,1)| use f (x) = x/2 as (0,1/2] ⊂ (0,1)

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 11 / 13

Page 47: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Cantor’s theorem

Theorem|A| < |P(A)|

Proof.Consider the injection f : A→ P(A) with f (a) = {a} for any a ∈ A.Therefore, |A| ≤ |P(A)|. Next we show there is not a surjectionf : A→ P(A). For a contradiction, assume that a surjection f exists.We define the set B ⊆ A: B = {x ∈ A | x 6∈ f (x)}. Since f is asurjection, there must exist an a ∈ A s.t. B = f (a). Now there are twocases:

1 If a ∈ B then, by definition of B, a 6∈ B = f (a). Contradiction2 If a 6∈ B then a 6∈ f (a); by definition of B, a ∈ B. Contradiction

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 12 / 13

Page 48: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Cantor’s theorem

Theorem|A| < |P(A)|

Proof.Consider the injection f : A→ P(A) with f (a) = {a} for any a ∈ A.Therefore, |A| ≤ |P(A)|. Next we show there is not a surjectionf : A→ P(A). For a contradiction, assume that a surjection f exists.We define the set B ⊆ A: B = {x ∈ A | x 6∈ f (x)}. Since f is asurjection, there must exist an a ∈ A s.t. B = f (a). Now there are twocases:

1 If a ∈ B then, by definition of B, a 6∈ B = f (a). Contradiction2 If a 6∈ B then a 6∈ f (a); by definition of B, a ∈ B. Contradiction

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 12 / 13

Page 49: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Implications of Cantor’s theorem

P(N) is not countable (in fact, |P(N)| = |R|)

The Continuum Hypothesis claims there is no set S with|N| < |S| < |R|It was 1st of Hilbert’s 23 open problems presented in 1900.Shown to be independent of ZF set theory by Gödel/Cohen in1963: cannot be proven/disproven in ZFThere exists an infinite hierarchy of sets of ever larger cardinalityS0 = N and Si+1 = P(Si)

|S0| < |S1| < . . . < |Si | < |Si+1| < . . .

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 13 / 13

Page 50: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Implications of Cantor’s theorem

P(N) is not countable (in fact, |P(N)| = |R|)The Continuum Hypothesis claims there is no set S with|N| < |S| < |R|

It was 1st of Hilbert’s 23 open problems presented in 1900.Shown to be independent of ZF set theory by Gödel/Cohen in1963: cannot be proven/disproven in ZFThere exists an infinite hierarchy of sets of ever larger cardinalityS0 = N and Si+1 = P(Si)

|S0| < |S1| < . . . < |Si | < |Si+1| < . . .

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 13 / 13

Page 51: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Implications of Cantor’s theorem

P(N) is not countable (in fact, |P(N)| = |R|)The Continuum Hypothesis claims there is no set S with|N| < |S| < |R|It was 1st of Hilbert’s 23 open problems presented in 1900.Shown to be independent of ZF set theory by Gödel/Cohen in1963: cannot be proven/disproven in ZF

There exists an infinite hierarchy of sets of ever larger cardinalityS0 = N and Si+1 = P(Si)

|S0| < |S1| < . . . < |Si | < |Si+1| < . . .

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 13 / 13

Page 52: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Implications of Cantor’s theorem

P(N) is not countable (in fact, |P(N)| = |R|)The Continuum Hypothesis claims there is no set S with|N| < |S| < |R|It was 1st of Hilbert’s 23 open problems presented in 1900.Shown to be independent of ZF set theory by Gödel/Cohen in1963: cannot be proven/disproven in ZFThere exists an infinite hierarchy of sets of ever larger cardinality

S0 = N and Si+1 = P(Si)

|S0| < |S1| < . . . < |Si | < |Si+1| < . . .

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 13 / 13

Page 53: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Implications of Cantor’s theorem

P(N) is not countable (in fact, |P(N)| = |R|)The Continuum Hypothesis claims there is no set S with|N| < |S| < |R|It was 1st of Hilbert’s 23 open problems presented in 1900.Shown to be independent of ZF set theory by Gödel/Cohen in1963: cannot be proven/disproven in ZFThere exists an infinite hierarchy of sets of ever larger cardinalityS0 = N and Si+1 = P(Si)

|S0| < |S1| < . . . < |Si | < |Si+1| < . . .

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 13 / 13

Page 54: Discrete Mathematics & Mathematical Reasoning Cardinality · Finite and infinite sets A = f1;2;3gis a finite set with 3 elements B = fa;b;c;dgand C = f1;2;3;4gare finite sets with

Implications of Cantor’s theorem

P(N) is not countable (in fact, |P(N)| = |R|)The Continuum Hypothesis claims there is no set S with|N| < |S| < |R|It was 1st of Hilbert’s 23 open problems presented in 1900.Shown to be independent of ZF set theory by Gödel/Cohen in1963: cannot be proven/disproven in ZFThere exists an infinite hierarchy of sets of ever larger cardinalityS0 = N and Si+1 = P(Si)

|S0| < |S1| < . . . < |Si | < |Si+1| < . . .

Colin Stirling (Informatics) Discrete Mathematics (Section 2.5) Today 13 / 13