Chapter 7 Functions In Laymans terms A function

  • Slides: 80
Download presentation
Chapter 7 Functions

Chapter 7 Functions

In Layman’s terms A function f from a set X to another set Y

In Layman’s terms A function f from a set X to another set Y is a recipe that tells you how to convert an input number x to the output number y. Usually such a recipe is expressed in a formula, but we also have: Function defined by arrow diagrams f X a b c 1 2 3 4 Note: this method works only for finite sets. Y

Arrow diagram of a function with animation. 2 a b c d e 3

Arrow diagram of a function with animation. 2 a b c d e 3 5 8 13 19 26

The following diagram does not represent a function, do you know why? 2 a

The following diagram does not represent a function, do you know why? 2 a b c d e 3 5 8 13 19 26

Function as a set a A f b c d e 2 3 5

Function as a set a A f b c d e 2 3 5 8 13 B 19 26 The above function is defined as a set of ordered pairs: f = {(a, 5), (b, 26), (c, 2), (d, 8), (e, 13)} and this set is a subset of A×B

7. 1 Functions Defined on General Sets Definition: Given any two sets X and

7. 1 Functions Defined on General Sets Definition: Given any two sets X and Y, a function f from X to Y is a subset of the Cartesian product X ×Y such that (a) for every a X, there is one y Y such that (a, y) f (b) if (a, y) f and (a, z) f , then y = z (in other words, there is one and only one output for each input) The set X is called the domain of f , Y is called the codomain, and range of f = {b Y : b = f (a) for some a X} Given any b Y, inverse image of b = f -1(b) = {a X : f (a) = b} and this set can be empty.

Equality of Functions: Suppose that both f and g are functions from X to

Equality of Functions: Suppose that both f and g are functions from X to Y, then we say that f is equal to g, written f = g if and only if for every a X, f (a) = g(a) Example: f (x) = (x 2 + x + 1) mod 3, g(x) = (x + 2)2 mod 3 They are equal on the domain of integers.

Functions Defined by Formulas Examples: f (x) = 3 x 2 + 5 for

Functions Defined by Formulas Examples: f (x) = 3 x 2 + 5 for every x in . g(x) = exsinx for every x in . These functions can also be (partially) represented by graphs instead of arrow diagrams. 7 6 5 4 3 2 1 -5 -4 -3 x -2 -1 00 -1 1 2 3

In 1872, Weierstrass published a paper that states that the following function is continuous

In 1872, Weierstrass published a paper that states that the following function is continuous but nowhere differentiable. (remark: He actually published a more general result. )

Space Filling Curve In 1890, Giuseppe Peano discovered a continuous function from [0, 1]

Space Filling Curve In 1890, Giuseppe Peano discovered a continuous function from [0, 1] onto the unit square [0, 1] ×[0, 1]. However, this function cannot be one-to-one. The following function is due to David Hilbert, only the 1 st 6 iterations are shown, the final function is the limit of these iterations.

Sequences as Functions Any infinite sequence of real numbers is actually a function from

Sequences as Functions Any infinite sequence of real numbers is actually a function from the natural numbers N to the real numbers . Some of these can be defined by a formula. For example, the infinite sequence is a function f: N which can be defined by where N = {0, 1, 2, 3, 4, 5, … }

A Function defined on a Power set.

A Function defined on a Power set.

Functions defined on the set of bit strings Let Σ = {0, 1} and

Functions defined on the set of bit strings Let Σ = {0, 1} and Σ* be the set of all finite strings over Σ. (1) Define g: Σ* → Σ* by g(s) = the reverse of s from right to left. eg. g(10111) = 11101 (2) Define f: Σ* × Σ* → Σ* by f(s, t) = the concatenation of s followed by t. eg. f (000, 1101) = 0001101

Check digit functions The last digit of each UPC or ISBN is always created

Check digit functions The last digit of each UPC or ISBN is always created to catch errors. In other words, there is a formula to compute the last digit using all but the last digit as input. If this last digit does not match the formula, we know that the number must be wrong. Example: 1. In the UPC 0 -53607 -10054 -3, the last digit 3 is chosen such that 0× 3 + 5× 1 + 3× 3 + 6× 1 + 0× 3 + 7× 1 + 1× 3 + 0× 1 + 0× 3 + 5× 1 + 4× 3 + 3× 1 is divisible by 10. In dot product notation, this can be written as [(0, 5, 3, 6, 0, 7, 1, 0, 0, 5, 4, 0) (3, 1, 3, 1, 3, 1)] mod 10 = 0

