0% found this document useful (0 votes)
35 views50 pages

CSIT DS Functions

This document provides an overview of basic discrete structures, focusing on the concept of functions, including definitions, types (injective, surjective, bijective), and examples. It explains the identity function, real-valued functions, integer-valued functions, and the composition and inverse of functions. The document is structured with definitions, examples, and illustrations to clarify these mathematical concepts.

Uploaded by

Vishan Katuwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views50 pages

CSIT DS Functions

This document provides an overview of basic discrete structures, focusing on the concept of functions, including definitions, types (injective, surjective, bijective), and examples. It explains the identity function, real-valued functions, integer-valued functions, and the composition and inverse of functions. The document is structured with definitions, examples, and illustrations to clarify these mathematical concepts.

Uploaded by

Vishan Katuwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

Unit – 1

Basic Discrete Structures

Compiled By
Ujjwal Rijal
[email protected]

[email protected] 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).

[email protected] 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:

[email protected] 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:

[email protected] 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:

[email protected] 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:

[email protected] 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.

[email protected] 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)}.

[email protected] 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.

[email protected] 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.

[email protected] 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:

[email protected] 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.

[email protected] 12
Injective Function
(One-to-One)

Fig: Injective Function


[email protected] 13
Injective Function
(One-to-One)

[email protected] 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.

[email protected] 15
Surjective Function
(Onto Function)

[email protected] 16
Surjective Function
(Onto Function)

[email protected] 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.

[email protected] 18
Bijective Function
(One-to-One Correspondence)

[email protected] 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.

[email protected] 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

[email protected] 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}.
[email protected] 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
[email protected] 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) = .
𝐚
[email protected] 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.

[email protected] 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:

[email protected] 26
Composite Function

[email protected] 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.

[email protected] 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. [email protected] 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.
[email protected] 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)

[email protected] 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)

[email protected] 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}.

[email protected] 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.

[email protected] 34
[email protected] 35
[email protected] 36
[email protected] 37
[email protected] 38
[email protected] 39
[email protected] 40
[email protected] 41
[email protected] 42
[email protected] 43
[email protected] 44
[email protected] 45
[email protected] 46
[email protected] 47
[email protected] 48
[email protected] 49
[email protected] 50

You might also like