Presentation is loading. Please wait.

Presentation is loading. Please wait.

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,

Similar presentations


Presentation on theme: "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,"— Presentation transcript:

1 Chap. 5 Relations and Functions

2 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) B 2 =B ╳ B= d) B 3 =B ╳ B ╳ B={(a,b,c)|a,b,c ∈ B}; for instance, (5,5,6) ∈ B 3. {(5,5), (5,6), (6,5), (6,6)}.

3 Binary Relation For sets A, B, any subset of A ╳ B is 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 O X

4 Number of Relations e.g. Let A={2, 3, 5}, B={5, 6}. How many relations are from A to B? 26.26. 22 22 22 The number of relations from A to B is |A ╳ B|

5 Number of Relations (2)

6 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)

7 Theorem 5.1 (2) For any sets A, B, C ⊆ U, a)A ╳ (B∩C)=(A ╳ B)∩(A ╳ C) b)A ╳ (B ⋃ C)=(A ╳ B) ⋃ (A ╳ C) c)(A∩B) ╳ C=(A ╳ C)∩(B ╳ C) d)(A ⋃ B) ╳ C=(A ╳ C) ⋃ (B ╳ C)

8 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

9 Domain and Range For the function f: A→B, A is called the domain of f and 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 f and is also denoted by f(A) because it is the set of images (of the elements of A) under f. DomainCodomain Range

10 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}.

11 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.23.

12 Number of Functions (2)

13 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

14 Example 5.13 Given the function f: R→R where 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(x 1 )=f(x 2 ) ⇒ x 1 =x 2 for all x 1, x 2 ∈ R. 2. f(x 1 )=f(x 2 ) ⇒ 3x 1 +7= 3x 2 +7 ⇒ x1=x2⇒ x1=x2

15 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.

16 Number of One-to-One Functions

17 The Image of a Subdomain If f: A→B and A 1 ⊆ A, then f(A 1 )={b ∈ B|b=f(a) for some a ∈ A 1 }, and f(A 1 ) is called the image of A 1 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 A 1 ={1, 2}, A 2 ={2, 3, 4, 5}, what are f(A 1 ) and f(A 2 )? f(A 1 )={f(a)|a ∈ A 1 }= f(A 2 )={f(a)|a ∈ A 2 }= {x, y}. {w, x};

18 Theorem 5.2 Let f: A→B, with A 1, A 2 ⊆ A. Then f(A 1 ∩A 2 ) ⊆ f(A 1 )∩f(A 2 ) pf. 1. It suffices to show for all b ∈ B, b∈f(A1∩A2) ⇒ b∈f(A1)∩f(A2)b∈f(A1∩A2) ⇒ b∈f(A1)∩f(A2) 2. b ∈ f(A 1 ∩A 2 ) ⇒ b=f(a) for some a ∈ A 1 ∩A 2 ⇒ b=f(a) for some a ∈ A 1 and b=f(a) for some a ∈ A 2 ⇒ b ∈ f(A 1 ) and b ∈ f(A 2 ) ⇒ b∈f(A1)∩f(A2)⇒ b∈f(A1)∩f(A2)

19 Remark Let f: A→B, with A 1, A 2 ⊆ A. Then f(A1∩A2)⊇f(A1)∩f(A2)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)b∈f(A1∩A2) ⇐ b∈f(A1)∩f(A2) 2. b ∈ f(A 1 ∩A 2 ) ⇐ b=f(a) for some a ∈ A 1 ∩A 2 ⇐ b=f(a) for some a ∈ A 1 and b=f(a) for some a ∈ A 2 ⇐ b ∈ f(A 1 ) and b ∈ f(A 2 ) ⇐ b∈f(A1)∩f(A2)⇐ b∈f(A1)∩f(A2) X ? ? ? ? 1 2 3 x y A1A1 A2A2

20 Remark Let f: A→B, with A 1, A 2 ⊆ A. Then f(A 1 ∩A 2 ) ⊇ f(A 1 )∩f(A 2 ). 1 2 3 x y A1A1 A2A2 f(A 1 ∩A 2 ) = {x}. f(A 1 )∩f(A 2 ) = {x, y}.

21 Remark Let f: A→B, with A 1, A 2 ⊆ A. Then, when does f(A 1 ∩A 2 ) ⊇ f(A 1 )∩f(A 2 ) hold? pf. 1. It suffices to show for all b ∈ B, b∈f(A1∩A2) ⇐ b∈f(A1)∩f(A2)b∈f(A1∩A2) ⇐ b∈f(A1)∩f(A2) 2. b ∈ f(A 1 ∩A 2 ) ⇐ b=f(a) for some a ∈ A 1 ∩A 2 ⇐ b=f(a) for some a ∈ A 1 and b=f(a) for some a ∈ A 2 ⇐ b ∈ f(A 1 ) and b ∈ f(A 2 ) ⇐ b∈f(A1)∩f(A2)⇐ b∈f(A1)∩f(A2) if f is one-to-one X 1 2 3 x y A1A1 A2A2

