Chapter IV Functions and Algorithms
Chapter IV Functions and Algorithms
Lesson I: Functions
It is a mapping in which every element of set A is uniquely associated at the element with
set B. The set of A is called Domain of a function and set of B is called Co domain.
Range of a Function: The range of a function is the set of picture of its domain. In other
words, we can say it is a subset of its co-domain. It is denoted as f (domain).
Let x = {1, 2, 3, 4}
y = {a, b, c, d, e}
f = {(1, b), (2, a), (3, d), (4, c)
Solution:
Functions as a Set
If P and Q are two non-empty sets, then a function f from P to Q is a subset of P x Q, with
two important restrictions
Example1: If a set A has n elements, how many functions are there from A to A?
Example1:
Example2: Let X = {x, y, z, k} and Y = {1, 2, 3, 4}. Determine which of the following
functions. Give reasons if it is not. Find range if it is a function.
Solution:
2. Surjective (Onto) Functions: A function in which every element of Co-Domain Set has one
pre-image.
Example: Consider, A = {1, 2, 3, 4}, B = {a, b, c} and f = {(1, b), (2, a), (3, c), (4, c)}.
Example:
Consider P = {x, y, z}
Q = {a, b, c}
and f: P → Q such that
f = {(x, a), (y, b), (z, c)}
4. Into Functions: A function in which there must be an element of co-domain Y does not have
a pre-image in domain X.
Example:
Consider, A = {a, b, c}
B = {1, 2, 3, 4} and f: A → B such that
f = {(a, 1), (b, 2), (c, 3)}
In the function f, the range i.e., {1, 2, 3} ≠ co-domain of Y i.e., {1, 2, 3, 4}
Example:
Consider, X = {k, l, m}
Y = {1, 2, 3, 4} and f: X → Y such that
f = {(k, 1), (l, 3), (m, 4)}
Example:
Consider X = {1, 2, 3, 4, 5}
Y = {x, y, z} and f: X → Y such that
f = {(1, x), (2, x), (3, x), (4, y), (5, z)}
Example:
Consider X = {a, b, c}
Y = {1, 2} and f: X → Y such that
f = {(a, 1), (b, 1), (c, 1)}
8. Many-One Onto Functions: Let f: X → Y. The function f is called many-one onto function if
and only if is both many one and onto.
Example:
Consider X = {1, 2, 3, 4}
Y = {k, l} and f: X → Y such that
f = {(1, k), (2, k), (3, l), (4, l)}
The function f is a many-one (as the two elements have the same image in Y) and it is onto (as
every element of Y is the image of some element X). So, it is many-one onto function
Lesson III: Identity Functions
The function f is called the identity function if each element of set A has an image on itself
i.e. f (a) = a ∀ a ∈ A.
It is denoted by I.
Example:
The function f is an identity function as each element of A is mapped onto itself. The
function f is a one-one and onto
Consider the bijective (one to one onto) function f: X → Y. As f is a one to one, therefore,
each element of X corresponds to a distinct element of Y. As f is onto, there is no element of
Y which is not the image of any element of X, i.e., range = co-domain Y.
Example:
The inverse function of f is shown in fig:
Lesson IV: Compositions of Functions
Consider functions, f: A → B and g: B → C. The composition of f with g is a function from A
into C defined by (gof) (x) = g [f(x)] and is defined by gof.
To find the composition of f and g, first find the image of x under f and then find the
image of f (x) under g.
Example1:
Consider the function f = {(1, a), (2, a), (3, b)} and g = {(a, 5), (b, 7)} as in figure. Find
the composition of gof.
Solution:
Note:
o If f and g are one-to-one, then the function (gof) (gof) is also one-to-one.
o If f and g are onto then the function (gof) (gof) is also onto.
o Composition consistently holds associative property but does not hold commutative
property.