Example: 1. In the UPC 0 -53607 -10054 -3, the last digit 3 is

Example: 1. In the UPC 0 -53607 -10054 -3, the last digit 3 is chosen such that 0× 3 + 5× 1 + 3× 3 + 6× 1 + 0× 3 + 7× 1 + 1× 3 + 0× 1 + 0× 3 + 5× 1 + 4× 3 + 3× 1 is divisible by 10. In dot product notation, this can be written as [(0, 5, 3, 6, 0, 7, 1, 0, 0, 5, 4, 0) (3, 1, 3, 1, 3, 1)] mod 10 = 0 The formula to compute the check digit is {10 - [(a 1, a 2, a 3, a 4, a 5, a 6, a 7, a 8, a 9, a 10, a 11) (3, 1, 3, 1, 3)] mod 10} mod 10

2. Each ISBN is a 10 digit number such as 0 -88385 -720 -0.

2. Each ISBN is a 10 digit number such as 0 -88385 -720 -0. The last digit a 10 is chosen such that [(0, 8, 8, 3, 8, 5, 7, 2, 0, a 10) (10, 9, 8, 7, 6, 5, 4, 3, 2, 1)] mod 11 = 0 In this case, a 10 = 0 will work. And if a 10 = 10, we use the letter X instead. In both examples, we see that there is always at most one output from each input, these procedures of generating check digits are functions even though the second one cannot be expressed by a formula.

Coding Functions Digital messages are finite sequences of 0’s and 1’s. These are called

Coding Functions Digital messages are finite sequences of 0’s and 1’s. These are called binary sequences When they are communicated across a transmission channel, they are frequently coded in special ways to either 1. Correct interfering noise (error correction) 2. Reduce data size (data compression) 3. Protect privacy (encryption) 4. We only have time to briefly look at the first application.

Error Correction Codes The simplest way to encode a digital message for error detection

Error Correction Codes The simplest way to encode a digital message for error detection and correction is to repeat each digit multiple times. For example, we can repeat each digit 3 times. i. e. the message 00101111 will be encoded as 00000011111111 This encoding process is a function E from the set A (of all finite binary strings) to the set T (of all binary strings with consecutive triples of identical bits) E(s) = the string obtained from s by replacing each bit of s by the same bit written 3 times Unfortunately this method is highly inefficient, and hence has no practical value.

A Better Error Correcting Code Hamming [7, 4, 3] binary linear code. (1950) This

A Better Error Correcting Code Hamming [7, 4, 3] binary linear code. (1950) This is the first practical error detecting code (cannot correct error yet). Each input is a binary sting of length 4, and the function will add 3 check digits at the end and make the output a string of length 7. input output 0000000 0001111 0010011 0100101 1000110 input output 1100011 1010101 …. etc. It can detect up to 2 errors out of the 7 bits, but cannot correct it.

How does the Hamming Code work? If d 1, d 2, d 3, d

How does the Hamming Code work? If d 1, d 2, d 3, d 4 are the input signals, then where p 1 is chosen such that d 1 + d 2 + d 4 + p 1 = even; p 2 is chosen such that d 1 + d 3 + d 4 + p 2 = even; p 3 is chosen such that d 2 + d 3 + d 4 + p 3 = even. There is no easy formula for this process, but nevertheless, this process is a function.

Reed-Solomon Codes (1960) The commercially used version for CD’s, DVD’s, cell phones etc. is

Reed-Solomon Codes (1960) The commercially used version for CD’s, DVD’s, cell phones etc. is the [255, 223, 33]-code, in which (i) Every codeword is a 255 -byte string, hence 2040 bits. (ii) In each codeword, 223 bytes are from the original message (others are check digits) (iii) It can correct up to 16 incorrect bytes (i. e. 16× 8 bits in a row in the best case, and 16 bits in 16 different bytes in the worst case. )

Exercise Let f be a function from to such that whenever x 1. f(1)

Exercise Let f be a function from to such that whenever x 1. f(1) is defined separately, but you don’t need to know. Find the value of

