LECTURE 04
Textbook
Discrete Mathematics & Its Applications
- Kenneth H. Rosen
Topics to be covered today
Function
Function
Let 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
Function
Functions are specified in many different ways
Sometimes we explicitly state the assignments
As in following Figure
Domain, CoDomain, Range, Image, PreImage
If 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
Domain
Co-domain
Mapping of elements of the domain to elements in the co-domain
Domain, CoDomain, Range, Image, PreImage
2 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 student
For 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, PreImage
Let 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 student
What 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}
Function
Let 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
Function
Let 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 Function
3 Types of Function:
One-to-One
Onto
One-to-One Correspondence
Function – One to One
Some 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 One
Determine 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 - Onto
For 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 - Onto
Let 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) = 3
Is 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 Correspondence
The 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
Function
Following 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 Function
Let A be a set
The identity function on A is the function iA : A A
Where iA(x) = x
In other words
The identity function iA is the function
That assigns each element to itself
Inverse Function
Let 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
Hence
f-1
(b) = a
When f(a) = b
Invertible Function
A 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) = 1
Is f invertible, and if it is, what is its inverse?
Solution:
The function f is invertible because it is a one-to-one correspondence
The 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

Lec 04 function

  • 1.
  • 2.
    Textbook Discrete Mathematics &Its Applications - Kenneth H. Rosen
  • 3.
    Topics to becovered today Function
  • 4.
    Function Let A andB 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
  • 5.
    Function Functions are specifiedin many different ways Sometimes we explicitly state the assignments As in following Figure
  • 6.
    Domain, CoDomain, Range,Image, PreImage If 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 Domain Co-domain Mapping of elements of the domain to elements in the co-domain
  • 7.
    Domain, CoDomain, Range,Image, PreImage 2 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
  • 8.
    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 student For 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
  • 9.
    Domain, CoDomain, Range,Image, PreImage Let 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 student What 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}
  • 10.
    Function Let f bethe 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}
  • 11.
  • 12.
    Function Let f bea 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}
  • 13.
    Classification of Function 3Types of Function: One-to-One Onto One-to-One Correspondence
  • 14.
    Function – Oneto One Some 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
  • 15.
    Function – Oneto One Determine 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
  • 16.
    Function - Onto Forsome 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
  • 17.
    Function - Onto Letf 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) = 3 Is 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
  • 18.
    Function - Oneto One Correspondence The 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
  • 19.
    Function Following Figure displays4 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
  • 20.
    Identity Function Let Abe a set The identity function on A is the function iA : A A Where iA(x) = x In other words The identity function iA is the function That assigns each element to itself
  • 21.
    Inverse Function Let fbe 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 Hence f-1 (b) = a When f(a) = b
  • 22.
    Invertible Function A one-to-onecorrespondence 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) = 1 Is f invertible, and if it is, what is its inverse? Solution: The function f is invertible because it is a one-to-one correspondence The inverse function f-1 reverses the correspondence given by f So: f-1 (1) = c, f-1 (2) = a, f-1 (3) = b
  • 23.
  • 24.
  • 25.