Unit – 1
Basic Discrete Structures
Compiled By
Ujjwal Rijal
rijalujjwal09@gmail.com
rijalujjwal09@gmail.com 1
Basic Concept of Function
o Let A and B be two non-empty sets. A function f from
A to B is a set of ordered pairs with the property that
for each element x in A, there is an unique element y
in B.
o The set A is called the domain of the function and the
set B is called the co-domain of the function.
o If (x, y) ∈ f, then we write it as y = f(x), where y is
called the image of x and x is the pre-image of y.
o The set consisting of all the images of the elements of
A under the function f is called the Range of f. It is
denoted by f(A).
rijalujjwal09@gmail.com 2
Basic Concept of Function
o Example-1: Let A = {1, 2, 3, 4, 5} and B = {0, 1, 2, 3, 5, 7, 9,
12, 13} and f = {(1, 1), (2, 0), (3, 7), (4, 9), (5, 12)}, then f is a
function from A to B (A → B) because each element of A has a
unique image in B, which can be expressed by the following
mapping or arrow diagram:
rijalujjwal09@gmail.com 3
Basic Concept of Function
o Example-2: Let A = {1, 2, 3, 4, 5} and B = {0, 1, 2, 3, 5, 7, 9, 12,
13} and f = {(1, 1), (2, 1), (3, 7), (4, 9), (5, 12)}, then f is a
function from A to B (A → B) because each element of A has a
unique image in B, which can be expressed by the following
mapping or arrow diagram:
rijalujjwal09@gmail.com 4
Basic Concept of Function
o Example-3: Let A = {1, 2, 3, 4, 5} and B = {0, 1, 2, 3, 5, 7, 9, 12,
13} and f = {(1, 1), (2, 3), (2, 5), (3, 7), (4, 9)}, then f is not a
function from A to B (A → B) because (2, 3) and (2, 5) have the
same first component, which can be expressed by the following
mapping or arrow diagram:
rijalujjwal09@gmail.com 5
Basic Concept of Function
o Example-4: Let A = {1, 2, 3, 4, 5} and B = {0, 1, 2, 3, 5, 7, 9,
12, 13} and f = {(1, 1), (2, 3), (3, 5), (5, 9)}, then f is not a
function from A to B (A → B) since 4 ∈ A has no image in B,
which can be expressed by the following mapping or arrow
diagram:
rijalujjwal09@gmail.com 6
Equal Function
Definition:
✓ Let A and B be the two sets and f: A → B and g: B → A
be the two functions. We say that f and g are equal
functions and write f = g iff f(a) = g(a) for all a ∈ A.
Here, iff denotes if and only if.
✓ If f and g are not equal functions, then we write f ≠ g.
In general sense,
✓ Two functions are equal if they have the same
domain and co-domain and their values are the same
for all the elements of the domain.
rijalujjwal09@gmail.com 7
Identity Function
Definition:
✓ The function f: A → A is called the identity function if each
element of set A has an image on itself i.e. f(a) = a for all a ∈
A.
✓ It is denoted by IA .
Example: Consider set A = {1, 2, 3, 4, 5} and f: A → A
such that f = {(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)}.
rijalujjwal09@gmail.com 8
Real-valued Function
Definition:
✓A function f: A → R such that f(a) = R, a ∈ A, is called
a real valued function.
In general sense,
✓A real valued function is a function whose values are real
numbers. In other words, it is a function that assigns a
real number to each member of its domain.
✓In other words, if the domain and range of a function f
are the subsets of R (set of real numbers), then f is said
to be the real valued function of real variables or simply a
real function.
rijalujjwal09@gmail.com 9
Integer-valued Function
✓ An integer valued function is a function whose values
are integers.
✓ In other words, it is a function that assigns an
integer to each member of its domain.
✓ Floor and Ceiling functions are the examples of an
integer valued function of a real variable.
rijalujjwal09@gmail.com 10
Types of Function
o In general sense, there are following three types of
function:
✓ Injective Function (or One-to-One) Function.
✓ Surjective Function (or Onto) Function.
✓ Bijective Function (or One-to-One Correspondence)
Function.
o Now, they are discussed below:
rijalujjwal09@gmail.com 11
Injective Function
(One-to-One)
o A function f from A to B (A → B) is one-to-one if for all
x1, x2 ∈ A such that f(x1) = f(x2) implies x1 = x2.
o We can express the one to one function f by using the
quantifiers as follows:
∀x1∀x2 ((f(x1) = f(x2)) → (x1 = x2)), where universe
of discourse is the domain of the function.
o In other words, a function “f” from A to B is called
injective if it maps distinct elements of A to the distinct
elements of B.
rijalujjwal09@gmail.com 12
Injective Function
(One-to-One)
Fig: Injective Function
rijalujjwal09@gmail.com 13
Injective Function
(One-to-One)
rijalujjwal09@gmail.com 14
Surjective Function
(Onto Function)
o A function f from A to B (A → B) is an onto function if
every element of B is the image of some elements in A.
o We can express that “f” is surjective function using
quantifiers as follows:
∀y ∃x (f(x) = y)
o In other words, a function “f” from A to B is called
surjective if for every y in the co-domain B, there exists
at least one x in the domain A.
rijalujjwal09@gmail.com 15
Surjective Function
(Onto Function)
rijalujjwal09@gmail.com 16
Surjective Function
(Onto Function)
rijalujjwal09@gmail.com 17
Bijective Function
(One-to-One Correspondence)
o A function f from A to B (A → B) is said to be bijective
function if it is both injective (one-to-one) and
surjective (onto).
o In other words, a function “f” from A to B is bijective if
for every y in co-domain B, there is exactly one element
x in domain A.
rijalujjwal09@gmail.com 18
Bijective Function
(One-to-One Correspondence)
rijalujjwal09@gmail.com 19
Inverse of Function
o Let function f:A → B be a function which is bijective
(both one-to-one and onto), then the inverse function of
f is the function that assigns the unique element “a” in A
to an element “b” belonging to set B such that f(a) = b.
o The inverse function of f is denoted by f-1. Hence, we
have:
f-1(b) = a, when f(a) = b.
o A function f:A → B is invertible if its inverse function f-1
is a function from B to A (B → A).
o In general, the inverse of function f (f-1) may not be a
function.
rijalujjwal09@gmail.com 20
Inverse of Function
o Example-1: Let f be a function, and let A = {1, 2, 3, 4}
and B = {a, b, c, d}, then the function f defined on A to B
is given by f = {(1, a), (2, a), (3, d), (4, c)}. Find the
inverse of the function f.
Solution:
Here, we have,
f(1) = a
f(2) = a
f(3) = d
f(4) = c
rijalujjwal09@gmail.com 21
Inverse of Function
Now, let f-1 be the inverse of function f as:
f-1 = {(a, 1), (a, 2), (d, 3), (c, 4)}
i.e.
f-1(a) = {1, 2}
f-1(d) = 3
f-1(c) = 4
➢ Here, we can see that f-1 is not a function, since f-1(a) = {1, 2}.
rijalujjwal09@gmail.com 22
Inverse of Function
o Example-2: Show that the mapping f:R → R is defined by
f(x) = ax + b, where a, b, x ∈ R, a ≠ 0, is invertible.
Solution:
Inverse of a function f exists if that function is both
one-to-one and onto. Therefore, we first show that f is
one–to-one and then we show that it is onto.
Now, if x1 , x2 ∈ R, then f(x1) = f(x2).
i.e. ax1 + b = ax2 + b
i.e. x1 = x2
This proves that f is one-to-one.
Again, if y ∈ R, then y = f(x) = ax + b.
i.e. y = ax + b
rijalujjwal09@gmail.com 23
Inverse of Function
𝐲 −𝐛
i.e. x = ∈ R
𝐚
𝐲 −𝐛 𝐲 −𝐛
and, f( =a) ( +b)
𝐚 𝐚
=y–b+b
=y
𝐲 −𝐛
∴ y is the image of .
𝐚
Thus, f is onto.
Hence, f is one-to-one and onto both, therefore, f-1 exists
𝐲 −𝐛
and is defined by f (y) =
-1 . Here, y is just a dummy
𝐚
variable and can be replaced by x, then the inverse of
𝐱 −𝐛
function f is given by, f-1(x) = .
𝐚
rijalujjwal09@gmail.com 24
Composite Function
o Let f:A → B and g:B → C be two functions. The
composition of f and g, denoted by gof, is a new function
defined from A to C as:
gof(x) = g(f(x)) , for all x ∈ A.
rijalujjwal09@gmail.com 25
Composite Function
o Example-1: Let A = {1, 2, 3}, B = {a, b}, C = {r, s} and the
functions f:A → B defined by f(1) = a, f(2) = a, f(3) = b
and g:B → C defined by g(a) = s, g(b) = r. Find the
composite function gof:A → C.
Solution:
Given that f:A → B and g:B → C, then the corresponding
arrow diagram is constructed below:
rijalujjwal09@gmail.com 26
Composite Function
rijalujjwal09@gmail.com 27
Composite Function
Using the definition of composition of function, we get,
i. gof(1) = g(f(1)) = g(a) = s
ii. gof(2) = g(f(2)) = g(a) = s
iii. gof(3) = g(f(3)) = g(b) = r
Solved.
rijalujjwal09@gmail.com 28
Composite Function
o Example-2: Show that the function f(x) = x3 and the
function g(x) = x1/3 , for all x ∈ R are inverse of one
another.
Solution:
Here, fog(x) = f(g(x))
= f(x1/3)
= (x1/3)3
=x
= Ix
Also, gof(x) = g(f(x)) = g(x3) = (x3)1/3
Since, fog(x) = gof(x) = Ix , so f = g-1 and g = f-1.
Thus, the functions f and g are inverse of one another.
Hence, Proved. rijalujjwal09@gmail.com 29
Composite Function
o Example-3: Let the functions f and g defined by 2x+1
and x2 – 2 respectively. Find the formula defining the
composition function gof and fog.
Solution:
Here, gof(x) = g(f(x))
= g(2x+1)
= (2x+1)2 - 2
= 4x2 + 4x + 1 - 2
= 4x2 + 4x – 1
And, fog(x) = f(g(x))
= f(x2 – 2) = 2(x2 -1) + 1 = 2x2 – 4 + 1 = 2x2 – 3.
Solved.
rijalujjwal09@gmail.com 30
Composite Function
o Example-4: Let V = {1, 2, 3, 4} and let f = {(1, 3), (2, 1),
(3, 4), (4, 3)} and g = {(1, 2), (2, 3), (3, 1), (4, 1)}. Find:
(a). fog
(b). gof
(c). fof
(Test Yourself)
rijalujjwal09@gmail.com 31
Composite Function
o Example-5: Let f, g and h: R → R be defined by
𝟏
f(x) = x+2, g(x) = 𝟐 and h(x) = 3. Then, compute:
𝐱 +𝟏
(i). gof(x)
(ii). gof-1of(x)
(iii). hogof(x)
(Test Yourself)
rijalujjwal09@gmail.com 32
Graph of Functions
o The graph of a function f:A → B is the set of ordered
pairs {(a, b) | a ∈ A and f(a) = b}.
rijalujjwal09@gmail.com 33
Graph of Functions
Q) Display the graph of the function f(x) = x2 from the
set of integers to the set of integers.
Solution:
The graph of f is the set of ordered pairs of the form
(x, f(x)) = (x, x2), where x is an integer.
rijalujjwal09@gmail.com 34
rijalujjwal09@gmail.com 35
rijalujjwal09@gmail.com 36
rijalujjwal09@gmail.com 37
rijalujjwal09@gmail.com 38
rijalujjwal09@gmail.com 39
rijalujjwal09@gmail.com 40
rijalujjwal09@gmail.com 41
rijalujjwal09@gmail.com 42
rijalujjwal09@gmail.com 43
rijalujjwal09@gmail.com 44
rijalujjwal09@gmail.com 45
rijalujjwal09@gmail.com 46
rijalujjwal09@gmail.com 47
rijalujjwal09@gmail.com 48
rijalujjwal09@gmail.com 49
rijalujjwal09@gmail.com 50