Download presentation

Presentation is loading. Please wait.

Published byAmia Hogan Modified over 2 years ago

1
CHAPTER 7 Functions Functions Reading: Epp Chp 7.1, 7.2, 7.4

2
Overview n Functions –Definition –Visualization Tool –Examples –Notation –Identity Function n Definitions –Domain, codomain, range –Image, inverse image –Let f:A B and let S A and T B. S InvImg f (Img f (S)) Img f (InvImg f (T)) T n Operations on Functions –Set related (,, ): 1.If f g is a function, then f = g 2.If f g is a function, then f = g 3.If f g is a function, then f g= –Inverse n One-to-one and Onto Functions

3
1. Definition: Function n Given a relation R from a set A to a set B, R is a function iff 1. x A, y B, x R y 2. x A, y 1,y 2 B, x R y 1 x R y 2 y 1 = y 2.

4
1. Definition: Function n Given a relation R from a set A to a set B, R is a function iff 1. x A, y B, x R y 2. x A, y 1,y 2 B, x R y 1 x R y 2 y 1 = y 2. A function is a relation. Its just a special kind of relation – a relation with 2 restrictions.

5
1. Definition: Function n Given a relation R from a set A to a set B, R is a function iff 1. x A, y B, x R y 2. x A, y 1,y 2 B, x R y 1 x R y 2 y 1 = y 2. 1.Every element in A must be associated with AT LEAST one element in B. Extract the meaning from the logical expression. AB R

6
1. Definition: Function n Given a relation R from a set A to a set B, R is a function iff 1. x A, y B, x R y 2. x A, y 1,y 2 B, x R y 1 x R y 2 y 1 = y An element in A can only be associated with AT MOST one element in B. Extract the meaning from the logical expression. AB R

7
1. Definition: Function n Given a relation R from a set A to a set B, R is a function iff 1. x A, y B, x R y 2. x A, y 1,y 2 B, x R y 1 x R y 2 y 1 = y 2. 1 and 2 taken together: Every element in A can only be associated with EXACTLY ONE element in B. Extract the meaning from the logical expression. AB R

8
2. Visualisation Tool: Arrow Diagram n Given a relation R from a set A to a set B, R is a function iff 1. x A, y B, x R y 2. x A, y 1,y 2 B, x R y 1 x R y 2 y 1 = y 2. ABf Not a function

9
2. Visualisation Tool: Arrow Diagram n Given a relation R from a set A to a set B, R is a function iff 1. x A, y B, x R y 2. x A, y 1,y 2 B, x R y 1 x R y 2 y 1 = y 2. Yes, its a function. ABf

10
2. Visualisation Tool: Arrow Diagram n Given a relation R from a set A to a set B, R is a function iff 1. x A, y B, x R y 2. x A, y 1,y 2 B, x R y 1 x R y 2 y 1 = y 2. Not a function ABf

11
3. Examples n Given a relation R from a set A to a set B, R is a function iff 1. x A, y B, x R y 2. x A, y 1,y 2 B, x R y 1 x R y 2 y 1 = y 2. Example 1: Is R a function? No. (Cond 1) No. (Cond 2) Yes. R = {(1,2)} R A x B A {1,2,3} B R = {(1,2),(2,3),(1,3)} {1,2,3} R = {(1,1),(2,1),(3,1)} {1,2,3} {1,2,3,4} {1,2,3} R = {(1,1),(2,2),(3,3)} No. (Cond 1) {1,2,3} {1,2,3,4} R = {(1,1),(2,2),(3,3)} Yes.

12
3. Examples n Given a relation R from a set A to a set B, R is a function iff 1. x A, y B, x R y 2. x A, y 1,y 2 B, x R y 1 x R y 2 y 1 = y 2. Example 2: Let R Q x Z such that… (i)x R y iff x = y. Q: Is R a function? A: No (1 st Condition: ½ maps to nothing) QZ ½? (ii)(a/b) R c iff a.b = c. Q: Is R a function? A: Yes

