Please copy and paste this embed script to where you want to embed

MATH1081 Discrete Mathematics

F. Kuo/T. Britz/D. Chan/D. Trenerry/C. Greenhill

§1 Sets, Functions, and Sequences SETS A set is a well-defined collection of distinct objects. An element of a set is any object in the set. ∈ - “belongs to” or “is an element of” or “is in” ∈ / - “does not belong to” or “is not an element of” or “is not in” The cardinality of a set S, denoted by |S|, is the number of elements in S. Example. Some commonly-used sets in our number system: N - the set of natural numbers 0, 1, 2, 3, . . . Z - the set of integers (whole numbers) . . . , −3, −2, −1, 0, 1, 2, 3, . . . Q - the set of rational numbers (fractions) . . . , −1, 0, 1, 2, 12 , 3, 31 , 23 , . . . R - the set of real numbers, which includes all rational √ numbers as well as irrational numbers such as π, e, and 2 R+ - the set of all positive real numbers Example. We can specify a set by listing its elements between curly brackets, separated by commas: S = {b, c} . The elements of S are b and c . Thus |S| = 2. We can write b ∈ S, c ∈ S, and d ∈ / S, for instance. Example. We can specify a set by some property that all elements must have: S = {x ∈ Z | x2 ≤ 4} (or S = {x ∈ Z : x2 ≤ 4} ) . The elements of S are −2, −1, 0, 1 and 2. Thus |S| = 5. Also S = {−2, −1, 0, 1, 2}. We can write −2 ∈ S, −1 ∈ S, 0 ∈ S, 1 ∈ S, and 4 ∈ / S, for instance. Exercise. Let A = {{a}, a}. What are the elements of A? What is |A|? The elements of A are a, {a}.

Note: A set within a set represents 1 element.

So |A| = 2.

E.g. if B = {a, {a, b}}, the elements of B are a, {a, b}. So |B| = 2.

Two sets S and T are equal, denoted by S = T , if and only if (written iff) (i) every element of S is also an element of T , and (ii) every element of T is also an element of S . i.e., when they have precisely the same elements. The empty set, denoted by ∅, is a set which has no elements. |∅| = 0. Exercise. Are any of the following sets equal? A = {2, 3, 4, 5}, C = {2, 2, 3, 3, 4, 5}, B = {5, 4, 3, 2}, D = {x ∈ N | 2 ≤ x ≤ 5}. They are all equal.

Exercise. What is the difference between the sets ∅, {∅} and {∅, {∅}}? - ∅ has no elements. - {∅} is a set containing just one element, namely, the empty set ∅. - {∅, {∅}} is a set containing two elements, namely, ∅ and {∅}.

Loosely speaking, a subset is a part of a set. More precisely, a set S is a subset of a set T if and only if each element of S is also an element of T. ⊆ - “is a subset of”,

6⊆ - “is not a subset of”

⋆ S = T if and only if S ⊆ T and T ⊆ S.

A set S is a proper subset of a set T iff S is a subset of T and S 6= T . We then write S ( T (or sometimes S ⊂ T ). ⋆ ∅ is a proper subset of any non-empty set. ⋆ Any non-empty set is an improper subset of itself. The power set P (S) of a set S is the set of all possible subsets of S. ⋆ For any set S, we have ∅ ⊆ S and S ⊆ S. ⋆ For any set S, we have ∅ ∈ P (S) and S ∈ P (S). If |S| is finite then the number of subsets of S is |P (S)| = 2^|S| . (Why?) Example. N ⊆ Z ⊆ Q ⊆ R

Example. Let S = {a, b, c}. The subsets of S are: ∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}. S has 8 subsets. We can write ∅ ⊆ S, {b} ⊆ S, {a, c} ⊆ S, {a, b, c} ⊆ S, etc. The power set of S is P (S) = {∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}. and |P (S)| = 23 = 8. We can write ∅ ∈ P (S), {b} ∈ P (S), {a, c} ∈ P (S), {a, b, c} ∈ P (S), etc. Exercise. Let A = P (P ({1})). Find A and |A|.

|P({1})| = 2^1 = 2, so |A| = |P(P({1}))| = 2^2 = 4. A = P(P({1})) = {∅, {∅}}, {{1}}, {∅, {1}}}.

Exercise. For B = {∅, 0, {1}}, are the following statements true or false? 1.

∅∈B

T

8.

{{0}} ⊆ P (B) T

2.

∅⊆B

T

9.

1∈B

3.

{∅} ∈ B

F

10.

{1} ⊆ B

4.

{∅} ⊆ P (B)

11.

{1} ∈ P (B)

5.

{0} ∈ P (B)

12.

{{1}} ⊆ P (B) F

6.

{∅} ( B

13.

∅ ∈ P (P (P (P (B))))

7.

{∅} ∈ P (B)

T T

T

T

F F F

T

It is often convenient to work inside a specified universal set, denoted by U , which is assumed to contain everything that is relevant. Venn diagrams are visualizations of sets as regions in the plane. For instance, here is a Venn diagram of a universal set U containing a set A:

U A

Set operations and set algebra:

∼ illustrated by Venn diagrams ∼

difference (−,\) - “but not”

U

A − B = A \ B = {x ∈ U | x ∈ A and x 6∈ B} complement (c ,

B

A

U

) - “not”

A

Ac = A = U \ A = {x ∈ U | x ∈ / A} union (∪) - “or” meaning “one or other or both”

U

A ∪ B = {x ∈ U | x ∈ A or x ∈ B} intersection (∩) - “and”

B

A

B

A

U

A ∩ B = {x ∈ U | x ∈ A and x ∈ B} Two sets A and B are disjoint if A ∩ B = ∅.

The Inclusion-Exclusion Principle: |A ∪ B| = |A| + |B| − |A ∩ B|. Example. Set U = {1, 2, 3, 4, 5, 6}, A = {1, 3, 5}, and B = {1, 2}. Then Ac = {2, 4, 6}

A ∩ B = {1}

A ∪ B = {1, 2, 3, 5}

A − B = {3, 5} .

Exercise. Given U = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A = {x ∈ U | x is odd} B = {x ∈ U | x is even} C = {x ∈ U | x is a multiple of 3} D = {x ∈ U | x is prime}

determine the following sets: A ∩ C = {3, 9} B − D = {0, 4, 6, 8} B ∪ D = {0, 2, 3, 4, 5, 6, 7, 8} Ac = {0, 2, 4, 6, 8} (A ∩ C) − D = {9}

Exercise. Determine the sets A and B, where A − B = {a, c}, B − A = {b, f, g}, and A ∩ B = {d, e}. A = {a, c, d, e} B = {b, d, e, f, g}

Example. In a survey of 100 students majoring in computer science, the following information was obtained: 17 can program in C++ , Java, and Python. 22 can program in C++ and Java, but not Python. 9 can program in C++ and Python, but not Java. 2 can program in Java and Python, but not C++ . 19 can program in C++ , but not Python or Java. 21 can program in Python, but not C++ or Java. Also, all of the 100 students can program in at least one of these three languages. How many students can program in Java, but not C++ or Python? 100

0

C++

19 9

17

21

2

Python 100 = 0 + 22 + 19 + 21 + 17 + 9 + 2 + x = 90 + x So x = 10.

22

Java

Exercise. In a survey of 200 people asked about whether they like apples (A), bananas (B), and cherries (C), the following data was obtained: |A| = 112, |A ∩ B| = 32, |A ∩ B ∩ C| = 20.

|B| = 89, |A ∩ C| = 26,

|C| = 71, |B ∩ C| = 43,

By inclusion-exclusion, |AUB| = |A| + |B| - |A∩B| a) How many people like apples or bananas? = 112 + 89 - 32 = 169. b) How many people like exactly one of these fruit? 74 + 34 + 22 = 130. c) How many people like none of these fruit? |AUBUC| = 112 + 34 + 23 + 22 = 191. 200

A

18

74

34

20

B

23

6

22 C

Hints for proofs: To prove that S ⊆ T , we assume that x ∈ S and show that x ∈ T . To prove that S = T , we show that S ⊆ T and T ⊆ S.