22 Theorem 5.1 (2) Let f: A→B, with A 1, A 2 ⊆ A. Then a) f(A 1 ∪ A 2 ) = f(A 1 ) ∪ f(A 2 ) b) f(A 1 ∩A 2 ) ⊆ f(A 1 )∩f(A 2 ) c) f(A 1 ∩A 2 ) = f(A 1 )∩f(A 2 ) when f is one-to-one

23 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) f 1 : A→B defined by f 1 ={(1,z), (2,y), (3,x), (4,y)}, where A={1, 2, 3, 4} and B={x, y, z}. (b) f 2 : R→R defined by f(x)=x 3. (c) f 3 : Z→Z defined by f(x)= 3x+1. O X O

24 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? 1. Number of functions from A to B is 2. Number of functions from A to {1, 2} is 3. Number of functions from A to {1} is 4. Then, we have number of onto functions from A to B is 3 4 -3·2 4 -3·1 4. 5. 34.34. 24.24. 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}. 14.14.

25 Number of Onto Functions 3 4 -3·2 4 +3 · 1 4 - 0=36. no 1no 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 1  no 2  no 3| = |U|-(|no 1|+|no 2|+|no 3|-(|no 1,2|+|no 1,3|+|no 2,3|)+|no 1,2,3|) = C(3,2)C(3,1) C(n,n-1) Let |A|=m, |B|=n.1· C(3,3) C(3,0) C(n,n) C(n,n-2) C(n,n-3) n n-1 n-2 n-3 4 m

26 Number of Onto Functions

27 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}.

28 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} 3 2) {a, b} 1 {d} 2 {c} 3 3) {c} 1 {a, b} 2 {d} 3 4) {c} 1 {d} 2 {a, b} 3 5) {d} 1 {a, b} 2 {c} 3 6) {d} 1 {c} 2 {a, b} 3, Therefore, the number of ways is 36/3!.

29 Stirling Number of the Second Kind

30 63+301 ╳ 3=966 301+350 ╳ 4=1701 ⇒ S(m+1,n)=S(m,n−1)+nS(m, n).

31 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). 1.The number of distributions to place a 1, a 2, …, a m+1 in n identical containers with none left empty (N 1 ) is equal to the number of distributions to place a 1, a 2, …, a m+1 in n identical containers with none left empty in which a m+1 is in a container by itself (N 2 ) plus the number of distributions to place a 1, a 2, …, a m+1 in n identical containers with none left empty in which a m+1 is not in a container by itself (N 3 ). 2. 3. 4. n times the number of distributions to place a 1, a 2, …, a m in n identical containers with none left empty N1=N1=N2=N2=S(m,n−1).S(m+1,n). N3=N3= =nS(m,n). N 1 =N 2 +N 3.

32 Unary and Binary Operations For any nonempty sets A, B, any function f: A ╳ A→B is called a binary operation on A. A function g: A→A is 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.

33 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

34 Commutative Binary 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?

35 Number of Closed Binary Operations Let A = {a, b, c, d}. The number of closed binary operations is 4 16. 4444 4444 4444 4444 # of f(a,a) # of f(a,b) # of f(a,c) # of f(a,d) # of f(b,a) # of f(b,b) # of f(b,c) # of f(b,d) # of f(c,a) # of f(c,b) # of f(c,c) # of f(c,d) # of f(d,a) # of f(d,b) # of f(d,c) # of f(d,d) (a,a) (a,b) (a,c) (a,d) (b,a) (b,b) (b,c) (b,d) (c,a) (c,b) (c,c) (c,d) (d,a) (d,b) (d,c) (d,d) a b c d

36 Number of Commutative Closed Binary Operations Let A= {a, b, c, d}. The number of commutative closed binary operations is 4 10. 4111 4141 4441 4444

37 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).

38 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: 5 16. 5555 5555 5555 5555

39 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: 5 10. 5111 5151 5551 5555

40 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 x 1, x 2 ∈ A are identities of f ⇒ x 1 =x 2. 2. Because x 1 is identity of f, f(x 1, x 2 )=x 2. 3. Because x 2 is identity of f, f(x 1, x 2 )=x 1. 4. This implies x 1 =x 2.

41 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.

42 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=2 k y, 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=2 m y, b=2 n y for some (the same) y ∈ T. 4. a and b are the desired two integers.

43 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.

44 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 X O X

45 Identity Function The function I A : A→A, defined by I A (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.

46 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= {(1, x), (2, x), (3, y), (4, z)}. g(f(1))=g(a)=x. g(f(2))=g(a)=x. g(f(3))=g(b)=y. g(f(4))=g(c)=z.

47 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)(a 1 )=(g ◦ f)(a 2 ) for a 1, a 2 ∈ A ⇒ a 1 =a 2. 2. (g ◦ f)(a 1 )=(g ◦ f)(a 2 ) ⇒ g(f(a 1 ))= g(f(a 2 )) ⇒ f(a 1 ))= f(a 2 ) ⇒ a 1 =a 2 because g is one-to-one. because f is one-to-one.

48 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.

49 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. AD

50 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))).