“Functions” that are not Well-defined Sometimes the definition is not properly written, hence the

“Functions” that are not Well-defined Sometimes the definition is not properly written, hence the “function” will not be a function at all. Example 1 Let f: be defined by f(x) = “the number y such that x 2 + y 2 = 4” Then this is not well-defined because there may be more than one such y. Example 2 Let f: Q Z be defined by

Finite-State Automata A finite state automaton is a machine that can make a few

Finite-State Automata A finite state automaton is a machine that can make a few decisions, but it is much weaker than a computer because it does not have an expandable memory and it can only run one predetermined program. Examples: Vending machines,

Finite-State Automaton Definition: A finite-state automaton consists of five objects 1. a set I

Finite-State Automaton Definition: A finite-state automaton consists of five objects 1. a set I called the input alphabet, of input symbol; 2. a set S of states the automaton can be in; 3. a designate state s 0 , called the initial state; 4. a designate set of states called the set of accepting states 5. a next-state function N : S × I S

Finite-State Automaton Simple Vending Machine – accepts only 25¢ or 50¢ - gives a

Finite-State Automaton Simple Vending Machine – accepts only 25¢ or 50¢ - gives a bottle of soda for $1 - does not return changes 25¢ desposited 50¢ ¢ 25 25¢ 0¢ desposited 50¢ 75¢ desposited 50¢ desposited 25 ¢ 50¢ $1 or more desposited 50¢

The Next-State Table Original State Input Quarter Half-Dollar 0¢ deposited 25¢ deposited 50¢ deposited

The Next-State Table Original State Input Quarter Half-Dollar 0¢ deposited 25¢ deposited 50¢ deposited 75¢ deposited Accept 25¢ deposited 50¢ deposited Accept Next State in blue

Examples: 1. Construct a finite state automaton that accepts exactly the set of strings

Examples: 1. Construct a finite state automaton that accepts exactly the set of strings of 0’s and 1’s that start with the pattern 110. 2. Construct a finite state automaton that accepts exactly the set of strings of 0’s and 1’s for which the number of 1’s is divisible by 3. 3. Construct a finite state automaton that accepts exactly the set of strings of 0’s and 1’s that do not contain the pattern 1011.

Question For any given set A of strings of 0’s and 1’s, can we

Question For any given set A of strings of 0’s and 1’s, can we build a finite-state automaton that accepts exactly the strings in the set A? In particular, can we build one machine that accepts exactly those strings where the number of 0’s is equal to the number of 1’s? And can we build one machine that accepts exactly those strings that are palindromes? (eg. 0110110)

7. 2 1 -to-1, Onto, and Inverse functions Definition: Let F be a function

7. 2 1 -to-1, Onto, and Inverse functions Definition: Let F be a function from a set X to a set Y. F is one-to-one (or injective) if, for all elements x 1 and x 2 in X Or equivalently,

This is a one-to-one function. 2 a b 3 5 8 c d e

This is a one-to-one function. 2 a b 3 5 8 c d e 13 19 26 This is not a one-to-one function. 2 a b 3 5 8 c d e 13 19 26 We can call this a many-to-one function.

The Horizontal Line Test This function does not pass the horizontal line test, hence

The Horizontal Line Test This function does not pass the horizontal line test, hence it is not one-to-one. More precisely, we should say that “the graph of this function” does not pass the horizontal line test.

1 0. 5 -4 0 -2 0 2 x 4 -0. 5 -1 The

1 0. 5 -4 0 -2 0 2 x 4 -0. 5 -1 The arctan function will pass the horizontal line test.

All exponential functions (with base other than 1) are one-to-one because their graphs all

All exponential functions (with base other than 1) are one-to-one because their graphs all pass the horizontal line test. All logarithmic functions (with base other than 1) are one-to-one because their graphs all pass the horizontal line test.

Different ways to check that a function is one-to-one Let f be a function

Different ways to check that a function is one-to-one Let f be a function from a connected interval in to . Then f is one-to-one if either of the following is true. 1. The graph of f passes the horizontal line test. 2. f is strictly increasing or strictly decreasing. 3. If f is differentiable, then f is one-to-one if f ’(x) > 0 for all x OR if f ’(x) < 0 for all x in the domain of f. If f is defined on other domains, we have to use the definition to prove “one-to-one”ness, or we can construct an inverse for f.

