Lec 04 function
-
Upload
naosher-md-zakariyar -
Category
Education
-
view
128 -
download
0
Transcript of Lec 04 function
Textbook
Discrete Mathematics & Its Applications - Kenneth H. Rosen
Topics to be covered todayFunction
FunctionLet A and B be nonempty sets
A Function f from A to B Is an assignment of exactly one element of B to each element of A
We write f(a) = b If b is the unique element of B Assigned by the function f to the element a of A
If f is a function from A to B
We write f: A B
FunctionFunctions are specified in many different ways
Sometimes we explicitly state the assignments
As in following Figure
Domain, CoDomain, Range, Image, PreImageIf f is a function from A to B
A is the domain of f B is the co-domain of f
If f(a) = b b is the image of a a is a pre-image of b
The range of f: Set of all images of elements of A We define a function by it’s
DomainCo-domainMapping of elements of the domain to elements in the co-domain
Domain, CoDomain, Range, Image, PreImage2 Functions are Equal - When they have Same domain Same co-domain Map elements of their domain to the same elements in their co-domain Note: If we change either the Domain or Co-Domain of a function
Then we obtain a different function If we change the Mapping of Elements
Then we also obtain a different function
Domain, CoDomain, Range, Image, PreImage
What are the Domain, Codomain & Range of the function that assigns grades to students?
Solution:
Let G be the function that assigns a grade to a studentFor example: G(Adams) = A
Domain of G = Set {Adams, Chou, Goodfriend, Rodriguez, Stevens} Codomain of G = Set {A, B, C, D, F}Range of G = Set {A, B, C, F}
Because each grade except D is assigned to some student
Domain, CoDomain, Range, Image, PreImageLet R be the relation consisting of ordered pairs (Abdul, 22), (Brenda, 24), (Carla, 21), (Desire, 22), (Eddie, 24), (Felicia, 22)
Where each pair consists of: A Graduate student & Age of the studentWhat is the function that this relation determines?
Solution:
This relation defines the function f, Where f(Abdul)=22, f(Brenda)=24, f(Carla)=21, f(Desire)=22, f(Eddie)=24, f(Felicia)=22
Domain: Set {Abdul, Brenda, Carla, Desire, Eddie, Felicia}
Codomain: Set of positive integers To make sure that the Codomain contains all possible ages of students
Range: Set {21, 22, 24}
FunctionLet f be the function
That assigns the last 2 bits of a bit string of length 2 or greater to that string
For Example: f(11010) = 10
Domain of f:
Set of all bit strings of length 2 or greater
Codomain & Range of f:
Set {00, 01, 10, 11}
Function
FunctionLet f be a function from Set A to Set B Let S be a subset of A
The image of S under the function f:Subset of B that consists of the images of the elements of S
We denote the image of S by f(S)
Let A = {a, b, c, d, e} & B = {l, 2, 3, 4} With f(a) = 2, f(b) = 1, f(c) = 4, f(d) = 1, f(e) = 1
The image of the subset S = {b, c, d}: Set f(S) = {1, 4}
Classification of Function3 Types of Function:
One-to-One
Onto
One-to-One Correspondence
Function – One to OneSome functions never assign the same value
To 2 different domain elements
These functions are said to be One-to-One
A function f is said to be one-to-one
If and only if f(a) = f(b) implies that a = b For all a & b in the domain of f
Function – One to OneDetermine whether the function f
From {a, b, c, d} to {l, 2, 3, 4, 5} With f(a) = 4, f(b) = 5, f(c) = 1, f(d) = 3 is one-to-one
Solution: The function f is one-to-one Because f takes on different values at 4 elements of its domain
Function - OntoFor some functions Range & Co-domain are equal
Every member of the co-domain Is the image of some element of the domain
Functions with this property are called onto Functions
A function f from A to B is called onto
If and only if for every element b of set B There is an element a of set A with f(a) = b
Function - OntoLet f be the function from {a, b, c, d} to {l, 2, 3}
Defined by f(a) = 3, f(b) = 2, f(c) = 1, f(d) = 3Is f an onto function?
Solution: Because all 3 elements of Codomain are images of elements in domain
We say that f is onto
This is illustrated in following Figure
Function - One to One CorrespondenceThe function f is a One-to-One Correspondence or Bijection
If it is both one-to-one and onto
Example:
Let f be the function from {a, b, c, d} to {l, 2, 3, 4} With f(a) = 4, f(b) = 2, f(c) = 1, f(d) = 3
Is f a Bijection?
Solution: The function f is both One-to-One & onto• It is one-to-one Because no 2 values in the domain are assigned the same value• It is onto Because all 4 elements of Codomain: Are images of elements in Domain
So f is a Bijection
FunctionFollowing Figure displays 4 functions Where
• First is one-to-one but not onto• Second is onto but not one-to-one• Third is both one-to-one and onto• Fourth is neither one-to-one nor onto• Fifth is not a function, because it sends an element to 2 different elements
Identity FunctionLet A be a set
The identity function on A is the function iA : A AWhere iA(x) = x
In other words
The identity function iA is the function That assigns each element to itself
Inverse FunctionLet f be a One-to-One Correspondence from the set A to the set B
Inverse Function of f:Function that assigns
To an element b belonging to B Unique element a in A
Such that f(a) = b
The inverse function of f is denoted by f-1
Hencef-1(b) = a When f(a) = b
Invertible FunctionA one-to-one correspondence is called Invertible
Because we can define an inverse of this function
A function is not invertible: If it is not a one-to-one correspondence Because - Inverse of such a function does not exist
Example:Let f be the function from {a, b, c} to {1, 2, 3}
Such that f(a) = 2, f(b) = 3, f(c) = 1Is f invertible, and if it is, what is its inverse?
Solution: The function f is invertible because it is a one-to-one correspondenceThe inverse function f-1 reverses the correspondence given by f
So: f-1(1) = c, f-1(2) = a, f-1(3) = b
Composition of Functions
Composition of Functions
Composition of Functions