51 Converse of Relation For sets A, B, if R is a relation from A to B, then the converse of R, denoted R c, is the relation from B to A defined by R c ={(b, a)|(a, b) ∈ R }. e.g. With A={1, 2, 3, 4}, B={w, x, y}, and R ={(1,w), (2,w), (3,x)}. Then, Rc=Rc= {(w, 1), (w, 2), (x, 3)}.

52 Invertible Function If f: A→B, then f is said to be invertible if there is a function g: B→A such that g ◦ f=I A and f ◦ g=I B. e.g. Let f: R→R be defined by f(x)=2x+5. Find the invertible function of f. Let g: R→R be the invertible function of f. Then, g(f(x))=I A (x)=x. ⇒ g(2x+5)=x. ⇒ g(2x+5)=((2x+5)-5)/2. ⇒ g(x)=(x-5)/2.

53 THEOREM 5.7 If a function f: A→B is invertible and a function g: B→A satisfies g ◦ f=I A and f ◦ g=I B, then this function g is unique. pf. 1. Let h: B→A be another function with h ◦ f=I A and f ◦ h=I B. It suffices to show h=g.h=g. 2. h=h ◦ I B =h◦(f◦g)=h◦(f◦g) =(h ◦ f ) ◦ g =I A ◦ g=g.

54 THEOREM 5.8 A function f: A→B is invertible if and only if it is one-to-one and onto.

55 THEOREM 5.8 (Proof of only if part) f is invertible ⇒ f is one-to-one and onto (f: A→B). pf. 1. Let g be the invertible function of f. To show f is one-to-one, it suffices to show a 1, a 2 ∈ A with f(a 1 )=f(a 2 ) ⇒ a 1 =a 2. 2. f(a 1 )=f(a 2 ) ⇒ g(f(a 1 ))=g(f(a 2 )) ⇒ a1=a2⇒ a1=a2 3. To show f is onto, it suffices to show for any b ∈ B, b=f(a) for some a ∈ A. 4. g(b) ∈ A and f(g(b))=b because f ◦ g=I B. 5. Therefore, g(b) is the desired a. because g ◦ f=I A.

56 THEOREM 5.8 (Proof of if part) f is invertible ⇐ f is one-to-one and onto (f: A→B). pf. 1. It suffices to show there is a function g: B→A such that g ◦ f= and f ◦ g=. 2. Since f is onto, for each b ∈ B there is an a ∈ A with f(a)=b. 3. Define the function g: B→A by g(b)=a. 4. g is unique because f is one-to-one. 5. Clearly, g(f(a))=g(b)=a, implying g ◦ f=I A. 6. And, f(g(b))=f(a)=b, implying f ◦ g=I B. IAIA IBIB

57 THEOREM 5.9 If f: A→B, g: B →C are invertible functions, then g ◦ f: A→C is invertible and (g ◦ f) −1 = f −1 ◦ g −1. pf. 1. f and g each are one-to-one and onto by Theorem 5.8. 2. g ◦ f is one-to-one and onto by 3. g ◦ f is invertible by 4. Suppose that f(a)=b and g(b)=c, where a ∈ A, b ∈ B, and c ∈ C. 5. Clearly, (g ◦ f) −1 (c)=a=f -1 (b)=f -1 (g -1 (c)), implying (g ◦ f) −1 = f −1 ◦ g −1. Theorem 5.5. Theorem 5.8.

58 Preimage If f: A→B and B 1 ⊆ B, then f −1 (B 1 )={x ∈ A|f (x) ∈ B 1 }. The set f −1 (B 1 ) is called the preimage of B 1 under f. e.g. Let A={1, 2, 3, 4, 5, 6} and B={6, 7, 8, 9, 10}. If f: A→B with f={(1, 7), (2, 7), (3, 8), (4, 6), (5, 9), (6, 9)}, then for B 1 ={6, 8} ⊆ B, f −1 (B 1 )= {3, 4}. Remark: Here, f is not necessary to be invertible.

59 Example 5.63 What is f -1 [-5,-5]?

60 Example 5.63 Sol: f -1 [-5,-5]=[-4/3,10/3].

61 Theorem 5.10 Proof of (b): 1. It suffices to show for a ∈ A, a ∈ f -1 (B 1 ⋃B 2 ) ⇔ a ∈ f -1 (B 1 ) ⋃ f -1 (B 2 ). 2. a ∈ f -1 (B 1 ⋃ B 2 ) ⇔ f(a) ∈ B 1 ⋃ B 2 ⇔ f(a) ∈ B 1 or f(a) ∈ B 2 ⇔ a ∈ f -1 (B 1 ) or a ∈ f -1 (B 2 ) ⇔ a ∈ f -1 (B 1 ) ⋃ f -1 (B 2 ).

62 Theorem 5.11 1.By Theorem 5.8, (a) and (b) ⇔ (c). It suffices to show 2. (Proof of (a) ⇒ (b)). If f is one-to-one, |A|=. Then =|B|, implying f is onto. 3. (Proof of (b) ⇒ (a)). If f is onto, =|B|. Then =|A|, implying f is one-to-one. (a) ⇔ (b). |f(A)|


Download ppt "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,"

Similar presentations


Ads by Google