Presentation is loading. Please wait.

Presentation is loading. Please wait.

Functions1 Elementary Discrete Mathematics Jim Skon.

Similar presentations


Presentation on theme: "Functions1 Elementary Discrete Mathematics Jim Skon."— Presentation transcript:

1 Functions1 Elementary Discrete Mathematics Jim Skon

2 Functions2 §Definition: A function consists of three things: 1. A non empty set A, called the domain of the function 2. A non empty set B, called the codomain of the function 3. A rule that assigns to each element of A one and only one, element of B

3 Functions3 Function Notations §Use letters such as ƒ, g, and h to denote functions.  ƒ:A  B means ƒ is a function with domain A and codomain B  ƒ:A  B is read: "ƒ is a function from A to B” xf(x) AB f

4 Functions4 Function Notations  If ƒ:A  B, and a  A and b  B, and a is assigned to b by the function ƒ, then we say ƒ(a) = b §If ƒ(a) = b, then the element ƒ(a) or b is called the value of ƒ at a, or the image of a under the function ƒ. af(a)=b AB f

5 Functions5 Function Example §Let A = {1,2,3} and B = {a,b,c} Let ƒ(1) = b ƒ(2) = c ƒ(3) = a § c is the image of 2 under the function ƒ. § The image f(A) of function f is B = {a, b, c}

6 Functions6  In general, element a  A maps to element ƒ(a)  B.

7 Functions7 §From rule 3 of the definition, elements of the domain can map to at most one element of the codomain. §Multiple elements of the domain may map to the same element of the range:

8 Functions8 §The domain may not map to multiple elements of the range: §This is called the uniqueness condition of functions

9 Functions9 Function §.Formal Definition: l Let A and B be sets. A function ƒ:A  B is a subset of the Cartesian product A  B, which satisfies the uniqueness condition that, for all (a 1, b 1 )  ƒ and (a 2, b 2 )  ƒ, if a 1 = a 2, then b 1 = b 2.

10 Functions10 Function Examples: §Consider again A = {1,2,3} and B = {a,b,c} Let ƒ(1) = b ƒ(2) = c ƒ(3) = a ƒ = {(1, b), (2, c), (3, a) }

11 Functions11 Function Examples  Consider ƒ:R  R where R is reals Let ƒ(x) = x 2. Alternately: ƒ = {(x, x 2 ) | x  R} Then ƒ:R  R

12 Functions12 Function Examples  Let ƒ:N  N where ƒ(n) = n + 1 for all n  N Alternately :ƒ = {(n, n+1) | n  N }

13 Functions13 Function Examples  Let S be a finite non-empty set. We may define the function: ƒ: P (S)  N asƒ(A) = |A|. Alternately: ƒ = {(a, n) | a  P (S)  n  N  |a| = n} l This is the set size function.

14 Functions14 Function Examples  Consider the function ƒ:N  N  N N  N are pairs of natural numbers. Let ƒ(x,y) = x 2 + y ƒ = {((x,y), x 2 + y)}

15 Functions15 Function Examples  Consider a function ƒ: P (S)  P (S)  P (S) l where S = {1, 2, 3,..., 10} Let ƒ(A,B) = A  B ƒ = {((A, B), A  B) | A  S  B  S } §This is the union function

16 Functions16 Function Examples §Consider in general n-ary functions, which are of the form ƒ:A 1  A 2...  A n  B. §These are called n-ary functions or functions of n variables, and are written: ƒ(a 1, a 2,..., a n ) = b

17 Functions17 Function Examples  Consider a function ƒ:N  N  N  N  I Let ƒ(w, x, y, z) = 2w + 3(xy) - 4z ƒ = {( (w, x, y, z), 2w + 3(xy) - 4z) }

18 Functions18 Function Examples  Consider a function ƒ:A  B  N A = {x | x is a MVNC basketball player} B = {x | x is a MVNC basketball game (date)} Let ƒ(x, y) = points scored by player x in game y

19 Functions19 Function Examples  Consider a function ƒ:A  B  N A = {x | x is a first names} B = {x | x is a last name} Let ƒ(x, y) = student x y’s box number. §Not a function! Why?