Examples 1. The identity function id: defined by id (x) = x is one-to-one

Examples 1. The identity function id: defined by id (x) = x is one-to-one 2. Any linear function f(x) = ax + b with a ≠ 0 is one-to-one from to . 3. The function f(x) = tan(x) is one-to-one from (- /2, /2) to .

Examples 4. Show that the function is one-to-one throughout its domain. 5. Let S

Examples 4. Show that the function is one-to-one throughout its domain. 5. Let S be the set of all finite strings of a’s, b’s and c’s. Define C: S S by C(s) = a*s for all s S * is the concatenating operation, e. g. C(bbc) = abbc. Show that C is one-to-one.

6. Let S be the set of all finite strings of a’s, b’s and

6. Let S be the set of all finite strings of a’s, b’s and c’s. Define R: S S by R(s) = the reverse of s. for all s S R is called reversal function, e. g. R(abc) = cba. Show that R is one-to-one by finding an inverse of R.

Exercise Let f be a function from to such that whenever x 1. f(1)

Exercise Let f be a function from to such that whenever x 1. f(1) is defined separately, but you don’t need to know. Find the value of Is this function one-to-one?

Sets of Infinite Sequences Notations a. 2 is the set of all functions from

Sets of Infinite Sequences Notations a. 2 is the set of all functions from Z+ to 2 (which is the set {0, 1}) This is identified with the set of all infinite sequences of 0’s and 1’s. such as 0, 1, … or 0, 1, 1, 1, 0, … b. 10 is the set of all functions from Z+ to 10 (which is the set {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}) Similarly this is identified with the set of all infinite sequences of digits; such as 3, 2, 4, 8, 0, 5, 9, 1, … or 4, 2, 4, 2, …

More examples a. The embedding function I: 2 10 defined by I(s) = s

More examples a. The embedding function I: 2 10 defined by I(s) = s for every s 2 is one-to-one. b. We now try to construct a function G: 10 2 which is one-to-one.

Properties of One-to-one Functions. 1. If f(x): is one-to-one, and a, b, c are

Properties of One-to-one Functions. 1. If f(x): is one-to-one, and a, b, c are constants with a ≠ 0, b ≠ 0, then a·f(bx) + c is also one-to-one. 2. The composition of two or more one-to-one functions is also one-to-one. example: e sin(x) is one-to-one on the domain (-π/2, π/2).

Onto functions Definition: Let F be a function from a set X to a

Onto functions Definition: Let F be a function from a set X to a set Y. F is onto (or surjective) if, range of F = Y Or equivalently,

This function is not onto. 2 a b 3 5 8 c d e

This function is not onto. 2 a b 3 5 8 c d e 13 19 26 This function is onto (even though not one-to-one). 3 a b 8 c d e 19

Unfortunately there is no standard method to check whether a function is onto or

Unfortunately there is no standard method to check whether a function is onto or not. Different functions may require different techniques. Sometime it can be very difficult. Example: The linear function f(x) = 4 x + 1 is onto. Proof: Given any real number y, we need to solve for x from the equation 4 x + 1 = y. Fortunately, this is very simple. We can see that x = (y – 1)/4. Hence this function is onto.