13
3. Examples n Given a relation R from a set A to a set B, R is a function iff 1. x A, y B, x R y 2. x A, y 1,y 2 B, x R y 1 x R y 2 y 1 = y 2. Example 3: Let R Z x Z such that… (i)x R y iff y = x 2. Q: Is R a function? A: Yes. (ii)x R y iff x = y 2. Q: Is R a function? A: No. (1 st and 2 nd Condition violated) ZZ 3? 1 1

14
3. Examples n Functions in real life: 1.Hamming distance function. 2.Encoding/decoding functions. 3.Boolean functions. 4.A program is a function.

15
Eg. 3: F Z x {0,1}, a F b iff (a is even b=1) (a is odd b=0) 4. Notation n We usually use f,g,h,F,G,H to denote functions. If the relation f A x B is a function, we write it as: f : A B If there is a way to compute y B from any given x A, we usually write f(x) in place of y. We will write it as: Eg. 1: F Z x Z, x F y iff y = x 2. F is a function. F : Z Z, F(x) = x 2 We will write it as: Eg. 2: F Z x Z, x F y iff y = x 2 + 2x + 1 F : Z Z, F(x) = x 2 + 2x + 1 F : Z {0,1}, F(x) = 1,if x is even 0,otherwise

16
4. Notation n We usually use f,g,h,F,G,H to denote functions. If the relation f A x B is a function, we write it as: f : A B If there is a way to compute y B from any given x A, we usually write f(x) in place of y. Therefore, the definitions instead of… 1. x A, y B, x R y 2. x A, y 1,y 2 B, x R y 1 x R y 2 y 1 =y x A, y B, y = f(x) 2. x A, y 1,y 2 B, y 1 =f(x) y 2 =f(x) y 1 =y 2. … can be also expressed as…

17
5. The identity function. n The identity function on any given set, is a function that maps every element to itself. id A : A A, x A, id A (x) = x

18
Overview n Functions –Definition –Visualization Tool –Examples –Notation –Identity Function n Definitions –Domain, codomain, range –Image, inverse image –Let f:A B and let S A and T B. S InvImg f (Img f (S)) Img f (InvImg f (T)) T n Operations on Functions –Set related (,, ): 1.If f g is a function, then f = g 2.If f g is a function, then f = g 3.If f g is a function, then f g= –Inverse n One-to-one and Onto Functions

19
6. Definition: domain, codomain, range Given a function: f : A B, –The set A is known as the domain of f. –The set B is known as the codomain of f. –The set { y B | x A, y=f(x)} is known as the range of f. ABf

20
6. Definition: domain, codomain, range Given a function: f : A B, –The set A is known as the domain of f. –The set B is known as the codomain of f. –The set { y B | x A, y=f(x)} is known as the range of f. ABf Domain(f)

21
6. Definition: domain, codomain, range Given a function: f : A B, –The set A is known as the domain of f. –The set B is known as the codomain of f. –The set { y B | x A, y=f(x)} is known as the range of f. ABf Codomain(f)

22
6. Definition: domain, codomain, range Given a function: f : A B, –The set A is known as the domain of f. –The set B is known as the codomain of f. –The set { y B | x A, y=f(x)} is known as the range of f. ABf Range(f) NOTE: range(f) codomain(f)

23
6. Definition: domain, codomain, range Given a function: f : A B, –The set A is known as the domain of f. –The set B is known as the codomain of f. –The set { y B | x A, y=f(x)} is known as the range of f. Example 1:f : Z Z +, f(x) = |2x| a. domain(f) = Z b. codomain(f) = Z + c. range(f) = positive even numbers: {2x | x Z + }

24
6. Definition: domain, codomain, range Given a function: f : A B, –The set A is known as the domain of f. –The set B is known as the codomain of f. –The set { y B | x A, y=f(x)} is known as the range of f. Example 2: Let f : Z Z, f(x) = 2x + 1; g : Z Z, g(x) = 2x - 1 Then range(f) = range(g). Range(f) = 2x+1 = 2(x+1) – 1 = Range(g) x Z, f(x) = g(x+1)