20 Functions20 Function Examples  Consider function ƒ:R  I where: ƒ(x) = Largest integer less than or equal to x. ƒ(x) =  x  §called the floor function.  Consider function ƒ:R  I where: ƒ(x) = Least integer greater than or equal to x. ƒ(x) =  x  §called the ceiling function.

21 Functions21 Function Range §Range Definition: Let ƒ:A  B be a function from A (domain) to B (codomain). The range of ƒ is the set of all elements of B that are mapped to by some element of A, i.e. range(ƒ) = {b  B | b = ƒ(a) for some a  A} l In other words, the range of ƒ is the subset of B which the function actually maps to.

22 Functions22 Surjective (onto) Function §Let B be the codomain of function ƒ. §If range(ƒ) = B, then we say that the function is onto B  A function ƒ:A  B is surjective if it is onto B. §In other words, a function is surjective if every element in the codomain is mapped to.

23 Functions23 Surjective Function ABRange(f) A BRange(g) g f Not onto Onto f:A  B g:A  B

24 Functions24 Surjective Function §Which of the previous examples are surjective?

25 Functions25 Surjective Function  Formally ƒ is surjective if and only if  b  a  ƒ (a) = b. or  b  a  (a, b)  ƒ

26 Functions26 Injective Function  Definition: Let ƒ:A  B. If no two different elements of A are assigned to the same element of B by the function ƒ, the function is one-to-one.  More formally if  a 1  A:  a 2  A: ƒ(a 1 ) = ƒ(a 2 )  a 1 = a 2 Then the function is one-to-one. Contrapositively:  a 1  A:  a 2  A:a 1  a 2  ƒ(a 1 )  ƒ(a 2 )

27 Functions27 Injective Function AB g f Not one to one One to one f:A  B g:A  B f(a 1 ) a1a1 a2a2 a3a3 a4a4 a5a5 a6a6 f(a 2 ) f(a 3 ) f(a 4 ) f(a 5 ) f(a 6 ) AB f(a 1 ) a1a1 a2a2 a3a3 a4a4 a5a5 a6a6 f(a 2 ) f(a 3 )= f(a 4 ) f(a 5 ) f(a 6 ) f(a 7 )

28 Functions28 Injective functions: §If a function is one-to-one then it is injective. §Which of the previous examples are injective?

29 Functions29 Example  Let ƒ:N  N be defined by: l ƒ(n) = n 2 l Is this surjective? injective?  Let ƒ:I  N be defined by: l ƒ(n) = n 2 l Is this surjective? injective?

30 Functions30 Bijective Function §Definition - bijective function If a function is both surjective and injective then it is bijective. A bijective function is onto and one-to-one. A bijective function is simply a one-to-one correspondence

31 Functions31 Bijective Function  A function ƒ:A  B is bijective if and only if  b  B:  !a  A:ƒ(a) = b §Which of the previous examples are bijective?

32 Functions32 Function Composition  Let ƒ:A  B and g:B  C §We can now define a new function, g  f, by the formula: (g  f)(a) = g(ƒ(a)) §This is called the composition function of g with ƒ.

33 Functions33 Function Composition