Example. We prove that if A ⊆ C and B ⊆ C, then A ∪ B ⊆ C. Proof. Let A ⊆ C and B ⊆ C and suppose that x ∈ A ∪ B. Then either x ∈ A or x ∈ B (maybe both). If x ∈ A, then x ∈ C, because A ⊆ C. Likewise, if x ∈ B, then x ∈ C, since B ⊆ C. In all possible cases, we have x ∈ C, which proves that A ∪ B ⊆ C. Exercise. Prove that if A ⊆ B and A ⊆ C, then A ⊆ B ∩ C. Let A, B, C be sets such that A ⊆ C, then A ⊆ B and A ⊆ C. Let x ∈ A. Since A ⊆ B, we know that x ∈ B. Similarly A ⊆ C, so x ∈ C. Therefore, x ∈ B ∩ C. So A ⊆ B ∩ C, as required.

Exercise. Prove that if A ⊆ B, then A ∩ B = A. Suppose that A ∩ B ⊆ A, by definition of intersection. To prove that A ⊆ A ∩ B, let x ∈ A. Since A ⊆ B, we know that x ∈ B. Therefore x ∈ A ∩ B. So A ⊆ A ∩ B, which shows that A = A ∩ B.

Exercise. Prove that if A ∩ B = A, then A ⊆ B. Proof (Set Level): Suppose that A ∩ B = A.

Alternative Proof (Element Level): Suppose that A ∩ B = A.

Observe that A ∩ B ⊆ B (true for all sets A, B).

Let x ∈ A. Then x ∈ A ∩ B by assumption.

So A = A ∩ B ⊆ B, as required.

Hence, x ∈ B, which proves that A ⊆ B.

Combining these examples, we see that A ∩ B = A if and only if A ⊆ B.

Exercise. Is the statement A∩(B ∪C) = (A∩B)∪C true (for all sets A, B, C)? Provide a proof if it is true or give a counter example if it is false. For example, let A = {1}, B = {1}, C = {2}. Then A ∩ (B ∪ C) = 1 but (A ∩ B) ∪ C = {1, 2} ≠ A ∩ (B ∪ C). This counterexample proves that the statement is false.

A wrong answer is “False: because LHS is (A ∩ B) ∪ (A ∩ C) not (A ∩ B) ∪ C.” Exercise. Is the statement A − (B − C) = (A − B) − C true? Provide a proof if it is true or give a counter example if it is false. This is false. For example, let A = B = C = {a}. Then A - (B - C) = A - ∅ = A, While (A - B) - C = ∅ - C = ∅ ≠ A = {a}.

Laws of set algebra: Commutative laws

A∩B =B∩A A∪B =B∪A Associative laws A ∩ (B ∩ C) = (A ∩ B) ∩ C A ∪ (B ∪ C) = (A ∪ B) ∪ C Distributive laws A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) Absorption laws A ∩ (A ∪ B) = A A ∪ (A ∩ B) = A Identity laws A∩U =U ∩A=A A∪∅=∅∪A=A Idempotent laws A∩A=A A∪A=A Double complement law (Ac )c = A Difference law A − B = A ∩ Bc Domination or universal bound laws

Intersection and union with complement De Morgan’s Laws (A ∪ B)c = Ac ∩ B c U

A∩∅=∅∩A=∅ A∪U =U ∪A=U A ∩ Ac = Ac ∩ A = ∅ A ∪ Ac = Ac ∪ A = U (A ∩ B)c = Ac ∪ B c U

B

A

Exampl B

A

Proof of De Morgan’s law (A ∪ B)c = Ac ∩ B c : (i) Suppose that x ∈ (A ∪ B)c . Then we have x ∈ / A ∪ B, so x ∈ / A and x ∈ / B. c c c c Thus, x ∈ A and x ∈ B , so x ∈ A ∩ B . This proves that (A ∪ B)c ⊆ Ac ∩ B c .

(ii) Suppose now that x ∈ Ac∩B c . Then x ∈ Ac and x ∈ B c , so x ∈ / A and x ∈ / B. c Thus, x ∈ / A ∪ B, so x ∈ (A ∪ B) . This proves that Ac ∩ B c ⊆ (A ∪ B)c . Combining (i) and (ii), we conclude that (A ∪ B)c = Ac ∩ B c .

Example. We can use the laws of set algebra to simplify (Ac ∩ B)c ∪ B: (Ac ∩ B)c ∪ B = = = = =

((Ac )c ∪ B c ) ∪ B (A ∪ B c ) ∪ B A ∪ (B c ∪ B) A∪U U

De Morgan’s law Double complement law Associative law Union with complement Domination

Exercise. Use the laws of set algebra to simplify (A ∩ (A ∩ B)c ) ∪ B c :

Exercise. Use the laws of set algebra to simplify ([(A ∪ B)c ∪ C] ∪ B c )c

Challenge: Prove the result (uniqueness of complement): If A ∪ B = U and A ∩ B = ∅ then B = Ac .

Principal of Duality: For a set identity involving only unions, intersections and complements, its dual is obtained by replacing ∩ with ∪, ∪ with ∩, ∅ with U , and U with ∅. As all the relevant laws of set algebra come in dual pairs, then the dual of any true set identity is also true. The duals of the last 3 examples are:

Generalized set operations: n [

i=1

Ai = A1 ∪ A2 ∪ · · · ∪ An

and

n \

i=1

Ai = A1 ∩ A2 ∩ · · · ∩ An

Example. If Ak = {k, k + 1} for every positive integer k, then 3 [

k=1 3 \

Ak = A1 ∪ A2 ∪ A3 = {1, 2} ∪ {2, 3} ∪ {3, 4} = {1, 2, 3, 4} Ak =

k=1

Let I be an (index) set. For each i ∈ I, let Ai be a subset of a given set A. [ S Ai = i∈I Ai = {a ∈ A | a ∈ Ai for some i ∈ I} i∈I

\ i∈I

Ai =

T

i∈I

Ai = {a ∈ A | a ∈ Ai for every i ∈ I}

Example. Let I = {1, 2, 3, . . .} be the index set. For each i ∈ I let

Ai = [0, 1i ] ⊆ R be the set of real numbers between 0 and

S

i∈I

T

i∈I

1 i

including 0 and 1i .

Ai = [0, 1] ∪ [0, 21 ] ∪ [0, 13 ] ∪ · · · = [0, 1] Ai = [0, 1] ∩ [0, 21 ] ∩ [0, 13 ] ∩ · · · = {0}

Example. (The Barber Puzzle) In a certain town there is a barber (*) who shaves all those men, and only those, who do not shave themselves. Does the barber shave himself? Problem: If he shaves himself, (*) =⇒ he doesn’t shave himself. If he doesn’t shave himself, (*) =⇒ he shaves himself. CONTRADICTION! Solution: The paradox occurred because a self-referential statement was used. The “themself” in (*) could also refer to the barber, which causes problems. This is avoided if we assume that the barber is from out of town.

Example. (Russell’s Paradox) Let U be the set of all sets. First weird phenomenon: then U ∈ U . Even worse, we have Russell’s paradox. Let S = {A ∈ U | A ∈ / A}. Is S an element of itself? i) If S ∈ S, then the definition of S implies that S ∈ / S, a contradiction.

ii) If S ∈ / S, then the definition of S implies that S ∈ S, also a contradiction. Hence neither S ∈ S nor S ∈ / S. Usual Solution: Key Point: Set theory is very subtle, and the notion of “set” must be carefully defined. In this course, we can mostly ignore these subtleties.

An ordered pair is a collection of two objects in a specified order. We use round brackets to denote ordered pairs; e.g., (a, b) is an ordered pair. Note that (a, b) and (b, a) are different ordered pairs, whereas {a, b} and {b, a} are the same set. An ordered n-tuple is a collection of n objects in a specified order; e.g., (a1 , a2 , . . . , an ) is an ordered n-tuple. Two ordered n-tuples (a1 , a2 , . . . , an ) and (b1 , b2 , . . . , bn ) are equal if and only if ai = bi for all i = 1, 2, . . . , n. The Cartesian product of two sets A and B, denoted by A × B, is the set of all ordered pairs, the first from A, the second from B: A × B = {(a, b) | a ∈ A and b ∈ B} ⋆ If |A| = m and |B| = n, then we have |A × B| = |A| * |B| = m*n

The Cartesian product of n sets A1 , A2 , . . . , An is the set of all ordered n-tuples (a1 , a2 , . . . , an ) such that ai ∈ Ai for all i = 1, 2, . . . , n:

A1 ×A2 ×· · ·×An = {(a1 , a2 , . . . , an ) | ai ∈ Ai for all i = 1, 2, . . . , n}

Example. Let A = {a, b} and B = {1, 2, 3}. Then

A × B = {(a, 1), (a, 2), (a, 3), (b, 1), (b, 2), (b, 3)} .

Exercise. For A in the above example, find A × A. A x A = {(a, a), (a, b), (b, a), (b, b)}

When X and Y are small finite sets, we can use an arrow diagram to represent a subset S of X × Y : we list the elements of X and the elements of Y , and then we draw an arrow from x to y for each pair (x, y) ∈ S. Example. Let X = {a, b, c}, Y = {1, 2, 3, 4}, and S = {(a, 2), (a, 3), (c, 1)} which is a subset of X × Y , then the arrow diagram for S is a b c

1 2 3 4

FUNCTIONS A function f from a set X to a set Y is a subset of X × Y such that for every x ∈ X there is exactly one y ∈ Y for which (x, y) belongs to f . We write f : X → Y and say that “f is a function from X to Y ”. X is the domain of f , Y is the codomain of f .

For any x ∈ X, there is a unique y ∈ Y for which (x, y) belongs to f . We write f (x) = y or f : x 7→ y. We call y “the image of x under f ” or “the value of f at x”.

The range of f is the set of all values of f , that is f (X) = {y ∈ Y | y = f (x) for some x ∈ X}. This definition of a function corresponds to what is normally thought of as the graph of a function, with an x-axis and a y-axis. How does this relate to the definition of a function given in Calculus in MATH1131/1141/1151?

Example. Ahmed, Belinda, Changhao, Dan and Eve were each given a mark out of 4. Their marks define a function f : X → Y as follows: domain X = {Ahmed, Belinda, Changhao, Dan, Eve} codomain Y = {1, 2, 3, 4}, and suppose f = {(Ahmed, 3), (Belinda, 2), (Changhao, 4), (Dan, 2), (Eve, 3)}. The arrow diagram for this function is f

Ahmed Belinda Changhao

1 2 3 4

Dan Eve X

Y

This is a function because every person has exactly one mark. The range of this function is {2, 3, 4}. Exercise. Let X = {a, b, c} and Y = {1, 2, 3, 4, 5}. Determine whether or not each of the following is a function from X to Y . If it is, then write down its range. f = {(a, 2), (a, 4), (b, 3), (c, 5)}, g = {(b, 1), (c, 3)}, h = {(a, 5), (b, 2), (c, 2)}. f is not a function because a is paired with more than one element in Y. g is not a function because a is not paired with any element in Y. h is a functions, and the range of h is {2, 5}.

Example. The square function f : R → R is defined by set of the pairs {(x, y) ∈ R × R | y = x2 }.

The function f : R → R can also be specified by f (x) = x2

or

f : x 7→ x2 .

The domain of f is R; the codomain of f is R; and the range of f is {y ∈ R | y = x2 for some x ∈ R} = {y ∈ R | y ≥ 0} = R+ ∪ {0}.

The floor function: (round down) for any x ∈ R, we denote by ⌊x⌋ the largest integer less than or equal to x.

The ceiling function: (round up) for any x ∈ R, we denote by ⌈x⌉ the smallest integer greater than or equal to x. Exercise. Evaluate the following: ⌊3.7⌋ = 3 ⌊−3.7⌋ = -4 ⌈3.7⌉ = 4 ⌈−3.7⌉ = -3

⌊3⌋ = 3 ⌈3⌉ = 3

⌊−3⌋ = ⌈−3⌉ =

-3 -3

Exercise. What are the ranges of the floor and ceiling functions? Plot the graphs of the floor and the ceiling functions.

Ceiling Function

Floor Function

Exercise. Determine whether or not each of the following definitions corresponds to a function. If it does, then write down its range. f : R → R, f (x) =

g : R+ → R, g(x) =

1 x 1 x

h : R → R, h(x) = ⌊x2 − x⌋ j : R → Z j(x) = 2x

f is not a function because f(0) is not defined. g is a function with range R+. h is a function and the range of h is {y E Z | y >= -1}. j is not a function as j(1/3) = 2/3 !E Z.

The image of a set A ⊆ X under a function f : X → Y is

f (A) = {y ∈ Y | y = f (x) for some x ∈ A} = {f (x) | x ∈ A} ⊆ Y .

The inverse image of a set B ⊆ Y under a function f : X → Y is f −1 (B) = {x ∈ X | f (x) ∈ B} ⊆ X.

Example. Let the function f be defined by the arrow diagram a b c d e

1 2 3 4

The image of {a, b, e} under f is f ({a, b, e}) = {f (a), f (b), f (e)} = {2, 3}. The inverse image of {1, 2} under f is f −1 ({1, 2}) = {b, d}. Exercise. Let f : R → R be given by f (x) = x2 . Find √ (a) The image of the set {2, −2, π, 2} under f . (b) The inverse image of the set {9, −9, π} under f (c) The inverse image of the set {−2, −9} under f . a. {4, pi^2, 2} b. {3, -3, sqrt(pi), -sqrt(pi)} c. Empty Set.

Recall that if f is a function from X to Y , then for every x ∈ X, there is exactly one y ∈ Y such that f (x) = y. We say that a function f : X → Y is one-to-one or injective iff for every y ∈ Y , there is at most one x ∈ X such that f (x) = y.

OR equivalently, for all x1 , x2 ∈ X, if f (x1 ) = f (x2 ) then x1 = x2 .

OR equivalently, for all x1 , x2 ∈ X, if x1 6= x2 then f (x1 ) 6= f (x2 ). We say that a function f : X → Y is onto or surjective iff for every y ∈ Y , there is at least one x ∈ X such that f (x) = y. the range of f is the same as the codomain of f .

We say that a function f : X → Y is a bijection (or is a bijective function) iff f is both one-to-one and onto (injective and surjective). for every y ∈ Y , there is exactly one x ∈ X such that f (x) = y.

In terms of arrow diagrams and graphs... The arrow diagram for f : X → Y

function one-to-one injective onto surjective a bijection

The graph for f : R → R

has exactly one outgoing arrow for each element of X

intersects each vertical line in exactly one point

has at most one incoming arrow for each element of Y has at least one incoming arrow for each element of Y has exactly one incoming arrow for each element of Y

intersects each horizontal line in at most one point intersects each horizontal line in at least one point intersects each horizontal line in exactly one point

Example. The function f : R → R, f (x) = x2 is neither one-to-one nor onto.

Exercise. Determine whether or not each of the following arrow diagrams corresponds to a function. If it does, then determine whether or not it is oneto-one, onto, or a bijection.

a b c

a b c a b c

f1

1 2 3 4

a b c

f4

1 2 3 4

a b c

1 2 f7

a b c

f2

f5 1 2

f8

1 2 3 4

a b c

1 2 3

a b c

a b c

1 2 f9

a b c

f3

1 2 3 4

f6

1 2 3 4

1 f10

f1

f2

f3

f4

f5

f6

f7

f8

f9

f10

function one-to-one onto bijection

Exercise. Which of the following definitions correspond to functions? Which of the functions are one-to-one? onto? a bijection? √ f1 : R → R, f1 (x) = x f2 : R → R, f2 (x) = x2 f3 : R → (R+ ∪ {0}), f3 (x) = x2 f4 : R+ → R+ , f4 (x) = x2 f5 : (R − {0}) → R, f5 (x) = x1 f6 : R → R, f6 (x) = x2 − 2x − 2 Plot the graph in each case, and give reasons for your answers. f1 function one-to-one onto bijection

f2

f3

f4

f5

f6

For functions f : X → Y and g : Y → Z, the composite of f and g is the function g ◦ f : X → Z defined by (g ◦ f )(x) = g(f (x)) for all x ∈ X. In general, g ◦ f and f ◦ g are not the same composite functions. Associativity of composition (assuming all composites exist): h ◦ (g ◦ f ) = (h ◦ g) ◦ f . Example. Let f and g be functions defined by f : N → Z, f (x) = x + 3

and

g : Z → Z, g(y) = y 2 .

Then the composite function g ◦ f : N → Z exists because codomain of f = Z = domain of g. It is given by (g ◦ f )(x) = g(f (x)) = g(x + 3) = (x + 3)2 = x2 + 6x + 9 . Note, f ◦ g is not defined as codomain of g = Z 6= N = domain of f . But the range of g is a subset of N, so we can re-define g to be closely related function g : Z → N : y 7→ y 2 . Then f ◦ g is defined and (f ◦ g)(y) = f (g(y)) = f (y 2 ) = y 2 + 3. Note f ◦ g 6= g ◦ f . In particular, these two functions have different domains. Exercise. Let A = {1, 2} and f : A → A be defined by f = {(1, 2), (2, 1)}. Find the composite f ◦ f : A −→ A.

The identity function on a set X is the function idX : X → X, idX (x) = x. For any function f : X → Y , we have f ◦ idX = f = idY ◦ f . A function g : Y → X is an inverse of f : X → Y if and only if g(f (x)) = x for all x ∈ X,

and f (g(y)) = y for all y ∈ Y,

or equivalently, g ◦ f = idX and f ◦ g = idY . Thus x = g(y) “solves” f (x) = y THEOREM: A function can have at most one inverse. If f : X → Y has an inverse, then we say that f is invertible, and we denote the inverse of f by f −1 . Thus, f −1 ◦ f = idX and f ◦ f −1 = idY . If g is the inverse of f , then f is the inverse of g. Thus, (f −1 )−1 = f . THEOREM: A function is invertible if and only if it is bijective. THEOREM: If f : X → Y and g : Y → Z are invertible, then so is g ◦ f : X → Z, and the inverse of g ◦ f is f −1 ◦ g −1 . Example. Let f : R → R be defined by f (x) = 2x − 5. To find the inverse f −1 , solve the equation y = f (x) with respect to x: y = 2x − 5

⇒

Thus, f −1 : R → R is given by f −1 (y) =

x=

y+5 2

.

y+5 . 2

Exercise. For each of the following functions, find its inverse if it is invertible. f : R → Z, f (x) = ⌊x⌋ g : R → R+ , g(x) = e3x−2 h : {1, 2, 3} → {a, b, c}, h = {(1, b), (2, c), (3, a)}. Here f is not invertible because f is not one-to-one. For example, f(3) = f(pi) = 3 and 3 =/= pi. Since g is monotonically increasing, it is one-to-one. Next, let yER+. Solve y = g(x) -> x = (ln(y) + 2)/3. Every element of the codomain of h has exactly one arrow coming in. So h is a bijection with inverse: h^(-1)(a) = 3, h^(-1)(b) = 1, h^(-1)(c) = 2 | h^(-1) : {a, b, c} -> {1, 2, 3}

Example. Prove that a function has at most one inverse. Proof. Suppose that f : X → Y has two inverses g1 : Y → X and g2 : Y → X. Then g1 = g1 ◦ idY by property of identity = g1 ◦ (f ◦ g2 ) by definition of inverse = (g1 ◦ f ) ◦ g2 by associativity of composition = idX ◦ g2 by definition of inverse = g2 by property of identity Hence, if f has an inverse, then it is unique. Exercise. Prove that a function has an inverse if and only if it is bijective.

Exercise. Prove that if f : X → Y and g : Y → Z are invertible, then so is g ◦ f : X → Z, and the inverse of g ◦ f is f −1 ◦ g −1 .

SEQUENCES Informally speaking, a sequence is an ordered list of objects, a0 , a1 , a2 , . . . , ak , . . . , where each object ak is called a term, and the subscript k is called an index (typically starting from 0 or 1). We denote the sequence by {ak }. If all terms ak lie in a set A, we can think of the sequence as a function a : N → A : k 7→ ak . Example. An arithmetic progression is a sequence {bk } where bk = a + kd for all k ∈ N for some fixed numbers a ∈ R and d ∈ R. Its terms are a, a + d, a + 2d, a + 3d, . . . .

A geometric progression is a sequence {ck } defined by ck = ark for all k ∈ N for some fixed numbers a ∈ R and r ∈ R. Its terms are a, ar, ar2 , ar3 , . . . .

Summation notation: for m ≤ n, n X

k=m

ak = am + am+1 + am+2 + · · · + an .

Properties of summation: n X

(ak + bk ) =

k=m

n X

k=m

ak +

n X

bk

n X

and

(λ ak ) = λ

ak ,

k=m

k=m

k=m

n X

but in general n X

k=m

ak bk 6=

n X

k=m

ak

!

n X

k=m

bk

!

.

Example. The sum of the first n+1 terms of the arithmetic progression {a+kd} is n X (2a+nd)(n+1) . (a+kd) = a + (a+d) + (a+2d) + · · · + (a+nd) = 2 k=0

Why?

We find a formula for the sum of the first n positive integers, by setting a = 0 and d = 1: n X n(n + 1) 1 + 2 + ··· + n = 0 + 1 + 2 + ··· + n = k = . 2 k=0 Example. The sum of the first n + 1 terms of the geometric progression {ark } is n X a(rn+1 − 1) k 2 n ar = a + ar + ar + · · · + ar = . r − 1 k=0 Why?

Exercise. Given the formulas n X

n(n + 1) k = 2 k=1

and

n X k=1

k2 =

n(n + 1)(2n + 1) , 6

evaluate 10 X (k − 3)(k + 2) k=1

Exercise. Use the formula for the geometric progression to evaluate 40 X

(3k + 2)2

k=11

Example. (Change of summation index) The sum 5 X 1 k=1

k+2

can be transformed by a change of variable like j = k + 2 as follows: Lower limit: when k = 1, we have j = 1 + 2 = 3. Upper limit: when k = 5, we have j = 5 + 2 = 7. 1 1 = . General term: we have k+2 j Thus, we obtain 5 7 X X 1 1 = . k + 2 j j=3 k=1

Here j is a dummy variable, and could be replaced by any symbol, including k again: 5 7 7 X X X 1 1 1 = = . k + 2 j k j=3 k=1 k=3

But it is often clearer to use different dummy symbols after a change of variables. More generally, for any sequence {ak } and any integer d we have n X

ak =

k=m

n+d X

aj−d .

j=m+d

For example, a1 + a2 + a3 =

3 X k=1

Exercise. Simplify n+1 X k=2

x

k−2

−

n−1 X k=1

k

x +

n−1 X k=0

xk+1

ak =

4 X j=2

aj−1 =

2 X ℓ=0

aℓ+1 = · · · .

Example. (A telescoping sum) 1 1 3 = − for k ≥ 1, we can write Using the identity k(k + 3) k k+3 n n X X 1 1 3 = − k(k + 3) k k+3 k=1 k=1 1 1 1 1 1 1 1 1 1 = 1− + − + − + − + ··· + − . 4 2 5 3 6 4 7 n n+3 X ak , where ak = bk − bk+d . This is an example of a telescoping sum: By changing the summation index, we see that n X k=1

n n n n+3 X X 3 1 X 1 1 X1 = − = − k(k + 3) k k + 3 k j j=4 k=1 k=1 k=1

=

3 X 1 k=1

= 1+ Exercise. Use the identity to simplify n X k=1

2 k(k + 1)(k + 2)

k

+

n X 1 k=4

k

!

−

n+3 X 1 + j j=n+1 j

n X 1 j=4

!

1 1 1 1 1 + − − − . 2 3 n+1 n+2 n+3

1 2 1 2 = − + for k ≥ 1 k(k + 1)(k + 2) k k+1 k+2

Product notation: for m ≤ n, n Y

k=m

ak = am · am+1 · am+2 · · · an .

Properties of product: ! ! n n n Y Y Y ak bk = ak bk k=m

k=m

Exercise. Simplify n Y

k k+3 k=1

k=m

but

n Y

(ak + bk ) 6=

k=m

n Y

k=m

ak +

n Y

k=m

bk .

View more...
F. Kuo/T. Britz/D. Chan/D. Trenerry/C. Greenhill

§1 Sets, Functions, and Sequences SETS A set is a well-defined collection of distinct objects. An element of a set is any object in the set. ∈ - “belongs to” or “is an element of” or “is in” ∈ / - “does not belong to” or “is not an element of” or “is not in” The cardinality of a set S, denoted by |S|, is the number of elements in S. Example. Some commonly-used sets in our number system: N - the set of natural numbers 0, 1, 2, 3, . . . Z - the set of integers (whole numbers) . . . , −3, −2, −1, 0, 1, 2, 3, . . . Q - the set of rational numbers (fractions) . . . , −1, 0, 1, 2, 12 , 3, 31 , 23 , . . . R - the set of real numbers, which includes all rational √ numbers as well as irrational numbers such as π, e, and 2 R+ - the set of all positive real numbers Example. We can specify a set by listing its elements between curly brackets, separated by commas: S = {b, c} . The elements of S are b and c . Thus |S| = 2. We can write b ∈ S, c ∈ S, and d ∈ / S, for instance. Example. We can specify a set by some property that all elements must have: S = {x ∈ Z | x2 ≤ 4} (or S = {x ∈ Z : x2 ≤ 4} ) . The elements of S are −2, −1, 0, 1 and 2. Thus |S| = 5. Also S = {−2, −1, 0, 1, 2}. We can write −2 ∈ S, −1 ∈ S, 0 ∈ S, 1 ∈ S, and 4 ∈ / S, for instance. Exercise. Let A = {{a}, a}. What are the elements of A? What is |A|? The elements of A are a, {a}.

Note: A set within a set represents 1 element.

So |A| = 2.

E.g. if B = {a, {a, b}}, the elements of B are a, {a, b}. So |B| = 2.

Two sets S and T are equal, denoted by S = T , if and only if (written iff) (i) every element of S is also an element of T , and (ii) every element of T is also an element of S . i.e., when they have precisely the same elements. The empty set, denoted by ∅, is a set which has no elements. |∅| = 0. Exercise. Are any of the following sets equal? A = {2, 3, 4, 5}, C = {2, 2, 3, 3, 4, 5}, B = {5, 4, 3, 2}, D = {x ∈ N | 2 ≤ x ≤ 5}. They are all equal.

Exercise. What is the difference between the sets ∅, {∅} and {∅, {∅}}? - ∅ has no elements. - {∅} is a set containing just one element, namely, the empty set ∅. - {∅, {∅}} is a set containing two elements, namely, ∅ and {∅}.

Loosely speaking, a subset is a part of a set. More precisely, a set S is a subset of a set T if and only if each element of S is also an element of T. ⊆ - “is a subset of”,

6⊆ - “is not a subset of”

⋆ S = T if and only if S ⊆ T and T ⊆ S.

A set S is a proper subset of a set T iff S is a subset of T and S 6= T . We then write S ( T (or sometimes S ⊂ T ). ⋆ ∅ is a proper subset of any non-empty set. ⋆ Any non-empty set is an improper subset of itself. The power set P (S) of a set S is the set of all possible subsets of S. ⋆ For any set S, we have ∅ ⊆ S and S ⊆ S. ⋆ For any set S, we have ∅ ∈ P (S) and S ∈ P (S). If |S| is finite then the number of subsets of S is |P (S)| = 2^|S| . (Why?) Example. N ⊆ Z ⊆ Q ⊆ R

Example. Let S = {a, b, c}. The subsets of S are: ∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}. S has 8 subsets. We can write ∅ ⊆ S, {b} ⊆ S, {a, c} ⊆ S, {a, b, c} ⊆ S, etc. The power set of S is P (S) = {∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}. and |P (S)| = 23 = 8. We can write ∅ ∈ P (S), {b} ∈ P (S), {a, c} ∈ P (S), {a, b, c} ∈ P (S), etc. Exercise. Let A = P (P ({1})). Find A and |A|.

|P({1})| = 2^1 = 2, so |A| = |P(P({1}))| = 2^2 = 4. A = P(P({1})) = {∅, {∅}}, {{1}}, {∅, {1}}}.