25
7. Definition: Image, Inverse Image. Given a function: f : A B, and S A –The image of S is defined as: Img f (S) = { y B | x S, y=f(x)} AB f

26
7. Definition: Image, Inverse Image. Given a function: f : A B, and S A –The image of S is defined as: Img f (S) = { y B | x S, y=f(x)} S Image of S NOTE: Img f (S) range(f) codomain(f) AB f

27
7. Definition: Image, Inverse Image. Given a function: f : A B, and S A –The image of S is defined as: Img f (S) = { y B | x S, y=f(x)} Given a function: f : A B, and T B –The inverse image of T is defined as: InvImg f (T) = { x A | y T, y=f(x)} Inverse image of T T AB f

28
7. Definition: Image, Inverse Image. Given a function: f : A B, and S A –The image of S is defined as: Img f (S) = { y B | x S, y=f(x)} Given a function: f : A B, and T B –The inverse image of T is defined as: InvImg f (T) = { x A | y T, y=f(x)} Example:f : Z Z +, f(x) = |x| a. Img f ({10,-20}) = {10,20} b. InvImg f ({10,20}) = {10, 20, -10, -20}

29
7. Definition: Image, Inverse Image. Given a function: f : A B, and S A –The image of S is defined as: Img f (S) = { y B | x S, y=f(x)} or y Img f (S) iff x S and y=f(x) Given a function: f : A B, and T B –The inverse image of T is defined as: InvImg f (T) = { x A | y T, y=f(x)} or x InvImg f (T) iff y T and y=f(x) Axiomatic definition

30
7.1 Theorem: Image, Inverse Image. Given any function: f : A B, S A, T B 1. S InvImg f (Img f (S)) 2. Img f (InvImg f (T)) T ABf Proof of (1): ( Use diagrams to help visualise! )

31
7.1 Theorem: Image, Inverse Image. ABf S Proof of (1): ( Use diagrams to help visualize! ) Given any function: f : A B, S A, T B 1. S InvImg f (Img f (S)) 2. Img f (InvImg f (T)) T

32
7.1 Theorem: Image, Inverse Image. ABf S Proof of (1): Given any function: f : A B, S A, T B 1. S InvImg f (Img f (S)) 2. Img f (InvImg f (T)) T Assume x S Therefore x InvImg f (Img f (S)) Then y B such that y = f(x) (Since f is a function) Therefore y Img f (S) (Defn: y Img f (S) iff x S and y=f(x)) x y Therefore y Img f (S) and y = f(x) Img f (S)

33
7.1 Theorem: Image, Inverse Image. ABf Img f (S) Proof of (1): Given any function: f : A B, S A, T B 1. S InvImg f (Img f (S)) 2. Img f (InvImg f (T)) T Assume x S Therefore x InvImg f (Img f (S)) Then y B such that y = f(x) (Since f is a function) Therefore y Img f (S) (Defn: y Img f (S) iff x S and y=f(x)) Therefore y Img f (S) and y = f(x) (Defn:x InvImg f (T) iff y T and y=f(x) ) x y

34
7.1 Theorem: Image, Inverse Image. …Proof of (2) left as an exercise… (Again, the skill that you must pick up is that you must use diagrams wherever possible, to help visualize the problem and use it to help you reason about proofs) Given any function: f : A B, S A, T B 1. S InvImg f (Img f (S)) 2. Img f (InvImg f (T)) T

35
Overview n Functions –Definition –Visualization Tool –Examples –Notation –Identity Function n Definitions –Domain, codomain, range –Image, inverse image –Let f:A B and let S A and T B. S InvImg f (Img f (S)) Img f (InvImg f (T)) T n Operations on Functions –Set related (,, ): 1.If f g is a function, then f = g 2.If f g is a function, then f = g 3.If f g is a function, then f g= –Inverse n One-to-one and Onto Functions