Example: The polynomial function p(x) = x 3 – 4 x + 2 (from

Example: The polynomial function p(x) = x 3 – 4 x + 2 (from to ) is onto. To prove this fact, we have to use theorem that every polynomial of odd degree and with real coefficients must have at least one real root. Hence for any real number y, we can solve x from the equation x 3 – 4 x + 2 = y Therefore p(x) is onto. Graphically, we can see that the polynomial curve intersects any horizontal line. Unfortunately, the graphical method is not reliable or not even feasible.

Whether a given function is onto or not onto depends on its codomain as

Whether a given function is onto or not onto depends on its codomain as well. If we can reduce the co-domain, we can make a function onto. Example: sinx: is not onto, but when we restrict the co-domain to [-1, 1], it will become onto.

The “onto” property can also be affected by the domain. Examples The function f:

The “onto” property can also be affected by the domain. Examples The function f: defined by f (x) = 4 x + 1 is onto, but the function f: Z+ defined by f (n) = 4 n + 1 is not onto.

More onto Functions Example: Let S be the set of all finite strings of

More onto Functions Example: Let S be the set of all finite strings of 0’s and 1’s. Suppose D: S Z is a function defined by D(s) = the number of 1’s in s – the number of 0’s in s Show that D is onto. Proof: Let n be an integer, we will consider 3 cases. (1) n = 0: let s = 10, then D(s) = 0 (2) n > 0: let s = 11… 1, a string of n 1’s. then D(s) = n (3) n < 0: let s = 00… 0, a string of n 0’s. Therefore, D is onto.

Example: Let f : be a function defined by f(x, y) = (x +

Example: Let f : be a function defined by f(x, y) = (x + y, x – y) Prove that f is onto. Proof: For any (u, v) in , we need to find (r, s) also in such that f(r, s) = (u, v) However, f(r, s) = (r + s, r – s), this means that r + s = u & r – s = v By solving for r and s, we find that Hence f is onto.

Proving a Function is not onto Let f : {-2} be defined by Prove

Proving a Function is not onto Let f : {-2} be defined by Prove that f is not onto. Proof: We shall show that for any real number x, f(x) cannot be 1. Suppose not, then . Consequently x + 1 = x + 2, which implies 1 = 2, which is wrong. Hence f cannot be onto.

The Hamming Coding Function is not onto Recall the Hamming [7, 4, 3] code,

The Hamming Coding Function is not onto Recall the Hamming [7, 4, 3] code, which is a function from {0, 1}4 to {0, 1}7. input output 0000000 0001111 0010011 0100101 1000110 input output 1100011 1010101 …. etc. This coding function is not onto, we can easily check that 0000001 is not a codeword. In fact, any coding function for error correction will be NOT onto by design because we need the room for error.

Theorem For any set S (finite or infinite), there is no onto function from

Theorem For any set S (finite or infinite), there is no onto function from S to (S). Proof: It is only necessary to consider the case where S is infinite, because if S is finite, we know that (S) has more elements. Assume to the contrary that there is a onto function f : S → (S) We then consider the subset A = { x S : x f(x) }

One-to-one Correspondence Definition: Let f be a function from a set X to a

One-to-one Correspondence Definition: Let f be a function from a set X to a set Y. If f is both one-to-one and onto, then we say that f is a bijection or a one-to-one correspondence between X and Y. Theorem: Suppose that f : X Y is a bijection, then there is a function f -1 : Y X defined by f -1 (y) = the unique element x in X such that f (x) = y Definition: The function f -1 defined above is called the inverse of f.

Inverse Functions Theorem: If X and Y are sets and f : X Y

Inverse Functions Theorem: If X and Y are sets and f : X Y is one-to-one and onto, then f -1 : Y X is also one-to-one and onto. The following theorem provides a very convenient way to prove that a function is one-to-one and onto. Theorem: Suppose that X and Y are sets and f : X Y is a function. If there is another function g : Y X such that g ◦ f = IX : X X then f is one-to-one and onto.

Special cases Suppose that both X and Y are finite sets and f :

Special cases Suppose that both X and Y are finite sets and f : X → Y is a function, (1) if n(X) > n(Y), then f cannot be one-to-one, (2) if n(X) < n(Y), then f cannot be onto, (3) if n(X) = n(Y), and f is one-to-one, then f is also onto, (4) if n(X) = n(Y), and f is onto, then f is also one-to-one.

Exercise Let f : R → R be a continuous but non-constant function that

Exercise Let f : R → R be a continuous but non-constant function that preserves addition and multiplication, i. e. f (x + y) = f (x) + f (y) and f (x · y) = f (x) f (y) Prove that f is one-to-one. Solution: We need to divide the proof into several steps. (1) prove that f (0) = 0 (2) prove that f (-x) = - f (x) (3) prove that f (x) = 0 implies that x = 0. (4) prove that f (x) = f (y) implies that x = y. In fact, we can prove (with more effort) that this f is actually the identity function, hence it is also onto.

7. 4 Cardinality with Applications Definition: A set S is called finite if there

7. 4 Cardinality with Applications Definition: A set S is called finite if there is no bijection between S and a proper subset of S. A set is called infinite if it is not finite. (In other words, a set S is infinite if we can construct a bijection from S to a proper subset of S. Example: The set of natural numbers N is infinite because we can construct the bijective function f(n) = n + 1 from N to a proper subset {1, 2, 3, 4, ··· } of N itself.

Theorem: For any function f from a finite set X to a finite set

Theorem: For any function f from a finite set X to a finite set Y, if n(X) > n(Y), then f cannot be one-to-one. This theorem is called the Pigeon hole Principle or the Dirichlet box principle. We shall study this principle in section 9. 4

7. 4 Cardinality and Applications Definition: Two sets A and B are said to

7. 4 Cardinality and Applications Definition: Two sets A and B are said to have the same cardinality i. e. card(A) = card(B) if and only if there is a bijection between them. Using the terminology of cardinality, we can redefine infinite sets. Definition: A set S is said to be infinite if S has at least one proper subset W such that card(W) = card(S) Examples card({0, 1, 2, 3, 4, 5, ··· }) = card ({0, 2, 4, 6, 8, ···}) = card ( )

Definition: Given any two sets A and B, we say that card(A) ≤ card(B)

Definition: Given any two sets A and B, we say that card(A) ≤ card(B) if there is a injection from A into B. Note: injection is another name for one-to-one function. Schröder-Bernstein Theorem Given two sets A and B, if card(A) ≤ card(B) and card(A) ≥ card(B), then card(A) = card(B). Note: this theorem confirms that cardinality is an extension of the concept of numbers, i. e. if x y and y x, then x = y.

Exercises 1. Show that the interval (0, 1) has the same cardinality as the

Exercises 1. Show that the interval (0, 1) has the same cardinality as the longer interval (5, 8). 2. Show that the interval (0, 1) has the same cardinality as the infinite interval (0, ∞). 3. Show that the interval (0, 1) has the same cardinality as the infinite interval (-∞, ∞). 4. Show that the closed interval [0, 1] has the same cardinality as the open interval (0, 1).

4. Show that the closed interval [0, 1] has the same cardinality as the

4. Show that the closed interval [0, 1] has the same cardinality as the open interval (0, 1). Solution: Consider the function It is not difficult to check that f is one-to-one and it maps [0, 1] onto (0, 1)

Theorem There is a one-to-one correspondence between the closed interval [0, 1] and the

Theorem There is a one-to-one correspondence between the closed interval [0, 1] and the closed square [0, 1]×[0, 1]. Proof: Let f : [0, 1] → [0, 1]×[0, 1] be defined by f (0. a 1 a 2 a 3 a 4 a 5 a 6…) = (0. a 1 a 3 a 5… , 0. a 2 a 4 a 6…) then f is bijective because it has an obvious inverse. (remark: we use infinite decimal expansion for every non-zero real number, e. g. 0. 5 = 0. 49999··· ) However, this function is not continuous.

Space Filling Curve In 1890, Giuseppe Peano discovered a continuous function from [0, 1]

Space Filling Curve In 1890, Giuseppe Peano discovered a continuous function from [0, 1] onto the unit square [0, 1] ×[0, 1]. However, this function cannot be one-to-one. The following shows only the first 3 iterations, the final function is the limit of these iterations.

Consequence of the Schröder-Bernstein Theorem card (2ω ) = card(10ω ) In other words,

Consequence of the Schröder-Bernstein Theorem card (2ω ) = card(10ω ) In other words, the set of infinite binary sequences has the same cardinality as the set of infinite decimal sequences. A binary sequence can only use the digits 0 and 1, an example is {1, 0, 1, 1, 1, 0, 0, 1, 0, … } A decimal sequence can use the ten digits 0 to 9, an example is {2, 5, 6, 0, 4, 3, 3, 7, 8, 4, 8, 9, 1, 2, … }

Theorem The set of real numbers has the same cardinality as the set S

Theorem The set of real numbers has the same cardinality as the set S = { x : 0 < x < 1} Proof: Consider the function which is one-to-one and maps (0, 1) exactly onto (-∞, ∞).

Countable Sets Definition: A set S is said to be countably infinite if it

Countable Sets Definition: A set S is said to be countably infinite if it has the same cardinality as the set of natural numbers N. A set S is said to be countable if it is either finite or countably infinite. Loosely speaking, a set is countable if you can put its elements in a linear order such that every elements has only finitely many predecessors. A set S is said to be uncountable if it is not countable.

Theorem (1) Any subset of a countable set is countable. (2) The union of

Theorem (1) Any subset of a countable set is countable. (2) The union of two countable sets is countable. (3) The Cartesian product of any two countable sets is countable. Examples: (a) The set Z of integers is countable. (b) The set Q of rational numbers is countable. Axiom of countable choice Any countable union of countable sets is countable. (Note: this axiom cannot be proved by ZF. )

Theorem The set Q+ of positive rational numbers is countable. Proof:

Theorem The set Q+ of positive rational numbers is countable. Proof:

Theorem The set of real numbers in the interval [0, 1] is uncountable. Proof:

Theorem The set of real numbers in the interval [0, 1] is uncountable. Proof: (Cantor Diagonalization method) By contradiction. Suppose that we can arrange those numbers in a sequence {a 1, a 2, a 3, } and since each number in the sequence is a decimal, we can write their decimal forms as a 1 = 0. a 11 a 12 a 13 a 14… a 2 = 0. a 21 a 22 a 23 a 24… a 3 = 0. a 31 a 32 a 33 a 34… … (here we use the non-terminating form if there are two choices, i. e. 1 = 0. 999…)

Next we construct a number b whose decimal form is b = 0. b

Next we construct a number b whose decimal form is b = 0. b 1 b 2 b 3 b 4… and such that bk = akk + 1 if akk < 9 and bk = 0 if akk = 9 Then b will be a real number between 0 and 1, but b is not equal to any of the numbers in the list {a 1, a 2, a 3, …}, a contradiction!

Definition of whole numbers The number 0 is defined as the empty set Ø.

Definition of whole numbers The number 0 is defined as the empty set Ø. The number 1 is defined as the set {Ø}. The number 2 is defined as the set {Ø} {{Ø}} = {Ø, {Ø}} = {0, 1} … … In general, the natural number n + 1 is defined as the set n {n} We can prove by induction that the set representing n has exactly n elements. Remark: Every natural number n (as a set) is transitive, i. e. every element in n is also a subset of n. In other words, n contains all the elements of its elements, etc.

Definition The first infinite ordinal number ω is defined to be the set {0,

Definition The first infinite ordinal number ω is defined to be the set {0, 1, 2, 3, } ω +1 is defined to be the 2 nd infinite ordinal number, and it is the set {0, 1, 2, 3, , ω} (note: there is no ω – 1 because ω is not constructed by adding just one more element to any set. ) ω + (n +1) is the set {0, 1, 2, 3, , ω, ω+1, ω+2, , ω+n} ω + ω is the set {0, 1, 2, 3, , ω, ω+1, ω+2, ω+3, }

Theorem ω + n is countable for any whole number n. ω + ω

Theorem ω + n is countable for any whole number n. ω + ω is countable. ω2 (= ω×ω) is countable. ωn is countable for any whole number n. ωω is uncountable. Definition 2ω is the set of all functions from ω to 2 (={0, 1}) ωω is the set of all functions from ω to ω. Theorem (a) card(2ω) = card( (ω)) (b) card(2ω) = card(ωω) (c) card( ) = card(2ω)

Old Theorem Revisit Theorem Given any set S, the power set (S) has a

Old Theorem Revisit Theorem Given any set S, the power set (S) has a strictly larger cardinality than S. This implies that we can construct sets with larger and larger cardinalities using power sets: S, (S), ( (S)), …

Comment Since any set obtained from ω using set operations other than power set

Comment Since any set obtained from ω using set operations other than power set is countable, Cantor conjectured the following Continuum Hypothesis There is no set whose cardinality is strictly between that of card(ω) and card( (ω)) It turns out that this hypothesis is independent of the ZFC axioms. (Paul Cohen, 1963) General Continuum Hypothesis For any infinite set X, there is no set whose cardinality is strictly between that of card(X) and card( (X))

Application in computer science Theorem Given any computer language, the set of programs in

Application in computer science Theorem Given any computer language, the set of programs in that language is countable. Corollary The set of computable functions from ω to ω is countable. But there are uncountably many functions from ω to ω. Hence there are uncountably many functions from ω to ω that are not computable (i. e. they cannot be generated by a computer program. ) This means computers can never take over the jobs of human.