Exercise. For B = {∅, 0, {1}}, are the following statements true or false? 1.

∅∈B

T

8.

{{0}} ⊆ P (B) T

2.

∅⊆B

T

9.

1∈B

3.

{∅} ∈ B

F

10.

{1} ⊆ B

4.

{∅} ⊆ P (B)

11.

{1} ∈ P (B)

5.

{0} ∈ P (B)

12.

{{1}} ⊆ P (B) F

6.

{∅} ( B

13.

∅ ∈ P (P (P (P (B))))

7.

{∅} ∈ P (B)

T T

T

T

F F F

T

It is often convenient to work inside a specified universal set, denoted by U , which is assumed to contain everything that is relevant. Venn diagrams are visualizations of sets as regions in the plane. For instance, here is a Venn diagram of a universal set U containing a set A:

U A

Set operations and set algebra:

∼ illustrated by Venn diagrams ∼

difference (−,\) - “but not”

U

A − B = A \ B = {x ∈ U | x ∈ A and x 6∈ B} complement (c ,

B

A

U

) - “not”

A

Ac = A = U \ A = {x ∈ U | x ∈ / A} union (∪) - “or” meaning “one or other or both”

U

A ∪ B = {x ∈ U | x ∈ A or x ∈ B} intersection (∩) - “and”

B

A

B

A

U

A ∩ B = {x ∈ U | x ∈ A and x ∈ B} Two sets A and B are disjoint if A ∩ B = ∅.

The Inclusion-Exclusion Principle: |A ∪ B| = |A| + |B| − |A ∩ B|. Example. Set U = {1, 2, 3, 4, 5, 6}, A = {1, 3, 5}, and B = {1, 2}. Then Ac = {2, 4, 6}

A ∩ B = {1}

A ∪ B = {1, 2, 3, 5}

A − B = {3, 5} .

Exercise. Given U = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, A = {x ∈ U | x is odd} B = {x ∈ U | x is even} C = {x ∈ U | x is a multiple of 3} D = {x ∈ U | x is prime}

determine the following sets: A ∩ C = {3, 9} B − D = {0, 4, 6, 8} B ∪ D = {0, 2, 3, 4, 5, 6, 7, 8} Ac = {0, 2, 4, 6, 8} (A ∩ C) − D = {9}

Exercise. Determine the sets A and B, where A − B = {a, c}, B − A = {b, f, g}, and A ∩ B = {d, e}. A = {a, c, d, e} B = {b, d, e, f, g}

Example. In a survey of 100 students majoring in computer science, the following information was obtained: 17 can program in C++ , Java, and Python. 22 can program in C++ and Java, but not Python. 9 can program in C++ and Python, but not Java. 2 can program in Java and Python, but not C++ . 19 can program in C++ , but not Python or Java. 21 can program in Python, but not C++ or Java. Also, all of the 100 students can program in at least one of these three languages. How many students can program in Java, but not C++ or Python? 100

0

C++

19 9

17

21

2

Python 100 = 0 + 22 + 19 + 21 + 17 + 9 + 2 + x = 90 + x So x = 10.

22

Java

Exercise. In a survey of 200 people asked about whether they like apples (A), bananas (B), and cherries (C), the following data was obtained: |A| = 112, |A ∩ B| = 32, |A ∩ B ∩ C| = 20.

|B| = 89, |A ∩ C| = 26,

|C| = 71, |B ∩ C| = 43,

By inclusion-exclusion, |AUB| = |A| + |B| - |A∩B| a) How many people like apples or bananas? = 112 + 89 - 32 = 169. b) How many people like exactly one of these fruit? 74 + 34 + 22 = 130. c) How many people like none of these fruit? |AUBUC| = 112 + 34 + 23 + 22 = 191. 200

