620 likes | 759 Views
Chap. 5 Relations and Functions. Cartesian Product. For sets A, B the Cartesian product, or cross product, of A and B is denoted by A ╳ B and equals {( a, b ) |a ∈ A, b ∈ B } . e.g. Let A= {2, 3, 5}, B ={5, 6}. Then, a) A ╳ B = {(2,5), (2,6), (3,5), (3,6), (5,5), (5,6)}.
E N D
Cartesian Product For sets A, B the Cartesian product, or cross product, of A and B is denoted by A╳B and equals {(a, b)|a∈A, b∈B}. e.g. Let A={2, 3, 5}, B={5, 6}. Then, a) A╳B={(2,5), (2,6), (3,5), (3,6), (5,5), (5,6)}. b) B╳A={(5,2), (5,3), (5,5), (6,2), (6,3), (6,5)}. c) B2=B╳B= d) B3=B╳B╳B={(a,b,c)|a,b,c∈B}; for instance, (5,5,6)∈B3. {(5,5), (5,6), (6,5), (6,6)}.
Binary Relation For sets A, B, any subset of A╳Bis called a (binary) relation from A to B. Any subset of A╳A is called a (binary) relation on A. e.g. Let A={2, 3, 5}, B={5, 6}. Which one of the following is a relation from A to B? a) ∅. b) {(3,5), (3,6), (5,6)}. c) {(2,5), (2,6), (6,5)}. d) A╳B. O O X O
Number of Relations e.g. Let A={2, 3, 5}, B={5, 6}. How many relations are from A to B? 2 2 2 2 2 2 |A╳B| The number of relations from A to B is 26.
Theorem 5.1 For any sets A, B, C ⊆U, A╳(B∩C)=(A╳B)∩(A╳C) pf. 1. It suffices to show for all a, b∈U, (a,b)∈A╳(B∩C) ⇔ (a,b)∈(A╳B)∩(A╳C) 2. (a,b)∈A╳(B∩C) ⇔ a∈A and b∈B∩C ⇔ a∈A, b∈B and a∈A, b∈C ⇔ (a,b)∈A╳B and (a,b)∈A╳C ⇔ (a,b)∈(A╳B)∩(A╳C)
Theorem 5.1 (2) • For any sets A, B, C ⊆U, • A╳(B∩C)=(A╳B)∩(A╳C) • A╳(B⋃C)=(A╳B)⋃(A╳C) • (A∩B)╳C=(A╳C)∩(B╳C) • (A⋃B)╳C=(A╳C)⋃(B╳C)
Function For nonempty sets A, B, a function, or mapping, f from A to B, denoted f: A→B, is a relation from A to B in which every element of A appears exactly once as the first component of an ordered pair in the relation. e.g. Let A={2, 3, 5}, B={5, 6}. Which of the following is a function from A to B? a) {(2,5), (3,6), (5,5)}. b) {(2,5), (2,6), (3,5), (5,5), (5,6)}. c) {(2,6), (3,5)}. O X X
Domain and Range For the function f: A→B, A is called the domain of fand B the codomain of f. The subset of B consisting of those elements that appear as second components in the ordered pairs of f is called the range of fand is also denoted by f(A) because it is the set of images (of the elements of A) under f. Range Domain Codomain
Domain and Range e.g. Let A={2, 3, 5}, B={5, 6, 7}. f={(2,5), (3,6), (5,5)}. Then, the domian of f is {2, 3, 5}, the codomain of f is {5, 6, 7}, and the range of f is {5, 6}.
Number of Functions e.g. Let A={2, 3, 5}, B={5, 6}. How many functions are from A to B? sol. The number of functions from A to B is 23.
One-to-One Function A function f: A→B is called one-to-one, or injective, if each element of B appears at most once as the image of an element of A. e.g. Let A={2, 3, 5}, B={5, 6, 7, 8}. Which of the following is a one-to-one function from A to B? a) {(2,5), (3,6), (5,7)}. b) {(2,5), (3,6), (5,6)}. O X
Example 5.13 Given the function f:R→Rwhere f(x)=3x+7 for all x∈R. Show that the given function f is one-to-one. sol. 1. It suffices to show f(x1)=f(x2) ⇒ x1=x2for all x1, x2∈R. 2. f(x1)=f(x2) ⇒ 3x1+7= 3x2+7 ⇒ x1=x2
Number of One-to-One Functions e.g. Let A={2, 3, 5}, B={5, 6, 7, 8}. How many one-to-one functions are from A to B? sol. The number of one-to-one functions from A to B is 4╳3╳2.
The Image of a Subdomain If f: A→B and A1⊆ A, then f(A1)={b∈B|b=f(a) for some a∈A1}, and f(A1)is called the image of A1 under f. e.g. For A={1, 2, 3, 4, 5} and B={w, x, y, z}, let f: A→B be given by f={(1, w), (2, x), (3, x), (4, y), (5, y)}. Then for A1={1, 2}, A2={2, 3, 4, 5}, what are f(A1) and f(A2)? f(A1)={f(a)|a ∈A1}= f(A2)={f(a)|a ∈A2}= {w, x}; {x, y}.
Theorem 5.2 Let f: A→B, with A1, A2⊆ A. Then f(A1∩A2) ⊆ f(A1)∩f(A2) pf. 1. It suffices to show for all b∈B, b∈f(A1∩A2)⇒b∈f(A1)∩f(A2) 2. b∈f(A1∩A2) ⇒b=f(a) for some a∈A1∩A2 ⇒b=f(a) for some a∈A1 and b=f(a) for some a∈A2 ⇒b∈f(A1)and b∈f(A2) ⇒b∈f(A1)∩f(A2)
Remark A1 1 x 2 A2 y 3 Let f: A→B, with A1, A2⊆ A. Then f(A1∩A2)⊇f(A1)∩f(A2) pf. 1. It suffices to show for all b∈ B, b∈f(A1∩A2)⇐b∈f(A1)∩f(A2) 2. b∈f(A1∩A2) ⇐b=f(a) for some a∈A1∩A2 ⇐b=f(a) for some a∈A1and b=f(a) for some a∈A2 ⇐b∈f(A1)and b∈f(A2) ⇐b∈f(A1)∩f(A2) ? ? X ? ?
Remark A1 1 x 2 A2 y 3 Let f: A→B, with A1, A2⊆ A. Then f(A1∩A2)⊇f(A1)∩f(A2). f(A1∩A2)={x}. f(A1)∩f(A2) = {x, y}.
Remark A1 1 x 2 A2 y 3 Let f: A→B, with A1, A2⊆ A. Then, when does f(A1∩A2)⊇f(A1)∩f(A2) hold? pf. 1. It suffices to show for all b∈ B, b∈f(A1∩A2)⇐b∈f(A1)∩f(A2) 2. b∈f(A1∩A2) ⇐b=f(a) for some a∈A1∩A2 ⇐b=f(a) for some a∈A1and b=f(a) for some a∈A2 ⇐b∈f(A1)and b∈f(A2) ⇐b∈f(A1)∩f(A2) if f is one-to-one X
Theorem 5.1 (2) Let f: A→B, with A1, A2⊆ A. Then a) f(A1∪A2) =f(A1)∪f(A2) b) f(A1∩A2) ⊆ f(A1)∩f(A2) c) f(A1∩A2) =f(A1)∩f(A2) when f is one-to-one
Onto Function A function f: A→B is called onto, or surjective, if f (A)=B—that is, if for all b∈B there is at least one a∈A with f(a)=b. e.g. Which of the following is a onto function? (a) f1: A→Bdefined by f1={(1,z), (2,y), (3,x), (4,y)}, where A={1, 2, 3, 4} and B={x, y, z}. (b) f2: R→R defined by f(x)=x3. (c) f3: Z→Z defined by f(x)= 3x+1. O O X
Number of Onto Functions • e.g. Let A={w, x, y, z}, B={1, 2, 3}. How many onto functions are from A to B? • Number of functions from A to B is • Number of functions from A to {1, 2} is • Number of functions from A to {1} is • 4. Then, we have number of onto functions from A to B is 34-3·24-3·14. • 5. 34. 24. 14. The functions from A to {1} is also counted in the number of functions from A to {1, 2} and in the number of functions from A to {1, 3}.
Number of Onto Functions no 1 no 2 no 3 U: A {1, 2, 3} no 1: A {2, 3} no 2: A {1, 3} no 3: A {1, 2} no 1,2: A {3} no 1,3: A {2} no 2,3: A {1} no 1,2,3: A { } The number of onto functions from A to B is |U|-|no 1no 2no 3| = |U|-(|no 1|+|no 2|+|no 3|-(|no 1,2|+|no 1,3|+|no 2,3|)+|no 1,2,3|) = m 4 1· 34-3·24+3·14- 0=36. 1· Let |A|=m, |B|=n. n n-3 n-1 n-2 C(3,2) C(3,1) C(3,0) C(n,n) C(3,3) C(n,n-1) C(n,n-2) C(n,n-3)
Example 5.26 How many ways are there to distribute four distinct objects into three distinguishable containers, with no container empty? 36 because the number of ways to distribute four distinct objects into three distinguishable containers, with no container empty is equal to the number of onto functions from A={w, x, y, z}to B={1, 2, 3}.
Example 5.26 (2) How many ways to distribute four distinct objects into three identical containers, with no container empty? The following distributions become identical. 1) {a, b}1 {c}2 {d}32) {a, b}1 {d}2 {c}3 3) {c}1 {a, b}2 {d}34) {c}1 {d}2 {a, b}3 5) {d}1 {a, b}2 {c}36) {d}1 {c}2 {a, b}3, Therefore, the number of ways is 36/3!.
63+301╳3=966 301+350╳4=1701 ⇒S(m+1,n)=S(m,n−1)+nS(m, n).
Theorem 5.3 • Let m, n be positive integers with 1<n≤m. Then S(m+1,n)=S(m,n−1)+nS(m, n). • The number of distributions to place a1, a2, …, am+1 in n identical containers with none left empty (N1) is equal to the number of distributions to place a1, a2, …, am+1 in n identical containers with none left empty in which am+1 is in a container by itself (N2) plus the number of distributions to place a1, a2, …, am+1 in n identical containers with none left empty in which am+1 is not in a container by itself (N3) . • 4. n times the number of distributions to place a1, a2, …, am in n identical containers with none left empty N1=N2+N3. N1= S(m+1,n). N2= S(m,n−1). N3= =nS(m,n).
Unary and Binary Operations For any nonempty sets A, B, any function f: A╳A→Bis called a binary operation on A. A function g: A→Ais called a unary, or monary, operation on A. e.g. (a) The function h: R+→R+ defined by h(a)=1/a is a unary operation on R+. (b) The function f: Z╳Z→Z defined by f(a, b)=a−b is a binary operation on R.
Closed Binary Operation If B⊆A, then the binary operation is said to be closed (on A). (When B⊆A we may also say that A is closed under f.) e.g. Which of the following binary operation is closed? (a) f: Z╳Z→Z, defined by f(a, b)=a−b. (b) g: Z+╳Z+→Z, defined by g(a, b)=a−b. O X
CommutativeBinary Operation Let f : A╳A→B. Then f is said to be commutative if f(a, b)=f(b, a)for all (a, b)∈A╳A. e.g. Which of the following binary operation is commutative? (a) Let U be a universe, and let A, B⊆U. f: P(U)╳P(U)→P(U) defined by f(A, B)=A∪B. (b) f: Z╳Z→Z, defined by f(a, b)=a−b. O X Why are they not U?
Number of Closed Binary Operations (a,a) (a,b) (a,c) (a,d) a (b,a) (b,b) b (b,c) (b,d) c (c,a) (c,b) d (c,c) (c,d) (d,a) (d,b) (d,c) (d,d) Let A = {a, b, c, d}. The number of closed binary operations is 416. # of f(a,a) 4 # of f(a,b) 4 4 # of f(a,c) # of f(a,d) 4 # of f(b,a) 4 # of f(b,b) 4 # of f(b,c) 4 4 # of f(b,d) # of f(c,a) 4 # of f(c,b) 4 4 # of f(c,c) 4 # of f(c,d) # of f(d,a) # of f(d,b) # of f(d,c) # of f(d,d) 4 4 4 4
Number of Commutative Closed Binary Operations Let A= {a, b, c, d}. The number of commutative closed binary operations is 410. 4 1 1 1 4 4 1 1 4 4 4 1 4 4 4 4
Identity Let f: A╳A→B be a binary operation on A. An element x∈A is called an identity(or identity element) for f if f(a, x)=f(x, a)=a, for all a∈A. e.g. For the (closed) binary operation f : Z╳Z→Z, where f(a, b)=a+b, what is an identity? why? 0 f(a, 0)=a+0=a=0+a=f(0, a).
Number of Closed Binary Operations with Identities If A={x, a, b, c, d}, how many closed binary operations on A have x as the identity? Ans: 516. 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
Number of Commutative Closed Binary Operations with Identities If A={x, a, b, c, d}, how many commutative closed binary operations on A have x as the identity? Ans: 510. 5 1 1 1 5 5 1 1 5 5 5 1 5 5 5 5
THEOREM 5.4 Let f: A╳A→B be a binary operation. If f has an identity, then that identity is unique. pf. 1. It suffices to show x1, x2∈A are identities of f⇒x1=x2. 2. Because x1 is identity of f, f(x1, x2)=x2. 3. Because x2 is identity of f, f(x1, x2)=x1. 4. This implies x1=x2.
The Pigeonhole Principle If m pigeons occupy n pigeonholes and m>n, then at least one pigeonhole has two or more pigeons roosting in it. e.g. An office employs 13 file clerks, so at least two of them must have birthdays during the same month.
Example 5.43 Prove that if 101 integers are selected from the set S ={1, 2, 3, . . . , 200}, then there are two integers such that one divides the other. pf. 1. For each x∈S, we may write x=2ky, with k ≥ 0, and gcd(2,y)=1. 2. y ∈T={1, 3, 5, . . . , 199}, where |T|=100. 3. By the pigeonhole principle there are two distinct integers of the form a=2my, b=2ny for some (the same) y∈T . 4. a and b are the desired two integers.
Example 5.44 Any subset of size 6 from the set S {1, 2, 3, . . . , 9} must contain two elements whose sum is 10. pf. 1. Here the pigeons constitute a six-element subset of {1, 2, 3, . . . , 9}, and the pigeonholes are the subsets {1, 9}, {2, 8}, {3, 7}, {4, 6}, {5}. 2. When the six pigeons go to their respective pigeonholes, they must fill at least one of the two-element subsets whose members sum to 10.
One-to-One Correspondence If f : A→B, then f is said to be bijective, or to be a one-to-one correspondence, if f is both one-to-one and onto. e.g. Let A={1, 2, 3, 4} and B={w, x, y, z}. Which of the following function is a one-to-one correspondence? (a) f={(1, w), (2, x), (3, y), (4, z)}. (b) f={(w, 1), (x, 2), (y, 3), (z, 4)}. (c) f={(1, w), (2, x), (3, y), (4, y)}. (d) f={(1, w), (2, x), (3, y), (3, z)}. O O X X
Identity Function The function IA: A→A, defined by IA(a)=a for all a∈A, is called the identity function for A. If f, g: A→B, we say that f and g are equal and write f=g, if f(a)=g(a)for all a ∈ A.
Composite Function If f : A→B and g: B →C, we define the composite function, which is denoted g◦f: A→C, by (g◦f )(a)=g(f(a)), for each a ∈ A. e.g. Let A={1, 2, 3, 4}, B={a, b, c}, and C={w, x, y, z} with f : A→B and g: B →C given by f={(1, a), (2, a), (3, b), (4, c)} and g={(a, x), (b, y), (c, z)}. Then, (g◦f)(1)= (g◦f)(2)= (g◦f)(3)= (g◦f)(4)= So, g◦f= g(f(1))=g(a)=x. g(f(2))=g(a)=x. g(f(3))=g(b)=y. g(f(4))=g(c)=z. {(1, x), (2, x), (3, y), (4, z)}.
THEOREM 5.5 Let f: A→B and g: B →C. If f and g are one-to-one, then g◦f is one-to-one. pf. 1. It suffices to show (g◦f)(a1)=(g◦f)(a2) for a1, a2∈A⇒a1=a2. 2. (g◦f)(a1)=(g◦f)(a2) ⇒ g(f(a1))= g(f(a2)) ⇒ f(a1))= f(a2) ⇒ a1=a2 because g is one-to-one. because f is one-to-one.
THEOREM 5.5 (2) Let f: A→B and g: B →C. If f and g are onto, then g◦f is onto. pf. 1. It suffices to show z∈C⇒ there exists x∈A such that g(f(x))=z. 2. z∈C ⇒ there exists y∈B such that g(y)=z ⇒ there exists x∈A such that f(x)=y ⇒ there exists x∈A such that g(f(x))=z. because g is onto. because f is onto.
THEOREM 5.6 Let f: A→B,g: B →C, and h: C →D, then (h◦g)◦f = h◦(g◦f). pf. 1. Since the two functions have the same domain, , and codomain, , it suffices to show ((h◦g)◦f)(x) = (h◦(g◦f))(x) for every x∈A. A D
THEOREM 5.6 2. (g◦f)(x)=g(f(x)). 3. (h◦(g◦f))(x) = h(g(f(x))). 4. Similarly, ((h◦g)◦f)(x) = h(g(f(x))).