You are on page 1of 25

Discrete

Mathematics:
Functions

Dr. Nelson K.
Bii

Discrete Mathematics: Functions

Dr. Nelson K. Bii

24/08/2021

Institute of Mathematical Sciences, Strathmore University


Functions

Discrete
Mathematics:
Functions

Dr. Nelson K.
Bii
Function as a Relation:
A function is a relation in which each value from the set of
the first components of the ordered pairs is associated
with one and only one value from the set of the second
components of the ordered pairs.
Consider
n the relations R1 and R2obelow:
R1 = (a, 1), (b, 3), (1, 1), (d, 4)
n o
R2 = (1, w ), (2, y ), (3, x), (3, 2), (4, 2)
Functions contd...

Discrete
Mathematics:
Functions

Dr. Nelson K.
Bii

→ R1 is a relation since each element of the set A is


mapped to one and only one element of the set B.
→ R2 is not a relation since 3 ∈ X is mapped to both
x, y ∈ Y .
Functions contd...

Discrete
Mathematics:
Functions

Dr. Nelson K.
Bii Exercise:
Determine whether or not each of the following relations is a
function. n o
(a) R1 = (2, 4), (3, −7), (6, 10)
n o
(b) R2 = (−1, 8), (4, −7), (−1, 6), (0, 0)
n o
(c) R3 = (6, 10), (−7, 3), (0, 4), (6, −4)
n o
(d) R4 = (2, 1), (9, 10), (−8, 1), (−4, 10)
Functions contd...

Discrete
Mathematics:
Functions
Function as an Equation:
Dr. Nelson K. A function f is a rule which assigns to each value of a
Bii
variable x called the argument of the function, one and
only one value f (x) called the value of the function.
Example:
f and g below are functions since each value of x results to a
single corresponding value of f (x) and g (x) .
1 f (x) = x 2 + 1:
(i) f (1) = 12 + 1 = 2
(ii) f (4) = 42 + 1 = 17
2 g (x) = x 3 + 2x 2 + 3x − 4:
(i) g (1) = 13 + 2(12 ) + 3(1) − 4 = 2
(ii) g (4) = 43 + 2(42 ) + 3(4) − 4 = 104
Function as an Equation contd...

Discrete
Mathematics:
Functions

Dr. Nelson K.
Bii h(x) is not a function since each value of x is mapped to
two values of h(x) (+ and −). i.e.

h(x) = x


h(1) = 1 = ±1


h(4) = 4 = ±4
Functions contd...

Discrete
Mathematics:
Functions

Dr. Nelson K. Composition of Functions:


Bii
Let f (x) and g (x) be functions of x.
The composition of f and g denoted (f ◦ g )(x) is defined
by: (f ◦ g )(x) = f [g (x)].
Similarly, (g ◦ f )(x) = g [f (x)] where (f ◦ g )(x) and
(g ◦ f )(x) are not necessarily equal.
Example 1:
Let f (x) = 31 x + 2
3 and g (x) = x 2 + 1. Find:
(a) (f ◦ g )(x)
(b) (g ◦ f )(x)
Functions contd...

Discrete
Mathematics:
Functions

Dr. Nelson K.
Bii Solution 1 (a):

(f ◦ g )(x) = f [g (x)]
1 2
= (x 2 + 1) +
3 3
1 1 2
= x2 + +
3 3 3
1 2
= x +1
3
Functions contd...

Discrete
Mathematics:
Functions Solution 1 (b):
Dr. Nelson K.
Bii

(g ◦ f )(x) = g [f (x)]
1 2 2
= x+ +1
3 3
1 2  1 2
= x+ x+ +1
3 3 3 3
1 1  2  2 1
 2
= x x+ + x+ +1
3 3 3 3 3 3
1 2 2 4
= x2 + x + x + + 1
9 9 9 9
1 2 4 4
= x + x +1
9 9 9
Functions contd...

Discrete
Mathematics:
Functions

Dr. Nelson K.
Bii

Example 2:
Let f (x) = x + 2 and h(x) = x 2 + 3x + 1. Find:
(a) (f ◦ h)(x)
(b) (h ◦ f )(x)
Functions contd...

Discrete
Mathematics:
Solution 2 (a):
Functions

Dr. Nelson K.
(f ◦ h)(x) = f [h(x)]
Bii
= (x 2 + 3x + 1) + 2
= x 2 + 3x + 1 + 2
= x 2 + 3x + 3
Solution 2 (b):
(h ◦ f )(x) = h[f (x)]
= (x + 2)2 + 3(x + 2) + 1
= (x + 2)(x + 2) + 3x + 6 + 1
= x(x + 2) + 2(x + 2) + 3x + 7
= x 2 + 2x + 2x + 4 + 3x + 7
= x 2 + 7x + 11
Functions contd...

Discrete
Mathematics:
Functions

Dr. Nelson K.
Bii
Exercise:
Let f (x) = x 3 , g (x) = 3x 2 + 7 and h(x) = 2x 3 + 3x + 5. Find:
(a) (f ◦ g )(x)
(b) (g ◦ h)(x)
(c) (f ◦ h)(x)
(d) (g ◦ f )(x)
(e) (h ◦ g )(x)
(g) (h ◦ f )(x)
Functions contd...

Discrete
Mathematics:
Functions Inverse of a Function:
Dr. Nelson K.
Bii Inverse of a function represents a one-to-one mapping
from the range of one function to its domain.
The inverse of a function is also a relation in which the
roles of the independent and dependent variables are
reversed.
The inverse of f is denoted by f −1 .
Example:
Find the inverse of each of the following:
(a) f (x) = 3x + 1
(b) g (x) = 2x − 3