A

18

74

34

20

B

23

6

22 C

Hints for proofs: To prove that S ⊆ T , we assume that x ∈ S and show that x ∈ T . To prove that S = T , we show that S ⊆ T and T ⊆ S.

Example. We prove that if A ⊆ C and B ⊆ C, then A ∪ B ⊆ C. Proof. Let A ⊆ C and B ⊆ C and suppose that x ∈ A ∪ B. Then either x ∈ A or x ∈ B (maybe both). If x ∈ A, then x ∈ C, because A ⊆ C. Likewise, if x ∈ B, then x ∈ C, since B ⊆ C. In all possible cases, we have x ∈ C, which proves that A ∪ B ⊆ C. Exercise. Prove that if A ⊆ B and A ⊆ C, then A ⊆ B ∩ C. Let A, B, C be sets such that A ⊆ C, then A ⊆ B and A ⊆ C. Let x ∈ A. Since A ⊆ B, we know that x ∈ B. Similarly A ⊆ C, so x ∈ C. Therefore, x ∈ B ∩ C. So A ⊆ B ∩ C, as required.

Exercise. Prove that if A ⊆ B, then A ∩ B = A. Suppose that A ∩ B ⊆ A, by definition of intersection. To prove that A ⊆ A ∩ B, let x ∈ A. Since A ⊆ B, we know that x ∈ B. Therefore x ∈ A ∩ B. So A ⊆ A ∩ B, which shows that A = A ∩ B.

