Download presentation

Presentation is loading. Please wait.

Published byAthena Madson Modified over 2 years ago

1
Lecture 15 Functions CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine

2
CSCI 1900 Lecture 15 - 2 Lecture Introduction Reading –Rosen - Section 2.3 Definition of a function Representation of a function Composition Special types of functions Theorems on functions

3
CSCI 1900 Lecture 15 - 3 Review: Dom and Ran of a Relation Given R - a relation from the set A to the set B, then –Domain of R - Dom(R) Subset of A containing elements that are related to some element in B –Range of R - Ran(R) Subset of B containing all second elements of the pairs defining R The same definitions apply to functions

4
CSCI 1900 Lecture 15 - 4 Functions A function f is a relation from A to B –f : A → B –Each element of A in the domain of f maps to at most one element in B –Alternatively f (a) = b If an element a is not in the domain of f, – f (a) is undefined –Written as f (a) =

5
CSCI 1900 Lecture 15 - 5 Functions (cont) Functions are also called mappings or transformations –View as rules that assign an element of A to one element of B Elements of A Elements of B

6
CSCI 1900 Lecture 15 - 6 Functions (cont) Because f is a relation, it too is a subset of the Cartesian Product A B Even though there might be multiple sequence pairs that have the same element b, no two sequence pairs may have the same first element a

7
CSCI 1900 Lecture 15 - 7 Functions Represented by Formulae It may be possible to represent a function with a formula –Example: f (x) = x 2 (mapping from Z to N) A function is not necessarily represented with a formula –Because a function is a relation It is therefore just a subset of the Cartesian product It may be that a function is represented only as a set of ordered pairs

8
CSCI 1900 Lecture 15 - 8 Functions Without Formulae Example: A mapping from one finite set to another –A = { b, c, d, e} and B = {4, 6} –f (a) = {(b, 4), (c, 6), (d, 6), (e, 4)} Example: Membership function –f (a) return 0 if a is even, 1 otherwise –A = Z B = {0,1}

9
CSCI 1900 Lecture 15 - 9 Identity Function The identity function is a function on A –Denoted 1 A –Defined by 1 A (a) = a

10
CSCI 1900 Lecture 15 - 10 Composition If f : A → B and g : B → C, then the composition of f and g, (written as g f ), is a function Let a Dom(g f). –(g f )( a ) = g( f ( a ) ) –Because f( a ) maps to exactly one element, say b B g( f (a ) ) = g( b ) –Because g( b ) maps to exactly one element, say c C g( f (a) ) = c –Thus for each a A, (g f )(a) maps to exactly one element of C –Therefore: g f is a function

11
CSCI 1900 Lecture 15 - 11 Composition A=B=C=Z, f : A → B, and g : B → C f (a) = a+1, g(b)=2b Ex: g f (3)= g( f(3) ) = g( 4)= 8 g f(a)= g( f(a) ) = g( a+1) = 2(a+1) =2a +2 A B C f g g f

12
CSCI 1900 Lecture 15 - 12 Special Types of Functions f : A → B is “everywhere defined ” if –Dom(f ) = A f : A → B is “onto” if –Ran(f ) = B f : A → B is “one-to-one” if –It is impossible to have f (a) = f (a') if a a ' i.e., if f (a) = f (a'), then a = a' f : A → B is “invertible” if –Its inverse, f -1, is also a function (Note, f -1 is simply the reversing of the ordered pairs)

13
CSCI 1900 Lecture 15 - 13 Onto Functions If Ran(f)=B, then f is onto 1 2 3 4 a b c d 5 1 2 3 4 a b c d 5 OntoNOT Onto

14
CSCI 1900 Lecture 15 - 14 One-to-One Functions f : A → B is one to one if no two elements of A map to the same element in B –If f(a)=f(b) implies a=b, then f is one to one –If f(a)=f(b) and a b, then f is not one to one One to One NOT One to One 1 2 3 4 a b c d e 1 2 3 4 a b c d e

15
CSCI 1900 Lecture 15 - 15 Bijection If f : A → B is one to one and onto, then f has one to one correspondence between the domain and the range or is bijective 1 2 3 4 a b c d

16
CSCI 1900 Lecture 15 - 16 Theorem of Functions If f is –Everywhere defined –One-to-one, –Onto then f is a one-to-one correspondence between A & B Thus f is invertible and f -1 is a one-to-one correspondence between B & A

17
CSCI 1900 Lecture 15 - 17 More Theorems of Functions Let f be any function: 1 B f = f f 1 A = f If f is a one-to-one correspondence between A and B, then f -1 f = 1 A f f -1 = 1 B

18
CSCI 1900 Lecture 15 - 18 More Theorems of Functions (cont) Let f : A → B and g : B → C Further let f and g be invertible (g f) is invertible (g f) -1 = (f -1 g -1 )

19
CSCI 1900 Lecture 15 - 19 Key Concepts Summary Definition of a function Representation of a function Composition Special types of functions Theorems on functions Reading for next lecture –Kolman - Section 5.2, 5.3

Similar presentations

OK

Fall 2014 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.

Fall 2014 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on temperature controlled fan Ppt on bluetooth wireless technology Ppt on national education day india Ppt on supply chain management of nokia windows Ppt on media revolution help Ppt on product specification sheet Ppt on indian politics latest Ppt on fmcg industry in india Creation story for kids ppt on batteries Ppt on sub soil investigation report