1
MAT 115: DISCRETE MATHEMATICS LECTURE NOTES ON
FUNCTIONS
By Dr. Runji Flora,
Lecturer
Department of Mathematics,Statistics and Actuarial Science
School of Pure and Applied Sciences
Karatina University
September 2020
Contents
1 FUNCTIONS 3
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.1 Definition of a function . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.2 Representations of functions . . . . . . . . . . . . . . . . . . . . . 5
1.1.3 Identifying the Domain and range of a function . . . . . . . . . . 7
1.1.4 Equality of Functions . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.1.5 Graph of a function . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2 Types of fuctions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2.1 The Identity function . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2.2 The Constant function . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2.3 Restriction function . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.2.4 Inclusion function . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.2.5 Real Valued functions . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3 Composition of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2
Chapter 1
FUNCTIONS
1.1 Introduction
Functions are special case of relations. If we suppose A and B are two non-empty sets
and R is a relation from A to B, then R may not relate an element of A to an element
of B or it may relate an element of A to more than one element of B. But a function
relates each element of A to a unique element of B.
1.1.1 Definition of a function
Definition 1.1.1. Let A and B be non- empty sets. A function f from set A to set B
is a rule that assigns exactly one element b of B to each element a of A.
We denote a function f from set A to set B by f : A → B, and f (a) = b for the
element of B that f assigns to a ∈ A, its called the value of f at a.
If f : A → B, the set A is called the Domain of f , the set B is called the Codomain
of f .If f (a) = b, the element b is the image of a under f , while a is the pre-image of b
under f . The set of all image values of f is called the image or range of f . The range
is a subset of B.
Remark. Functions are sometimes called mappings of transformations.
Example 1.1.1. Let A = {a, b, c, d}, and B = {x, y, z, w}. Consider the assignment
rule f : A → B which is defined by: f = {(a, y), (b, x), (c, z), (d, y)}.We first check that
3
1.1 Introduction 4
this is a function. For every element in A, we do have an assignment: f (a) = y, f (b) = x,
f (c) = z and f (d) = y. Also every element in A has uniquely been assigned to a element
in B. The domain of f is A, the codomain of f is B. The pre-image of x is {b} because
f (b) = x. The pre-image of y is {a, d} because f (a) = f (d) = y. The pre-image of z is
{c} because f (c) = z . The pre-image of w is {} = ∅ since it doesn’t have a pre-image
element. For the range, we look at B, out of the four elements three have a pre-image,
therefore the range is {x, y, z}.
Example 1.1.2. State whether or not each of the following relation arrow diagram
below defines a function from A = {a, b, c} into B = {x, y, z}.
a) This is not a function since element b has not been assigned to an element in B.
A B
a x
b y
c z
Figure 1.1: Relation a)
b) This is not a function since element c has not been uniquely assigned to an element
in B. Two elements x and z are assigned to c.
A B
a x
b y
c z
Figure 1.2: Relation b)
c) This is a function since every element been uniquely assigned to an element in B.
1.1 Introduction 5
A B
a x
b y
c z
Figure 1.3: Relation c)
1.1.2 Representations of functions
There are four possible ways to represent a function:
1. Verbally: by a description in words
2. Numerically: by a table of values
3. Visually: by a graph
4. Algebraically: by an explicit formula
Example 1.1.3. Let A be the set of students in MAT 115 class. Determine which
of the following assignments defines a function on A.
a) To each student assign his or her age.
This is a function since each student has only one value that can be assigned
as his or her age
b) To each student assign his or her gender.
This is a function since every student fits into one category of gender.
c) To each student assign his or her spouse.
This is not a function since it possible to have more than one spouse or none.
Definition 1.1.2. A subset f of A × B is a function f : A → B if and only if eac a ∈ A
appears as the first coordinate in exactly one ordered pair in f .
Example 1.1.4. Let X = {1, 2, 3, 4}. Determine whether each of the following relations
on X defines a function on X.
1.1 Introduction 6
a) f = {(2, 3), (1, 4), (2, 1), (3, 2), (4, 4)}
This is not a function since the element 2 has not been uniquely assigned into a single
element in the codomain
b) g = {(3, 1), (4, 2), (1, 1)}
This is not a function since the element 2 has not been assigned to an element in the
codomain
c) f = {(2, 1), (3, 4), (1, 4), (2, 1), (4, 4)}
This is a function .
Example 1.1.5. Let f : R → R be the function that assigns to each real number x its
square x2 . The function may also be expressed in the following ways:
f (x) = x2
x x2 : The barred arrow is read as ”goes into”
y = x2 : x in this formular is called the independent variable, y the dependent
variable.
Remark. Whenever a function f is given by a formular using the independent variable
x, we assume , unless otherwise stated or implied, that f is a function from R or the
largest subset of R for which f has meaning into R.
Example 1.1.6. Consider the function f (x) = x2 + 3 , find:
a) the value of f at 5, −4 and 0.
b) f (Ann)
c) f (x + h)
d) f (x + h) − f (x)
f (x + h) − f (x)
e)
h
f) image of f
1.2 Types of fuctions 7
1.1.3 Identifying the Domain and range of a function
The table below indicates the domain and the range of various functions
Function Domain Range
f (x) = x2 (−∞, ∞) [0, ∞)
1
f (x) = R − {0} R − {0}
x
√
f (x) = x [0, ∞) [0, ∞)
√
f (x) = 4 − x (−∞, 4] [0, ∞)
√
f (x) = 1 − x2 [−1, 1] [0, 1]
1
f (x) = 2 R − {0, 1} R − {0}
x −x
1.1.4 Equality of Functions
Two functions f : A → B and g : A → B are said to be equal, written f = g if
f (a) = g(a) for every a ∈ A.
1.1.5 Graph of a function
To each f : A → B there corresponds the subset of A × B given by {(a, f (a)) : a ∈ A}.
We call this set the graph of f .
1.2 Types of fuctions
1.2.1 The Identity function
The identity function is a function which returns the same value, which was used as its
argument. It is also called an identity relation or identity map or identity transforma-
tion. If f is a function, then identity relation for argument x is represented as f (x) = x
, for all values of x. The identity function algebraically is the function y = x, its graph
is shown below:
1.2 Types of fuctions 8
2 y
x
−2 −1 1 2
−1
−2
From relations perspective, the identity function is the diagonal relation,4A ⊂ A × A
Example 1.2.1. Let A = {1, 2, 3, 4, 5, 6} Then Identity function IA : A → A on set A
will be defined as: IA (x) = x for all x ∈ A,
For x = 1, IA (1) = 1,
For x = 2, IA (2) = 2
For x = 3, IA (3) = 3
For x = 4, IA (4) = 4
For x = 5, IA (5) = 5
1.2.2 The Constant function
Let f be a function with domain A. Then f is a constant function if every a ∈ A is
assigned the same element i.e. a constant function is a function whose value is the same
for every input value.
Example 1.2.2. The function f : R → R defined by f (x) = 3. This function maps all
the real numbers to the same value 3. Its graph is shown below:
1.2 Types of fuctions 9
3.6 y
3.4
3.2
2.8
x
−3 −2 −1 1 2 3
1.2.3 Restriction function
Let S be a subset of A and let f : A → B. The restriction of f to S is the mapping
f S : A → B or fˆ: A → B is defined by fˆ(s) = f (s) for every s ∈ S
Example 1.2.3. Let f : R → R be defined by f (x) = x2 . Let fˆ : Z → R be the
restriction of f to Z. Find
i) fˆ(4). Solution: fˆ(n) = f (n) for every n ∈ Z. Thus fˆ(4) = f (4) = 42 = 16
ii) fˆ(3). Solution: fˆ(3) = f (3) = 9
iii) fˆ(1/2). Solution: fˆ(1/2) is not defined since 1/2 is not in the domain of fˆ.
1.2.4 Inclusion function
Let S be a subset of A. The inclusion map from S into A denoted by i : S ,→ A is
defined by i(x) = x for every x ∈ S. The inclusion map of S into A is the restriction of
the identity map on A to S.
Example 1.2.4. Let i : N → R . Find
i) i(4). Solution: i(4) = 4
ii) i(23). Solution: i(23) = 23
iii) i(−5). Solution: i(−5) is not defined since −6 is not in the domain N of i : S ,→ A.
1.2 Types of fuctions 10
1.2.5 Real Valued functions
These are functions which map sets into R. Frequently, the domain of f is R or an
interval subset of R and hence the functions can be ploteed in the coordinate plane
R×R = R2 . In particular, when the functions are piecewise continous and differentiable,
such as polynomial, rational, trigonometric, exponential and logarithmic functions, the
graph of such a function can be approximated by first plotting some of its points and
then drawing a smooth curve through these points.
Example 1.2.5. Let f : R → R be defined by
−x
x≤0
f (x) =
x
x>0
This is a piecewise defined function.Its graph is shown below:
3 y
x
−3 −2 −1 1 2 3
A piecewise function is a function where more than one formula is used to define the
output over different pieces of the domain.Each formula has its own domain, and the
domain of the function is the union of all of these smaller domains.
Example 1.2.6. Given the function
7x + 3 x≥0
f (x) =
x2
x<0
1.3 Composition of functions 11
Evaluate:
i) f (−2)
ii) f (0)
iii) f (5)
Plot the graph.
1.3 Composition of functions
Consider the functions f : A → B and g : B → C where the codomain of f is the
domain of g. The composition function of f and g, written g ◦ f , is the function from A
into C defined by (g ◦ f )(a) = g(f (a)).
Example 1.3.1. Let functions f and g be defined by f (x) = 2x + 1 and g(x) = x2 − 2
respectively. Find:
i) (g ◦ f )(4) .
Solution: (g ◦ f )(4) = g(f (4)) = g(9) = 79
ii) (f ◦ g)(4) .
Solution: (f ◦ g)(4) = f (g(4)) = f (14) = 29
iii) a formula for g ◦ f .
Solution: (g ◦ f )(x) = g(f (x)) = g(2x + 1) = (2x + 1)2 − 2 = 4x2 + 4x − 1
iv) a formula for f ◦ g .
Solution: (f ◦ g)(x) = f (g(x)) = f (x2 − 2) = 2(x2 − 2) + 1 = 2x2 − 3
v) a formula for f ◦ f .
Solution: (f ◦ f )(x) = f (f (x)) = f (2x + 1) = 2(2x + 1) + 1 = 4x + 3
vi) a formula for g ◦ g .
Solution: (g ◦ g)(x) = g(g(x)) = g(x2 − 2) = (x2 − 2)2 − 2 = x4 − 4x2 + 2
1.3 Composition of functions 12
Exercise 1:
√ x
If f (x) = x, g(x) = and h(x) = 4x − 8, find:
4
i) (h ◦ g ◦ f )(4)
ii) (h ◦ g ◦ f )(x)
iii) (h ◦ f ◦ g)(4)
iv) (g ◦ f ◦ h)(4)
v) (f ◦ g ◦ h)(4)
vi) (f ◦ f ◦ f )(4)