Exercise. Prove that if A ∩ B = A, then A ⊆ B. Proof (Set Level): Suppose that A ∩ B = A.

Alternative Proof (Element Level): Suppose that A ∩ B = A.

Observe that A ∩ B ⊆ B (true for all sets A, B).

Let x ∈ A. Then x ∈ A ∩ B by assumption.

So A = A ∩ B ⊆ B, as required.

Hence, x ∈ B, which proves that A ⊆ B.

Combining these examples, we see that A ∩ B = A if and only if A ⊆ B.

Exercise. Is the statement A∩(B ∪C) = (A∩B)∪C true (for all sets A, B, C)? Provide a proof if it is true or give a counter example if it is false. For example, let A = {1}, B = {1}, C = {2}. Then A ∩ (B ∪ C) = 1 but (A ∩ B) ∪ C = {1, 2} ≠ A ∩ (B ∪ C). This counterexample proves that the statement is false.

A wrong answer is “False: because LHS is (A ∩ B) ∪ (A ∩ C) not (A ∩ B) ∪ C.” Exercise. Is the statement A − (B − C) = (A − B) − C true? Provide a proof if it is true or give a counter example if it is false. This is false. For example, let A = B = C = {a}. Then A - (B - C) = A - ∅ = A, While (A - B) - C = ∅ - C = ∅ ≠ A = {a}.

Laws of set algebra: Commutative laws

A∩B =B∩A A∪B =B∪A Associative laws A ∩ (B ∩ C) = (A ∩ B) ∩ C A ∪ (B ∪ C) = (A ∪ B) ∪ C Distributive laws A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) Absorption laws A ∩ (A ∪ B) = A A ∪ (A ∩ B) = A Identity laws A∩U =U ∩A=A A∪∅=∅∪A=A Idempotent laws A∩A=A A∪A=A Double complement law (Ac )c = A Difference law A − B = A ∩ Bc Domination or universal bound laws

Intersection and union with complement De Morgan’s Laws (A ∪ B)c = Ac ∩ B c U

A∩∅=∅∩A=∅ A∪U =U ∪A=U A ∩ Ac = Ac ∩ A = ∅ A ∪ Ac = Ac ∪ A = U (A ∩ B)c = Ac ∪ B c U

B

A

Exampl B

A

Proof of De Morgan’s law (A ∪ B)c = Ac ∩ B c : (i) Suppose that x ∈ (A ∪ B)c . Then we have x ∈ / A ∪ B, so x ∈ / A and x ∈ / B. c c c c Thus, x ∈ A and x ∈ B , so x ∈ A ∩ B . This proves that (A ∪ B)c ⊆ Ac ∩ B c .

(ii) Suppose now that x ∈ Ac∩B c . Then x ∈ Ac and x ∈ B c , so x ∈ / A and x ∈ / B. c Thus, x ∈ / A ∪ B, so x ∈ (A ∪ B) . This proves that Ac ∩ B c ⊆ (A ∪ B)c . Combining (i) and (ii), we conclude that (A ∪ B)c = Ac ∩ B c .

Example. We can use the laws of set algebra to simplify (Ac ∩ B)c ∪ B: (Ac ∩ B)c ∪ B = = = = =

((Ac )c ∪ B c ) ∪ B (A ∪ B c ) ∪ B A ∪ (B c ∪ B) A∪U U

De Morgan’s law Double complement law Associative law Union with complement Domination

Exercise. Use the laws of set algebra to simplify (A ∩ (A ∩ B)c ) ∪ B c :

Exercise. Use the laws of set algebra to simplify ([(A ∪ B)c ∪ C] ∪ B c )c

Challenge: Prove the result (uniqueness of complement): If A ∪ B = U and A ∩ B = ∅ then B = Ac .

Principal of Duality: For a set identity involving only unions, intersections and complements, its dual is obtained by replacing ∩ with ∪, ∪ with ∩, ∅ with U , and U with ∅. As all the relevant laws of set algebra come in dual pairs, then the dual of any true set identity is also true. The duals of the last 3 examples are:

