MathematicsII
BSc(Software Engineering)
Geethika Senarathne
Functions
Functions
A function is defined as a relation between a set of inputs having
one output each.
Simply a function is a relationship between inputs where each input is
related to exactly one output.
The general representation of a function is y = f(x).
2
Function name 𝑓 𝑥 =𝑥 What to output
Input
Example
Eg:
f(x) = x2 + x -1
X Y
f(0) = 0 + 0 -1 = -1
f(1) = 1 + 1 -1 = 1
f(2) = 2 + 2 – 1 = 3 0 -1
F(3) = 9 + 3 – 1 =11
1 1
2 3
3 11
Special Rules for Function
• It must work for every possible input value. (Every element in X is
related to some element in Y. But some elements of Y might not
be related to at all, which is fine.)
• And it has only one relationship for each input value. (It will not
give back 2 or more results for the same input.)
Exercise
1. Which of the following relations are functions? Find the domain and range
of the function.
a) 𝑦 = 𝑥2 + 4
b) 𝑥 = 𝑦2 − 3
c) 𝑦 = |𝑥 + 3|
d) 𝑦 = 𝑥3 − 7
e) F(x) = 3x2 – 1
2. Given f(x) = 2x - 1, what is f(5)?
3. Given f(x) = 3x2 - 6, what is f(4)?
4. Given f(x) = |𝑥 - 8|, what is f(2)?
Exercise
5. Draw the graph for the following functions.
a) 𝑦 = 2x+1
b) 𝑦 = 𝑥2 -1
c) 𝑦 = |𝑥 + 3|
Terms Related to Function
▪ Domain: In a function, it is a set of all possible inputs. In other words, it
is a set of possible input variables.
▪ Codomain: The possible output of a function is called codomain. In
other words, it is an image of a function.
▪ Range: The actual output of a function is called range.
Example 01
What is the domain of the function f(𝑥) = 𝑥 + 3 ?
If x=3 : f(𝑥) = 3 + 3 = 6
If x=0: f(𝑥) = 0 + 3 = 3
If x=-3: f(x) = −3 + 3 = 0
If x=-4: f(x) = −4 + 3 = −1
The numbers less than 3 will result in the square root of a negative
number, which is an imaginary number.
Domain : x≥ -3
Example 02
What is the range of the function 𝑓(𝑥) = 2𝑥2 + 3?
If x=-2: f(𝑥) = 2(-2)2 + 3 = 11
If x=-1: f(𝑥) = 2(-1)2 + 3 = 5
If x=0 : f(𝑥) =2(0)2 +3= 3
If x=1: f(𝑥) = 2(1)2 + 3 = 5
The range is all possible y-values for the function. The y-values will begin
at three and increase infinitely.
Range : y ≥ 3
Exercise
1. What is the domain of the following functions?
a) b) c)
2. What is the range of the following functions?
a) b)
Types of Function - Based on
Mapping
Types of Functions
▪ Injective Function
Injective function is defined by f: A → B such that every element of
set A is connected to a distinct element in set B. Injective function is
also called an one-to-one function. Here every element of the
domain has a distinct image or co-domain element for the given
function. But there can be B without a matching with A.
Types of Functions
▪ Surjective Function
Every codomain element is related to the domain element. No
element of codomain is left without being mapped. For a function
defined by f: A → B, such that every element in set B has a pre-
image in set A.
Types of Functions
▪ Bijective Function
A function that is both a Injective and Subjective function is called a
Bijective function. Here every element of the domain is connected to
a distinct element in the codomain and every element of the
codomain has a pre-image. Also in other words every element of set
A is connected to a distinct element in set B, and there is not a single
element in set B which has been left out.
Exercise
1. Which of the following relations are functions? Find the domain and range
of the function.
a) f = {(1, 3), (1, 5), (2, 3), (2, 5)}
b) f = {(1, 1), (5, 5), (8, 8), (3, 3),(6,6)}
c) f(x) = 2x +1
d) f = {(2, 1), (5, 1), (8, 1), (11, 1)}
e) F(x) = 3x2 – 1
2. Check whether the following functions are injective, subjective or bijective.
a) If A = {1, 5, 8, 9} and B {2, 4} And f={(1, 2), (5, 4), (8, 2), (9, 4)}.
b) If A = {1, 2, 3} and B = {a, b, c, d} and f = {(1, a),(2, b),(3, c)}
c) If A = {5,6,7,8} and B = {1,3,5} and f = {(5,3),(6,1),(7,3),(8,5)}
Types of Function - Based on
Degree
▪ Identity Function
The identity function has the same domain and range.
The identity function equation is f(x) = x, or y = x.
Its ordered pairs are of the form {(1, 1), (2, 2), (3, 3), (4, 4).....(n, n)}.
The graph of the identity function is a straight line that is equally
inclined to the coordinate axes and is passing through the origin.
▪ Constant Function
A constant function is an important form of a many-to-one function.
In a constant function, all the domain elements have a single image.
The constant function is of the form f(x) = K, where K is a real
number. For the different values of the domain (x value), the same
range value of K is obtained for a constant function.
▪ Linear Function
The domain and range of a linear function is the set of all real
numbers, and it has a straight-line graph.
Eg: y = x + 2, y = 3x, y = 2x – 1
The identity function of y = x can also be considered a linear function.
Graphically the linear function can be represented by the equation of
a line y = mx + c,
where m is the slope of the line and c is the y-intercept of the line.
▪ Quadratic Function
A quadratic function has a second-degree quadratic equation and it
has a graph in the form of a curve. The general form of the quadratic
function is
f(x) = ax2 + bx + c, where a ≠ 0 and a, b, c are constant and x is a
variable.
▪ Cubic Function
A cubic function has an equation of degree three. The general form
of a cubic function is
f(x) = ax3 + bx2 + cx + d, where a ≠ 0 and a, b, c, and d are real
numbers & x is a variable.
The graph of a cubic function is more curved than the quadratic
function. An example of a cubic function is f(x) = 8x3 + 5x2 + 3.
▪ Polynomial Function
The general form of a polynomial function is
f(x) = anxn + an-1xn-1 + ..... ax + b.
Here n is a nonnegative integer and x is a variable.
Based on the highest power (exponent) of the polynomial function,
the functions can be classified as a quadratic function, cubic function,
etc.
Inverse Functions
An inverse function or an anti function is defined as a function, which
can reverse into another function.
If any function “ f “ takes x to y then, the inverse of “ f ” will take y to
x. If the function is denoted by ‘ f ’ , then the inverse function is
denoted by f-1
For instance, the function f(x) =y
Then the inverse of y is g(y) = x
Example
Find out the inverse function of f(x) = 2x + 3 ?
f(x) = y = 2x + 3
Inverse function equation is, f-1(y) = x
2x = y – 3
x= y-3
2
f-1 = y-3
2
Example
Let f(x) = x2 + 1. Find f-1(10).
Let f-1(10) = x.
⇒ f(x) = 10
⇒ x2 + 1 = 10
⇒ x = ±3
Therefore, f-1(10) = {-3, 3}
Exercise
Find the invers functions of the functions below.
a) 𝑔(𝑥) = 2𝑥 − 7
b) 𝑓(𝑥) = 4x
c) 𝑓(𝑥) = 𝑥6
d) 𝑔(𝑥) = 3/x
Operations on Functions
▪ Addition
(f + g)(x) = f(x) + g(x)
Eg: f(x) = 2x2 + 3x – 4 and g(x) = 2x + 3
(f + g)(x) = (2x2 + 3x – 4) + (2x + 3)
= 2x2 + 5x – 1
▪ Subtraction
(f – g)(x) = f(x) – g(x)
Eg: f(x) = 2x2 + 3x – 4 and g(x) = 2x + 3
(f – g)(x) = (2x2 + 3x – 4) – (2x + 3)
= 2x2 + x – 7
Operations on Functions
▪ Multiplication
(f•g)(x) = f(x)•g(x)
Eg: f(x) = 3x – 5 and g(x) = x
(f•g)(x) = (3x – 5)•(x)
= 3x2 – 5x
▪ Division
(f/g)(x) = f(x)/g(x)
Eg: f(x) = 3x2 + 4x – 3 and g(x) = x
(f/g)(x) = (3x2 + 4x – 3)/x
= 3x + 4 – (3/x)
Exercise
1. Find f(x) +g(x), if f(x) = - 7 x - 5 and g(x) = 10 x – 12
2. If 𝑓(𝑥) = 3𝑥3 + 2𝑥2 − 5𝑥 + 2 and 𝑔(𝑥) = −𝑥3 − 𝑥2 + 5, find 𝑓(𝑥) − 𝑔(𝑥)
3. If 𝑓(𝑥) = 24𝑥5 and 𝑔(𝑥) = 6𝑥3 find f(x)/g(x).
4. If 𝑓(𝑥) = −2𝑥2 + 3𝑥 − 4 and 𝑔(𝑥) = 3𝑥2 − 6, what is 𝑓(𝑥) × 𝑔(𝑥)?
5. Given 𝑓(𝑥) = 𝑥3 − 1 and 𝑔(𝑥) = 𝑥2 + 4, what is 𝑔(𝑓(2))?