36
8. Operations on Functions. n A function is a (special) relation. n A relation is a set (of ordered pairs). n Therefore, all definitions and operations on sets and relations are extended over to functions.

37
8.1 Equality of Functions Given 2 functions, f : A B, g : A B, f = g iff f g and g f n Or, in cases where y can be computed directly from x: f = g iff x A, y 1 =f(x) y 2 =g(x) y 1 =y 2 n Which is equivalent to: f = g iff x A, f(x) = g(x)

38
8.2 Union, Intersection, Difference Given 2 functions, f : A B, g : A B, f g, f g, f g are defined as accordingly in set theory (since functions are sets). …Or, in cases where y can be computed directly from x: –(f g)(x) = y iff y = f(x) or y g(x) –(f g)(x) = y iff y = f(x) and y g(x) NOTE: f g, f g, f g need not necessarily be functions. At most, one can only conclude that f g, f g, f g are relations. In order to assert that they are functions, one must prove that the 2 conditions necessary for functions are true.

39
8.2 Union, Intersection, Difference Theorem: Given 2 functions f and g from A to B, 1. If f g is a function, then f = g 2. If f g is a function, then f = g 3. If f g is a function, then f g = Proof of (1): (Direct proof: f = g iff x A, f(x) = g(x) AB f x AB g x AB f g x y1y1 y2y2 y2y2 y1y1 But f g is a function! Defn:y 1 = (f g)(x) and y 2 = (f g)(x) then y 1 =y 2.

40
8.2 Union, Intersection, Difference Theorem: Given 2 functions f and g from A to B, 1. If f g is a function, then f = g 2. If f g is a function, then f = g 3. If f g is a function, then f g = Proof of (1): (Direct proof: f = g iff x A, f(x) = g(x) Let x A. Since f is a function, then y 1 B, y 1 = f(x), (x,y 1 ) f Since g is a function, then y 2 B, y 2 = g(x), (x,y 2 ) g Therefore (x,y 1 ) f g and (x,y 2 ) f g. i.e. y 1 f g)(x) and y 2 f g)(x) But since f g is a function, then y 1 =y 2. Therefore f(x) = g(x) (By definition of function equality)

41
8.2 Union, Intersection, Difference Theorem: Given 2 functions f and g from A to B, 1. If f g is a function, then f = g 2. If f g is a function, then f = g 3. If f g is a function, then f g = Proof of (3): (By contradiction) AB f g xy AB f xy AB g xy AB f-g x

42
8.2 Union, Intersection, Difference Theorem: Given 2 functions f and g from A to B, 1. If f g is a function, then f = g 2. If f g is a function, then f = g 3. If f g is a function, then f g = Proof of (3): (By contradiction) Assume that f g Then by definition, (x,y) f g That means that (x,y) f and (x,y) g That means that (x,y) (f – g). But f – g is a function! x A, y B, y = (f – g)(x). So there must be a (x,y) (f – g) => Contradiction! Therefore f g.

43
8.2 Union, Intersection, Difference Theorem: Given 2 functions f and g from A to B, 1. If f g is a function, then f = g 2. If f g is a function, then f = g 3. If f g is a function, then f g = Proof of (2) left as an exercise Similar to Proof of (1).

44
8.3 Definition: Inverse of a function Given a function, f : A B, the inverse of a function is defined in the same way as that of a relation: f -1 = { (y,x) | (x,y) f } n NOTE: f -1 need not necessarily be a function. It is first and foremost, a relation. In order to assert that they are functions, one must prove that the 2 conditions necessary for functions are true. So f -1 B x A If f -1 is a function, then we write: f -1 : B A … and then say that: f(x) = y iff f -1 (y) = x

45
8.3 Definition: Inverse of a function n Find the inverse of the function f(x) = (1+x)/(1-x). n Ans: –Let y = (1+x)/(1-x). Express x in terms of y. –Therefore: y – yx = 1 + x –Therefore: y – 1 = yx + x –Therefore: x(y+1) = y–1 –Therefore: x = (y–1)/(y+1) –Therefore: f -1 (y) = (y–1)/(y+1) –i.e. f -1 (x) = (x–1)/(x+1)