(c) h(x) = x + 7
Functions contd...

Discrete
Mathematics:
Functions

Dr. Nelson K. Solution 1(a):


Bii

f (x) = 3x + 1
Let y = f (x)
=⇒ y = 3x + 1
y −1 3x
=⇒ =
3 3
y −1
=⇒ x =
3
−1 x −1
∴ f (x) =
3
Functions contd...

Discrete
Mathematics:
Functions

Dr. Nelson K. Solution 1(b):


Bii

g (x) = 2x − 3
Let g (x) = y
∴ y = 2x − 3
y +3 2x
=
2 2
y +3
x=
2
−1 x +3
∴ g (x) =
2
Functions contd...

Discrete
Mathematics:
Functions

Dr. Nelson K.
Bii Solution 1(c):

h(x) = x +7

h(x) − 7 = x
 2 √ 2
h(x) − 7 = x
 2
h(x) − 7 = x
 2
h−1 (x) = x − 7
Functions contd...

Discrete
Mathematics:
Functions

Dr. Nelson K.
Bii

Exercise:
Find the inverse of:
(a) f (x) = x 3 + 1
2x
(b) g (x) = x−3
2
(c) h(x) = x+1
Functions contd...

Discrete
Mathematics: Surjective, Injective and Bijective Functions
Functions
(a) Surjective Functions:
Dr. Nelson K.
Bii Let f : A → B made to be an arbitrary function with the
domain A and co-domain B.
Recall that every member of A has an image under f such
that the set of all the images is called the range of the
function f . i.e. R = f (A) and note that R ⊆ B.
Example 1:
Consider the following mapping:
Functions contd...

Discrete
Mathematics:
Functions

Dr. Nelson K.
Bii Clearly
f (x) = c,
f (y ) = b,
f (z) = e,
f (w ) = d and
A = {x, y , z, w } is the domain of f
B = {a, b, c, d, e} is the co-domain of f
But range, R = f (a) = {b, c, d, e}
Note that a ∈ B and a ∈ / R ∴ R 6= B and R ⊂ B (R is a
proper subset of the co-domain B).
Functions contd...

Discrete
Mathematics:
Functions
Example 2: Let A = {a, b, c, d} and
Dr. Nelson K.
Bii B = {IBM, Compaq, Hp, Dell} such that

Domain is A = {a, b, c, d}
Co-domain is B = {IBM, Compaq, Hp, Dell}.
Functions contd...

Discrete
Mathematics: Images:
Functions
f (a) = Hp,
Dr. Nelson K.
Bii f (b) = IBM,
f (c) = Dell,
f (d) = Compaq
such that:
Range of f , R = {Hp, IBM, Dell, Compaq} = B.
Remarks:
If the range coincides with the co-domain, then the
function is called a surjective function Or
A function f : A → B is surjective (onto) function if the
range of f = the co-domain of f .
To show that a function is surjective, pick an arbitrary
element in the co-domain and show that it has a
pre-image in the domain.
Functions contd...

Discrete
Mathematics: Example:
Functions

Dr. Nelson K.
Let f : R → {x|x > 0} where f (x) = e x .
Bii In this case, the co-domain is {x|x > 0} and the domain is R.
Let x = 3, then f (3) = e 3 = 20.08 · · ·
x = 100, then f (100) = e 100 = 2.6 × 1043
In general, ∀x > 0, f (x) = e x ∈ R hence
f : R → {x|x > 0} is surjective.
Exercise:
Check if the following are surjective functions:

(1). f : R → R, f (x) = x 3

(2). f : R → R, f (x) = x 2
Functions contd...

Discrete
Mathematics:
Functions

Dr. Nelson K.
(b) Injective Functions:
Bii
A function f : A → B is an injective (or one-to-one)
function if no member of B is the image under f of two
distinct elements of A i.e. to show that a function is
injective, for any elements a1 and a2 of A with
f (a1 ) = f (a2 ) then a1 = a2 .
Example:
Test the following functions to see if they are injective:
(a) f : R → R, f (x) = x 3
(b) f : R → R, f (x) = x 2
(c) f : [0, ∞) → R, f (x) = x 2
Functions contd...

Discrete
Mathematics:
Solution (a):
Functions Let x = −2, then f (−2) = (−2)3 = −8
Dr. Nelson K.
Bii x = 5, then f (5) = (5)3 = 125
In general, ∀x ∈ R, f (x) = x 3 ∈ R such that no distinct
x1 , x2 ∈ R has f (x1 ) = f (x2 ).
∴ f (x) = x 3 is injective.
Solution (b):
Let x = −2, then f (−2) = (−2)2 = 4
x = 2, then f (2) = (2)2 = 4
For any −x, x ∈ R, f (−x) = f (x) = x 2 hence f is not
injective.
Solution (c):
Let x = 4, then f (4) = (4)2 = 16
x = 25, then f (25) = (25)2 = 625
In general, ∀{x|x ≥ 0} ∈ R, no distinct x1 , x2 ∈ R has
f (x1 ) = f (x2 ). ∴ f (x) = x 2 is injective.
Functions contd...

Discrete
Mathematics:
Functions

Dr. Nelson K.
Bii Bijective Functions:
A function f : A → B is bijective (a bijection) if it is both
surjective and injective.
Exercise:
Which of the following functions are surjective, injective and
bijective?.
(a) f : R → R, f (x) = x 3
(b) f : R → R, f (x) = 2x
(c) f : R → R, f (x) = x 3 − 2x 2 − 5x + 6

You might also like