34 Functions34 Function Composition Example  Let A = {x, y, z} B = {2, 4, 6, 8} C = {  }  Let ƒ:A  B be defined by: ƒ(x) = 2,ƒ(y) = 8, ƒ(z) = 4  Let g:B  C be defined by: g(2) = ,g(4) = , g(6) =  g(8) =   Then g  ƒ:A  C is the function: (g  ƒ)(x) = (g( ƒ(x)) = g(2) =  (g  ƒ)(y) = (g( ƒ(y)) = g(8) =  (g  ƒ)(z) = (g( ƒ(z)) = g(4) = 

35 Functions35 Function Composition Example  Let ƒ:R  R be defined by: ƒ(x) = 2x 2 + 4  Let g:R  R be defined by: g(x) = 3x - 1 §Then g  ƒ:(x) = g( ƒ(x)) = g(2x 2 + 4) = 3(2x 2 + 4) - 1 = 6x 2 + 12 - 1 = 6x 2 + 11 What is ƒ  g:(x)?

36 Functions36 Function Composition Example  Let S be a finite set and x  S. We can define: ƒ: P (S)  P (S  {x}) as the function: ƒ(T) = T  {x},where T  S (or T  P (S) )  Let g: P (S  {x})  N be the function: g(V) = |V|, where V  S  {x} (or V  P (S  {x}) )

37 Functions37 Function Composition Example §Then the composition: g  ƒ: P (S)  N is given by (g  ƒ)(T) = (g( ƒ(T)) = g(T  {x}) = |T  {x}| = |T| + 1

38 Functions38 Function Composition §In general the composition of functions is not communitive, §e.g. ƒ  g  g  ƒ. §In fact, if ƒ  g is possible, g  ƒ is usually not possible!

39 Functions39 Function Composition § For g  ƒ to be possible, f must have a codomain which is a subset of the domain of g. If ƒ:A  B and g:C  D, then B  C. A CB g g:C  D f D f:A  B

40 Functions40 Function Composition §Likewise, for ƒ  g to be possible, g must have a codomain which is a subset of the domain of f, e.g. If ƒ:A  B and g:C  D, then D  A. C AD f g:C  D g B f:A  B

41 Functions41 Function Composition  Thus for both ƒ  g & g  ƒ to exist, B  C and D  A ACB g g:C  D f D f:A  B

42 Functions42 INVERSE of Functions  If ƒ:A  B is a bijection, then it is possible to define a function g:B  A with the property: l If ƒ(a) = b then g(b) = a AB g:B  A f:A  B

43 Functions43 INVERSE of Functions §Such a function g is called the inverse function of ƒ. §It is denoted by the symbol ƒ -1. AB f -1 :B  A f:A  B If ƒ(a) = b then f -1 (b) = a

44 Functions44 Example  Let A = {1,2,3} and B = {a,b,c}. Let ƒ:A  B be defined by: ƒ(1) = c, ƒ(2) = a, ƒ(3) = b Then the inverse ƒ -1 :B  A is defined by: ƒ -1 (a) = 2, ƒ -1 (b) = 3, ƒ -1 (c) = 123123 cabcab AB f 123123 cabcab AB f -1

45 Functions45 INVERSE of Functions  The the function ƒ:A  B has an inverse ƒ -1 :B  A if and only if it is bijective. §WHY??

46 Functions46 INVERSE of Functions §Note that in general ƒ -1  ƒ(a) = a, for all a in the domain of ƒ ƒ  ƒ -1 (b) = b, for all b in the codomain of ƒ

47 Functions47 Function Images §Consider a function:  :N  N, where  (x) =2x §The range of the function is: {0, 2, 4, 6, 8,... }

48 Functions48 Function Images §We can also consider the image of the function over a subset of the domain. §Let A = {2, 3, 4, 5, 6}.  (A) is the the image of function  over set A, which is:  (A) = {4, 6, 8, 10, 12} §If B = {x | 4 < x  10} then  (B) = {10, 12, 14, 16, 18, 20}

49 Functions49 Function Images §Image of a function - the elements mapped to over a given subset  Consider ƒ:R  R, f(x) = 2x l f(R) = Range(R) = R (The range of f). l f(I) = I l Let A = {1, 4, 6, 9). Then f(A) = {2, 8, 12, 18} l f(N) = ? l f(R - ) = I

50 Functions50 Function Images §Definition: l Let  be a function from set A to set B and let S be a subset of A (e.g. S  A). l The image of S is the subset of B that consists of the images of the elements of S. l The image of S is denoted  (S), thus:  (S) = {  (S) | s  S}

51 Functions51 Function Images §Consider:  :R  R, where  (x) =  (x+1)/2  If S = {1, 3, 5, 7, 9}, what is  (S)? If S = {x | 3  x  6}, what is  (S)? What is  (N)? What if  (Z)?

52 Functions52 Example §Consider 12 - 14 on page 70


Download ppt "Functions1 Elementary Discrete Mathematics Jim Skon."

Similar presentations


Ads by Google