46
Overview n Functions –Definition –Visualization Tool –Examples –Notation –Identity Function n Definitions –Domain, codomain, range –Image, inverse image –Let f:A B and let S A and T B. S InvImg f (Img f (S)) Img f (InvImg f (T)) T n Operations on Functions –Set related (,, ): 1.If f g is a function, then f = g 2.If f g is a function, then f = g 3.If f g is a function, then f g= –Inverse n One-to-one and Onto Functions

47
Definition A function f: X Y is one-to-one (also called injective) if and only if, for any x 1, x 2 X, if f(x 1 ) = f (x 2 ), then x 1 = x 2. (Alternatively, by contraposition, if x 1 x 2, then f(x 1 ) f(x 2 ), i.e. the images of distinct elements in X are always distinct elements in Y.) Definition A function f: X Y is onto (also called surjective) if and only if for all y Y, there exists x X such that y = f(x). (Alternatively, every element in Y is the image of at least one element in X.) Now lets consider some earlier examples in light of these definitions. One-to-One and Onto Functions

48
Consider the following previously-discussed functions: 1. Let X = Y = {1, 2, 3} and f: X Y be given by f(x) = x. Then f is both one-to-one and onto, i.e. distinct elements in X are always mapped to distinct elements in Y, and every element in Y is the image of an element (itself) in X. 2.Let X = {-2, -1, 0, 1, 2}, Y = {0, 1, 2, 3, 4} and f: X Y be given by f(x) = x 2. Then f is not one-to-one, since (for example) f(-2) = f(2) = 4. Also, f is not onto, since (for example) y = 3 is not the image of any x X. 3.In the arrow diagram at right, h is not one-to-one, since h(x 1 ) = h(x 3 ) = y 3. Likewise, h is not onto, since y 2 is not the image of any element in X. h X Y x 1 y 1 x 2 y 2 x 3 y 3 One-to-One and Onto Functions (contd)

49
r(x) = |x| r: R R neither 1 – 1 nor onto s(n) = (-1) n+1 /n s: Z + Q 1 – 1 but not onto t(n) = n(mod 2) t: Z {0, 1} onto but not u(x) = x 1/2 u: R + R + both 1 – 1 and onto One-to-One and Onto Functions (contd)

50
Definition A function f: X Y is a one-to-one correspondence (also called a bijection) if and only if f is both one-to-one and onto. Of the previous examples, only 1 function is a one-to-one correspondence: u: R + R + where u(x) = x 1/2. Two primary applications for one-to-one correspondences: 1. They are used to prove that two sets have the same number of elements, i.e. if a 1 – 1 correspondence exists between two sets, they have the same cardinality. 2. One-to-one correspondences are the only functions for which inverse functions exist. One-to-One Correspondences and Inverse Functions

51
Example Show that the odd integers have the same cardinality as the integers Z. Let O = {2k + 1 | k Z} be the set of odd integers. Define a function f: Z O by f(k) = 2k + 1. Every member of O is therefore the image of an element in Z, i.e. f is onto. Assume f(k 1 ) = f(k 2 ), i.e. 2k = 2k But then k 1 = k 2, i.e. f is one-to-one. It follows that f is a one-to-one correspondence, and hence n(O) = n(Z) = א 0. One-to-One Correspondences and Inverse Functions (contd)

52
Example Find the inverse function for f: Z O where f(k) = 2k + 1. The given function has just been shown to be a one-to-one correspondence. It follows that, for any n O such that n = f(k) = 2k + 1, then k = (n – 1)/2, i.e. the required inverse function is f -1 : O Z, where f -1 (n) = (n – 1)/2 = k. f 2k+1=n f -1 (n–1)/2=k f -1 (n–1)/2=k f 2k+1=n One-to-One Correspondences and Inverse Functions (contd)

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google