Functions as Relations Definition Recall that if A and B are sets, then a relation from A to B is a subset of A B. A function from A to B is a relation f from A to B with the following properties (i) The domain of f is A. (ii) If (x, y) f and (x, z) f, then y = z. In other words, for each a A, there is a unique element b B such that (a, b) f. 1
Function Notation If f is a function from A to B, we write f : A B, and we say that A is the domain of f and B is the codomain of f. 2
Functions Example: Let A = {1, 2, 3} and B = {4, 5, 6}. Determine which of the following relations are functions from A to B.. R = {(1, 4), (2, 5), (3, 6), (2, 6)} R = {(1, 4), (2, 6), (3, 5)} R = {(1, 5), (2, 5), (3, 4)} R = {(1, 4), (3, 6)} 3
Functions Example: Let A = {1, 2, 3} and B = {4, 5, 6}. Determine which of the following relations are functions from A to B. R = {(1, 4), (2, 5), (3, 6), (2, 6)} R is not a function, since R is not single-valued: (2, 5) R and (2, 6) R R = {(1, 4), (2, 6), (3, 5)} Function R = {(1, 5), (2, 5), (3, 4)} Function 4
R = {(1, 4), (3, 6)} R is not a function from A to B, since Dom(R) = {1, 3} = A.
Functions Example: Let F be the relation from Z to Z defined by F = {(x, y) Z Z y = x 2 }. Prove that F is a function from Z to Z. Proof: 5
Functions Example: Let F be the relation from Z to Z defined by F = {(x, y) Z Z y = x 2 }. Prove that F is a function Z to Z. Proof: First we ll show that Dom(F ) = Z. Assume x Z. Let y = x 2. Then, y Z. Therefore, (x, y) Z Z and y = x 2, which means (x, y) F. Therefore, x Dom(F ). This proves Dom(F ) = Z. Next, we ll show that F is single-valued. Assume (x, y) F and (x, z) F where x, y, z Z. Then y = x 2 and z = x 2. Therefore y = z. This completes the proof. 6
Functions Example: Let F be the relation from R to R defined by F = {(x, y) R R x = y 3 }. Prove that F is a function R to R. Proof: 7
Functions Example: Let F be the relation from R to R defined by F = {(x, y) R R x = y 3 }. Prove that F is a function R to R. Proof: First we ll show that Dom(F ) = R. Assume x R. Let y = 3 x. Then, y R. Therefore, (x, y) R R and x = ( 3 x) 3 = y 3, which means (x, y) F. Therefore, x Dom(F ). This proves Dom(F ) = R. Next, we ll show that F is single-valued. Assume (x, y) F and (x, z) F where x, y, z R. Then x = y 3 and x = z 3. Therefore y 3 = z 3. Therefore, y = z. This completes the proof. 8
Functions Example: Let F be the relation from R to R defined by F = {(x, y) R R x = y 2 }. Explain why F is not a function from R to R. 9
Functions Example: Let F be the relation from R to R defined by F = {(x, y) R R x = y 2 }. Explain why F is not a function from R to R. Solution: If (x, y) F, then x = y 2 0. the domain of F is [0, ), not R. Therefore Also, F is not single-valued. For example, when x = 4, we have y = ±2. That is, (4, 2) F and (4, 2) F. Hence, F is not a function. 10
Range of a Function If f : A B and the ordered pair (a, b) belongs to f, then we write f(a) = b and we say b the image of a under f. The range of f, denoted Rng(f), is the set of all images of elements of A. That is, Rng(f) = {b B (a, b) f for some a A} 11
Range of a Function Example: Find the range of each function. F : Z Z defined by F (x) = x 2. Rng(F ) = {0, 1, 4, 9, 16,...} F : R R defined by F (x) = sin(x). Rng(F ) = [ 1, 1] F : {1, 2, 3} {4, 5, 6} defined by F = {(1, 5), (2, 5), (3, 4)}. Rng(F ) = {4, 5} 12
Composition of Functions Theorem Assume f : A B and g : B C are functions. Then the composite relation g f, given by { } (x, z) A C y [(x, y) f and (y, z) g] is a function from A to C. 14
Proof: Assume f : A B and g : B C are functions. We want to show that the relation g f is a function from A to C. First we want to show that the domain of g f is A. Since g f A C, we have Dom(g f) A. Conversely, assume x A. Since f : A B is a function, there exists y B such that (x, y) f. Then, since g : B C is a function, there exists z C such that (y, z) g. Therefore, (x, z) g f, which shows x Dom(g f). This proves Dom(g f) = A. Next, we want to show that g f is singlevalued. Assume (x, z 1 ) g f and (x, z 2 ) g f. Then, there exist y 1 B such that (x, y 1 ) f and (y 1, z 1 ) g, and there exists y 2 B such that (x, y 2 ) f and (y 2, z 2 ) g.
In particular, (x, y 1 ) f and (x, y 2 ) f, and since f is single-valued, it follows that y 1 = y 2. Then, (y 1, z 1 ) g and (y 1, z 2 ) = (y 2, z 2 ) g, and since g is single-valued, it follows that z 1 = z 2. This proves g f is single-valued. Therefore, g f is a function from A to B.
Composition of Functions Theorem: Assume f : A B, g : B C, and h : C D are functions. Then, (h g) f = h (g f). That is, composition of functions is associative. 15
Proof: By the previous theorem, we have Dom((h g) f) = Dom(f) = A, Dom(h (g f)) = Dom((g f)) = Dom(f) = A. This shows that the domains of (h g) f and h (g f) are the same. Next, assume x A. Then, ((h g) f)(x) = (h g)(f(x)) = h(g(f(x))) = h((g f)(x)) = (h (g f))(x). Therefore, (h g) f = h (g f).
Composition of Functions Example: Let A = {1, 2, 3, 4, 5} and consider the functions f, g : A A given by f = {(2, 4), (5, 1), (3, 2), (1, 2), (4, 3)} g = {(4, 1), (5, 4), (1, 2), (2, 1), (3, 4)} Determine the following. (g f)(1) = (g f)(2) = (g f)(3) = (g f)(4) = (g f)(5) = g f = Rng(g f) = 16
Composition of Functions Example: Let A = {1, 2, 3, 4, 5} and consider the functions f, g : A A given by f = {(2, 4), (5, 1), (3, 2), (1, 2), (4, 3)} g = {(4, 1), (5, 4), (1, 2), (2, 1), (3, 4)} Determine the following. (g f)(1) = g(f(1)) = g(2) = 1 (g f)(2) = g(f(2)) = g(4) = 1 (g f)(3) = g(f(3)) = g(2) = 1 (g f)(4) = g(f(4)) = g(3) = 4 (g f)(5) = g(f(5)) = g(1) = 2 g f = {(1, 1), (2, 1), (3, 1), (4, 4), (5, 2)} Rng(g f) = {1, 2, 4} 17
One-To-One Function Let f : A B. We say that f is one-toone, or injective, if and only if (x 1, y) f (x 2, y) f x 1 = x 2 for all x 1, x 2 A and y B. 18
One-To-One Function Equivalently, f : A B and only if for all x 1, x 2 A is one-to-one if f(x 1 ) = f(x 2 ) x 1 = x 2 If f is one-to-one, we say f is an injection. 19
Onto Function Let f : A B. We say that f is onto, or surjective, if and only if for each y B there exists x A such that f(x) = y. That is, f is onto if and only if the range of f is equal to the codomain of f. If f is onto, we say that f is a surjection. 20
Examples Let A = {1, 2, 3, 4}, B = {a, b, c}, C = {α, β, γ} Determine if the given functions are oneto-one, onto, both or neither. 1. f : A B defined by 2. f : B C defined by 3. f : B A defined by 4. f : A C defined by f(1) = a f(2) = b f(3) = a f(4) = b f(a) = β f(b) = γ f(c) = α f(a) = 3 f(b) = 1 f(c) = 4 f(1) = α f(2) = β f(3) = β f(4) = γ 21
Proof Strategy To show f is injective Show that if f(x) = f(y), then x = y. To show f is not injective Show that there exist x and y such that f(x) = f(y) and x y. To show f is surjective Show that for each element y in the codomain there exists an element x in the domain such that f(x) = y. To show f is not surjective Show there exists an element y in the codomain such that y f(x) for any x in the domain. 22
Example Prove or disprove: The function f : Z Z defined by is injective. f(n) = 2n 3 23
Example Prove or disprove: The function f : Z Z defined by is injective. f(n) = 2n 3 f is injective. Proof: For all n, m Z we have f(n) = f(m) iff 2n 3 = 2m 3 iff 2n = 2m iff 2n 2m = 0 iff 2(n m) = 0 iff (n m) = 0 iff n = m. 24
In particular, f(n) = f(m) implies n = m for all n, m Z, which proves that f is injective. Note that we did not multiply both sides of the equation 2n = 2m by 1/2, since the codomain of f is Z and 1/2 is not an integer.
Example Prove or disprove: The function f : Z Z defined by is surjective. f(n) = 2n 3 25
Example Prove or disprove: The function f : Z Z defined by is surjective. f(n) = 2n 3 f is not surjective. The range of f contains only odd integers, therefore Rng(f) Z. For example, 0 / Rng(f) since the equation f(n) = 2n 3 = 0 has no solution in the domain Z. 26
Example Prove or disprove: The function f : Z Z defined by f(n) = is injective. n + 1 if n is odd n/2 if n is even 27
Example Prove or disprove: The function f : Z Z defined by f(n) = is injective. n + 1 if n is odd n/2 if n is even f is not injective. Let n = 1 and m = 4. Then, f(n) = f(1) = 1 + 1 = 2, and f(m) = f(4) = 4/2 = 2. Therefore f(m) = f(n), but m n. proves f is not injective. This 28
Example Prove or disprove: The function f : Z Z defined by f(n) = is surjective. n + 1 if n is odd n/2 if n is even 29
Example Prove or disprove: The function f : Z Z defined by f(n) = is surjective. n + 1 if n is odd n/2 if n is even f is surjective. Proof: We want to show that for all m Z (codomain), there exists n Z (domain) such that f(n) = m. Assume m Z. Let n = 2m. Then, n is an even integer. Therefore, f(n) = n/2 = 2m/2 = m. 30
This proves there exists an integer n, namely n = 2m, such that f(n) = m. Therefore, f is surjective. Note that if n is odd, then f(n) = n + 1 is even. So if m is an even number in the codomain, then there are both even and odd values of n that map to m. Either n = 2m (even) as above, or n = m 1 (odd), which gives f(n) = n + 1 = (m 1) + 1 = m. Since the former choice works even in the case when m is odd, there was no need to consider the latter choice for n.
Bijection A function f : A B is said to be a bijection, or one-to-one correspondence if f is both one-to-one and onto. Examples f : Z Z defined by f(n) = n + 1 f : R R defined by f(x) = 2x f : Z + Z + defined by f(n) = { n + 1 if n is odd n 1 if n is even 31
Bijection Example: Prove that f : R + (0, 1), defined by is a bijection. f(x) = 1 1 + x 32
Proof: We want to show that f is one-toone (injective) and onto (surjective). Step 1. (f is one-to-one.) For all x 1, x 2 R + we have f(x 1 ) = f(x 2 ) iff 1 = 1 1 + x 1 1 + x 2 iff 1 + x 1 = 1 + x 2 iff x 1 = x 2 In particular, f(x 1 ) = f(x 2 ) implies x 1 = x 2 for all x 1, x 2 R +, which proves that f is one-to-one. Step 2. (f is onto.) Let y = 1 1+x. Solving for x in terms of y we obtain x = 1 y 1.
Note that if 0 < y < 1, then x = 1 y 1 > 1 1 1 = 0. Therefore, for all y (0, 1), there exists x R +, namely x = 1 y 1, such that f(x) = 1 1 + x = 1 1 + ( 1 y 1) = 1 1 y = y This proves f is onto. Therefore, f is a bijection.
Image and Preimage If f : A B and S A, then the image of S under f is the set f(s) = {b B b = f(s) for some s S} If T B, then the preimage of T is the set f 1 (T ) = {a A f(a) T } 33
Image and Preimage Example: defined by f(x) = x 2. Consider the function f : R R codomain of f: range of f: If S = [ 2, 3), then f(s) = If T = ( 1, 4], then f 1 (T ) = 34
Image and Preimage Example: defined by f(x) = x 2. Consider the function f : R R codomain of f: R range of f: [0, ) If S = [ 2, 3), then f(s) = [0, 9) If T = ( 1, 4], then f 1 (T ) = [ 2, 2] 35
Image and Preimage Example: Consider the function f : R R defined by f(x) = x 2. (a) Let S = [ 2, 3). Find f(s). 36
(b) Let T = ( 1, 4]. Find f 1 (T ).
Image and Preimage Let f : A B, where A and B are nonempty sets. Prove that if S 1, S 2 A, then f(s 1 S 2 ) = f(s 1 ) f(s 2 ). 37
Proof: First assume y f(s 1 S 2 ). Then, there exists an element s S 1 S 2 such that y = f(s). Therefore y = f(s) for some s S 1, or y = f(s) for some s S 2. That is, y f(s 1 ) or y f(s 2 ). Therefore, y f(s 1 ) f(s 2 ). This proves f(s 1 S 2 ) f(s 1 ) f(s 2 ). Conversely, assume y f(s 1 ) f(s 2 ). Then, y f(s 1 ) or y f(s 2 ). Therefore, y = f(s) for some s S 1, or y = f(s) for some s S 2. Therefore, there exists s S 1 S 2 such that y = f(s). This proves f(s 1 ) f(s 2 ) f(s 1 S 2 ). Therefore, f(s 1 ) f(s 2 ) = f(s 1 S 2 ). 38
Image and Preimage Let f : A B, where A and B are nonempty sets. Prove that if T 1, T 2 B, then f 1 (T 1 T 2 ) = f 1 (T 1 ) f 1 (T 2 ) 39
Proof: For all a A, we have a f 1 (T 1 T 2 ) iff f(a) T 1 T 2 iff f(a) T 1 and f(a) T 2 iff a f 1 (T 1 ) and a f 1 (T 2 ) iff a f 1 (T 1 ) f 1 (T 2 ). Therefore, f 1 (T 1 T 2 ) = f 1 (T 1 ) f 1 (T 2 ). 40
Identity Function Let A be a set. The identity function on A is the function i A : A A defined by i A (x) = x for all x A. That is, i A = {(x, x) x A}. The identity function i A is one-to-one and onto, so it is a bijection. 41
Inverse Function Let f : A B be a bijection. The inverse function of f, denoted by f 1, is the function that assigns to an element b B the unique element a A such that f(a) = b. That is, f 1 (b) = a if and only if f(a) = b If f has an inverse function, we say that f is invertible. Note that we use the notation f 1 (T ) to denote the preimage of a set T B, even when f is not invertible. 42
Examples Let A = {1, 2, 3, 4}, B = {a, b, c}, C = {α, β, γ}. Determine if each function invertible. If so, find f 1. 1. f : B C defined by f(a) = β f(b) = γ f(c) = α 2. f : A B defined by f(1) = a f(2) = b f(3) = a f(4) = b 43
Example Determine if each function invertible. If so, find f 1. 1. f : Z Z defined by f(n) = n + 1 2. f : R R defined by f(x) = 2x + 3 3. f : R R defined by f(x) = x 2 44