Generalized set operations: n [

i=1

Ai = A1 ∪ A2 ∪ · · · ∪ An

and

n \

i=1

Ai = A1 ∩ A2 ∩ · · · ∩ An

Example. If Ak = {k, k + 1} for every positive integer k, then 3 [

k=1 3 \

Ak = A1 ∪ A2 ∪ A3 = {1, 2} ∪ {2, 3} ∪ {3, 4} = {1, 2, 3, 4} Ak =

k=1

Let I be an (index) set. For each i ∈ I, let Ai be a subset of a given set A. [ S Ai = i∈I Ai = {a ∈ A | a ∈ Ai for some i ∈ I} i∈I

\ i∈I

Ai =

T

i∈I

Ai = {a ∈ A | a ∈ Ai for every i ∈ I}

Example. Let I = {1, 2, 3, . . .} be the index set. For each i ∈ I let

Ai = [0, 1i ] ⊆ R be the set of real numbers between 0 and

S

i∈I

T

i∈I

1 i

including 0 and 1i .

Ai = [0, 1] ∪ [0, 21 ] ∪ [0, 13 ] ∪ · · · = [0, 1] Ai = [0, 1] ∩ [0, 21 ] ∩ [0, 13 ] ∩ · · · = {0}

Example. (The Barber Puzzle) In a certain town there is a barber (*) who shaves all those men, and only those, who do not shave themselves. Does the barber shave himself? Problem: If he shaves himself, (*) =⇒ he doesn’t shave himself. If he doesn’t shave himself, (*) =⇒ he shaves himself. CONTRADICTION! Solution: The paradox occurred because a self-referential statement was used. The “themself” in (*) could also refer to the barber, which causes problems. This is avoided if we assume that the barber is from out of town.

Example. (Russell’s Paradox) Let U be the set of all sets. First weird phenomenon: then U ∈ U . Even worse, we have Russell’s paradox. Let S = {A ∈ U | A ∈ / A}. Is S an element of itself? i) If S ∈ S, then the definition of S implies that S ∈ / S, a contradiction.

ii) If S ∈ / S, then the definition of S implies that S ∈ S, also a contradiction. Hence neither S ∈ S nor S ∈ / S. Usual Solution: Key Point: Set theory is very subtle, and the notion of “set” must be carefully defined. In this course, we can mostly ignore these subtleties.

An ordered pair is a collection of two objects in a specified order. We use round brackets to denote ordered pairs; e.g., (a, b) is an ordered pair. Note that (a, b) and (b, a) are different ordered pairs, whereas {a, b} and {b, a} are the same set. An ordered n-tuple is a collection of n objects in a specified order; e.g., (a1 , a2 , . . . , an ) is an ordered n-tuple. Two ordered n-tuples (a1 , a2 , . . . , an ) and (b1 , b2 , . . . , bn ) are equal if and only if ai = bi for all i = 1, 2, . . . , n. The Cartesian product of two sets A and B, denoted by A × B, is the set of all ordered pairs, the first from A, the second from B: A × B = {(a, b) | a ∈ A and b ∈ B} ⋆ If |A| = m and |B| = n, then we have |A × B| = |A| * |B| = m*n

The Cartesian product of n sets A1 , A2 , . . . , An is the set of all ordered n-tuples (a1 , a2 , . . . , an ) such that ai ∈ Ai for all i = 1, 2, . . . , n:

A1 ×A2 ×· · ·×An = {(a1 , a2 , . . . , an ) | ai ∈ Ai for all i = 1, 2, . . . , n}

Example. Let A = {a, b} and B = {1, 2, 3}. Then

A × B = {(a, 1), (a, 2), (a, 3), (b, 1), (b, 2), (b, 3)} .

Exercise. For A in the above example, find A × A. A x A = {(a, a), (a, b), (b, a), (b, b)}

When X and Y are small finite sets, we can use an arrow diagram to represent a subset S of X × Y : we list the elements of X and the elements of Y , and then we draw an arrow from x to y for each pair (x, y) ∈ S. Example. Let X = {a, b, c}, Y = {1, 2, 3, 4}, and S = {(a, 2), (a, 3), (c, 1)} which is a subset of X × Y , then the arrow diagram for S is a b c

1 2 3 4

FUNCTIONS A function f from a set X to a set Y is a subset of X × Y such that for every x ∈ X there is exactly one y ∈ Y for which (x, y) belongs to f . We write f : X → Y and say that “f is a function from X to Y ”. X is the domain of f , Y is the codomain of f .

For any x ∈ X, there is a unique y ∈ Y for which (x, y) belongs to f . We write f (x) = y or f : x 7→ y. We call y “the image of x under f ” or “the value of f at x”.

The range of f is the set of all values of f , that is f (X) = {y ∈ Y | y = f (x) for some x ∈ X}. This definition of a function corresponds to what is normally thought of as the graph of a function, with an x-axis and a y-axis. How does this relate to the definition of a function given in Calculus in MATH1131/1141/1151?

Example. Ahmed, Belinda, Changhao, Dan and Eve were each given a mark out of 4. Their marks define a function f : X → Y as follows: domain X = {Ahmed, Belinda, Changhao, Dan, Eve} codomain Y = {1, 2, 3, 4}, and suppose f = {(Ahmed, 3), (Belinda, 2), (Changhao, 4), (Dan, 2), (Eve, 3)}. The arrow diagram for this function is f

Ahmed Belinda Changhao

1 2 3 4

Dan Eve X

Y

This is a function because every person has exactly one mark. The range of this function is {2, 3, 4}. Exercise. Let X = {a, b, c} and Y = {1, 2, 3, 4, 5}. Determine whether or not each of the following is a function from X to Y . If it is, then write down its range. f = {(a, 2), (a, 4), (b, 3), (c, 5)}, g = {(b, 1), (c, 3)}, h = {(a, 5), (b, 2), (c, 2)}. f is not a function because a is paired with more than one element in Y. g is not a function because a is not paired with any element in Y. h is a functions, and the range of h is {2, 5}.

Example. The square function f : R → R is defined by set of the pairs {(x, y) ∈ R × R | y = x2 }.

The function f : R → R can also be specified by f (x) = x2

or

f : x 7→ x2 .

The domain of f is R; the codomain of f is R; and the range of f is {y ∈ R | y = x2 for some x ∈ R} = {y ∈ R | y ≥ 0} = R+ ∪ {0}.

The floor function: (round down) for any x ∈ R, we denote by ⌊x⌋ the largest integer less than or equal to x.

The ceiling function: (round up) for any x ∈ R, we denote by ⌈x⌉ the smallest integer greater than or equal to x. Exercise. Evaluate the following: ⌊3.7⌋ = 3 ⌊−3.7⌋ = -4 ⌈3.7⌉ = 4 ⌈−3.7⌉ = -3

⌊3⌋ = 3 ⌈3⌉ = 3

⌊−3⌋ = ⌈−3⌉ =

-3 -3

Exercise. What are the ranges of the floor and ceiling functions? Plot the graphs of the floor and the ceiling functions.

Ceiling Function

Floor Function

Exercise. Determine whether or not each of the following definitions corresponds to a function. If it does, then write down its range. f : R → R, f (x) =

g : R+ → R, g(x) =

1 x 1 x

h : R → R, h(x) = ⌊x2 − x⌋ j : R → Z j(x) = 2x

f is not a function because f(0) is not defined. g is a function with range R+. h is a function and the range of h is {y E Z | y >= -1}. j is not a function as j(1/3) = 2/3 !E Z.

The image of a set A ⊆ X under a function f : X → Y is

f (A) = {y ∈ Y | y = f (x) for some x ∈ A} = {f (x) | x ∈ A} ⊆ Y .

The inverse image of a set B ⊆ Y under a function f : X → Y is f −1 (B) = {x ∈ X | f (x) ∈ B} ⊆ X.

Example. Let the function f be defined by the arrow diagram a b c d e

1 2 3 4

The image of {a, b, e} under f is f ({a, b, e}) = {f (a), f (b), f (e)} = {2, 3}. The inverse image of {1, 2} under f is f −1 ({1, 2}) = {b, d}. Exercise. Let f : R → R be given by f (x) = x2 . Find √ (a) The image of the set {2, −2, π, 2} under f . (b) The inverse image of the set {9, −9, π} under f (c) The inverse image of the set {−2, −9} under f . a. {4, pi^2, 2} b. {3, -3, sqrt(pi), -sqrt(pi)} c. Empty Set.

Recall that if f is a function from X to Y , then for every x ∈ X, there is exactly one y ∈ Y such that f (x) = y. We say that a function f : X → Y is one-to-one or injective iff for every y ∈ Y , there is at most one x ∈ X such that f (x) = y.

OR equivalently, for all x1 , x2 ∈ X, if f (x1 ) = f (x2 ) then x1 = x2 .

OR equivalently, for all x1 , x2 ∈ X, if x1 6= x2 then f (x1 ) 6= f (x2 ). We say that a function f : X → Y is onto or surjective iff for every y ∈ Y , there is at least one x ∈ X such that f (x) = y. the range of f is the same as the codomain of f .

We say that a function f : X → Y is a bijection (or is a bijective function) iff f is both one-to-one and onto (injective and surjective). for every y ∈ Y , there is exactly one x ∈ X such that f (x) = y.

In terms of arrow diagrams and graphs... The arrow diagram for f : X → Y

function one-to-one injective onto surjective a bijection

The graph for f : R → R

has exactly one outgoing arrow for each element of X

intersects each vertical line in exactly one point

has at most one incoming arrow for each element of Y has at least one incoming arrow for each element of Y has exactly one incoming arrow for each element of Y

intersects each horizontal line in at most one point intersects each horizontal line in at least one point intersects each horizontal line in exactly one point

Example. The function f : R → R, f (x) = x2 is neither one-to-one nor onto.

Exercise. Determine whether or not each of the following arrow diagrams corresponds to a function. If it does, then determine whether or not it is oneto-one, onto, or a bijection.

a b c

a b c a b c

f1

1 2 3 4

a b c

f4

1 2 3 4

a b c

1 2 f7

a b c

f2

f5 1 2

f8

1 2 3 4

a b c

1 2 3

a b c

a b c

1 2 f9

a b c

f3

1 2 3 4

f6

1 2 3 4

1 f10

f1

f2

f3

f4

f5

f6

f7

f8

f9

f10

function one-to-one onto bijection

Exercise. Which of the following definitions correspond to functions? Which of the functions are one-to-one? onto? a bijection? √ f1 : R → R, f1 (x) = x f2 : R → R, f2 (x) = x2 f3 : R → (R+ ∪ {0}), f3 (x) = x2 f4 : R+ → R+ , f4 (x) = x2 f5 : (R − {0}) → R, f5 (x) = x1 f6 : R → R, f6 (x) = x2 − 2x − 2 Plot the graph in each case, and give reasons for your answers. f1 function one-to-one onto bijection

f2

f3

f4

f5

f6

For functions f : X → Y and g : Y → Z, the composite of f and g is the function g ◦ f : X → Z defined by (g ◦ f )(x) = g(f (x)) for all x ∈ X. In general, g ◦ f and f ◦ g are not the same composite functions. Associativity of composition (assuming all composites exist): h ◦ (g ◦ f ) = (h ◦ g) ◦ f . Example. Let f and g be functions defined by f : N → Z, f (x) = x + 3

and

g : Z → Z, g(y) = y 2 .

Then the composite function g ◦ f : N → Z exists because codomain of f = Z = domain of g. It is given by (g ◦ f )(x) = g(f (x)) = g(x + 3) = (x + 3)2 = x2 + 6x + 9 . Note, f ◦ g is not defined as codomain of g = Z 6= N = domain of f . But the range of g is a subset of N, so we can re-define g to be closely related function g : Z → N : y 7→ y 2 . Then f ◦ g is defined and (f ◦ g)(y) = f (g(y)) = f (y 2 ) = y 2 + 3. Note f ◦ g 6= g ◦ f . In particular, these two functions have different domains. Exercise. Let A = {1, 2} and f : A → A be defined by f = {(1, 2), (2, 1)}. Find the composite f ◦ f : A −→ A.

The identity function on a set X is the function idX : X → X, idX (x) = x. For any function f : X → Y , we have f ◦ idX = f = idY ◦ f . A function g : Y → X is an inverse of f : X → Y if and only if g(f (x)) = x for all x ∈ X,

and f (g(y)) = y for all y ∈ Y,

or equivalently, g ◦ f = idX and f ◦ g = idY . Thus x = g(y) “solves” f (x) = y THEOREM: A function can have at most one inverse. If f : X → Y has an inverse, then we say that f is invertible, and we denote the inverse of f by f −1 . Thus, f −1 ◦ f = idX and f ◦ f −1 = idY . If g is the inverse of f , then f is the inverse of g. Thus, (f −1 )−1 = f . THEOREM: A function is invertible if and only if it is bijective. THEOREM: If f : X → Y and g : Y → Z are invertible, then so is g ◦ f : X → Z, and the inverse of g ◦ f is f −1 ◦ g −1 . Example. Let f : R → R be defined by f (x) = 2x − 5. To find the inverse f −1 , solve the equation y = f (x) with respect to x: y = 2x − 5

⇒

Thus, f −1 : R → R is given by f −1 (y) =

x=

y+5 2

.

y+5 . 2

Exercise. For each of the following functions, find its inverse if it is invertible. f : R → Z, f (x) = ⌊x⌋ g : R → R+ , g(x) = e3x−2 h : {1, 2, 3} → {a, b, c}, h = {(1, b), (2, c), (3, a)}. Here f is not invertible because f is not one-to-one. For example, f(3) = f(pi) = 3 and 3 =/= pi. Since g is monotonically increasing, it is one-to-one. Next, let yER+. Solve y = g(x) -> x = (ln(y) + 2)/3. Every element of the codomain of h has exactly one arrow coming in. So h is a bijection with inverse: h^(-1)(a) = 3, h^(-1)(b) = 1, h^(-1)(c) = 2 | h^(-1) : {a, b, c} -> {1, 2, 3}

Example. Prove that a function has at most one inverse. Proof. Suppose that f : X → Y has two inverses g1 : Y → X and g2 : Y → X. Then g1 = g1 ◦ idY by property of identity = g1 ◦ (f ◦ g2 ) by definition of inverse = (g1 ◦ f ) ◦ g2 by associativity of composition = idX ◦ g2 by definition of inverse = g2 by property of identity Hence, if f has an inverse, then it is unique. Exercise. Prove that a function has an inverse if and only if it is bijective.

Exercise. Prove that if f : X → Y and g : Y → Z are invertible, then so is g ◦ f : X → Z, and the inverse of g ◦ f is f −1 ◦ g −1 .

SEQUENCES Informally speaking, a sequence is an ordered list of objects, a0 , a1 , a2 , . . . , ak , . . . , where each object ak is called a term, and the subscript k is called an index (typically starting from 0 or 1). We denote the sequence by {ak }. If all terms ak lie in a set A, we can think of the sequence as a function a : N → A : k 7→ ak . Example. An arithmetic progression is a sequence {bk } where bk = a + kd for all k ∈ N for some fixed numbers a ∈ R and d ∈ R. Its terms are a, a + d, a + 2d, a + 3d, . . . .

A geometric progression is a sequence {ck } defined by ck = ark for all k ∈ N for some fixed numbers a ∈ R and r ∈ R. Its terms are a, ar, ar2 , ar3 , . . . .

Summation notation: for m ≤ n, n X

k=m

ak = am + am+1 + am+2 + · · · + an .

Properties of summation: n X

(ak + bk ) =

k=m

n X

k=m

ak +

n X

bk

n X

and

(λ ak ) = λ

ak ,

k=m

k=m

k=m

n X

but in general n X

k=m

ak bk 6=

n X

k=m

ak

!

n X

k=m

bk

!

.

Example. The sum of the first n+1 terms of the arithmetic progression {a+kd} is n X (2a+nd)(n+1) . (a+kd) = a + (a+d) + (a+2d) + · · · + (a+nd) = 2 k=0

Why?

We find a formula for the sum of the first n positive integers, by setting a = 0 and d = 1: n X n(n + 1) 1 + 2 + ··· + n = 0 + 1 + 2 + ··· + n = k = . 2 k=0 Example. The sum of the first n + 1 terms of the geometric progression {ark } is n X a(rn+1 − 1) k 2 n ar = a + ar + ar + · · · + ar = . r − 1 k=0 Why?

Exercise. Given the formulas n X

n(n + 1) k = 2 k=1

and

n X k=1

k2 =

n(n + 1)(2n + 1) , 6

evaluate 10 X (k − 3)(k + 2) k=1

Exercise. Use the formula for the geometric progression to evaluate 40 X

(3k + 2)2

k=11

Example. (Change of summation index) The sum 5 X 1 k=1

k+2

can be transformed by a change of variable like j = k + 2 as follows: Lower limit: when k = 1, we have j = 1 + 2 = 3. Upper limit: when k = 5, we have j = 5 + 2 = 7. 1 1 = . General term: we have k+2 j Thus, we obtain 5 7 X X 1 1 = . k + 2 j j=3 k=1

Here j is a dummy variable, and could be replaced by any symbol, including k again: 5 7 7 X X X 1 1 1 = = . k + 2 j k j=3 k=1 k=3

But it is often clearer to use different dummy symbols after a change of variables. More generally, for any sequence {ak } and any integer d we have n X

ak =

k=m

n+d X

aj−d .

j=m+d

For example, a1 + a2 + a3 =

3 X k=1

Exercise. Simplify n+1 X k=2

x

k−2

−

n−1 X k=1

k

x +

n−1 X k=0

xk+1

ak =

4 X j=2

aj−1 =

2 X ℓ=0

aℓ+1 = · · · .

Example. (A telescoping sum) 1 1 3 = − for k ≥ 1, we can write Using the identity k(k + 3) k k+3 n n X X 1 1 3 = − k(k + 3) k k+3 k=1 k=1 1 1 1 1 1 1 1 1 1 = 1− + − + − + − + ··· + − . 4 2 5 3 6 4 7 n n+3 X ak , where ak = bk − bk+d . This is an example of a telescoping sum: By changing the summation index, we see that n X k=1

n n n n+3 X X 3 1 X 1 1 X1 = − = − k(k + 3) k k + 3 k j j=4 k=1 k=1 k=1

=

3 X 1 k=1

= 1+ Exercise. Use the identity to simplify n X k=1

2 k(k + 1)(k + 2)

k

+

n X 1 k=4

k

!

−

n+3 X 1 + j j=n+1 j

n X 1 j=4

!

1 1 1 1 1 + − − − . 2 3 n+1 n+2 n+3

1 2 1 2 = − + for k ≥ 1 k(k + 1)(k + 2) k k+1 k+2

Product notation: for m ≤ n, n Y

k=m

ak = am · am+1 · am+2 · · · an .

Properties of product: ! ! n n n Y Y Y ak bk = ak bk k=m

k=m

Exercise. Simplify n Y

k k+3 k=1

k=m

but

n Y

(ak + bk ) 6=

k=m

n Y

k=m

ak +

n Y

k=m

bk .

Thank you for interesting in our services. We are a non-profit group that run this website to share documents. We need your help to maintenance this website.

To keep our site running, we need your help to cover our server cost (about $400/m), a small donation will help us a lot.