DISCRETE MATHEMATICS
MODULE 2
REL ATIONS AND FUNCTIONS
Relations and Functions in real life give us the link between any two
entities. In our daily life, we come across many patterns and links that
characterize relations such as a relationship between a father and a son, a
brother, and a sister, etc. In mathematics also, we come across many
relations between numbers such as a number x is less than y, line l is
parallel to line m, etc. Relation and function map elements of one set
(domain) to the elements of another set (codomain).
Functions are nothing but special types of relations that define the precise
correspondence between one quantity with another.
What are Relations and Functions?
Relations and functions define a mapping between two sets (Inputs and
Outputs) such that they have ordered pairs of the form (Input, Output).
Relation and function are very important concepts in algebra. T hey are
used widely in mathematics as well as in real life.
Relation and Function Definition
Relation and function individually are defined as:
Relations - A Relation R from a non-empty set B is a subset of the
Cartesian product A × B. T he subset is derived by describing a
relationship between the first element and the second element of the
ordered pairs in A × B.
Functions - A relation f from a set A to a set B is said to be
a function if every element of set A has one and only one image in
set B. In other words, no two distinct elements of B have the same
pre-image.
Pl e a s e no t e t h at a l l f u nc t io n s a re re l a t i on s b u t a l l re l a ti o ns a re no t f un c t io n s .
Relations and Functions Examples
Relation Example
In the below relation {( -2, 3), (4, 5), (6, -5), (-2, 3)}, find the domain and
range. Here the domain is { -2,4, 6} and the range is { -5,3, 5}.
Function Example
Consider the below examples of a function, A = {( 2, 5), (2, 5), (3, -7), (4, -
8), (4, -8)}. Generally, it is not a function o f the input values or X- values
are repeat ed. However, in this case, the input values are repea ted along
with the associated output values or Y -values. T herefore, it is a function.
x x
y
z
A function Not a function
Representation of Relation and Function
Relations and functions can be represented in different forms such as arrow
representation, algebraic form, set -builder form, graphic, roster form, and
tabular form. Define a function f: A = {1, 2, 3} → B = {1, 4, 9} such that f(1)
= 1, f(2) = 4, f(3) = 9.
Now, let us represent this function in different forms.
Set-builder form - {(x, y): f(x) = y 2 , x ∈ A, y ∈ B}
Roster form - {(1, 1), (2, 4), (3, 9)}
Arrow Representation -
T able Representation –
x y
1 1
2 4
3 9
Difference Betw een Relation and Function
T he basic difference between a relation and a function is that in a relation ,
a single input may have multiple outputs . W hereas in a function, each
input has a single output. T he table given below highlights the differences
between relations and functions.
Relation Function
A function is a relation in
A relation in math is a set of math such that each element
ordered pairs defining the of the domain is related to a
relation between two sets. single element in the
codomain.
A relation may or may not be
All functions are relations.
a function.
Example: {(1, x), (1, y), Example: {(1, x), (6, y),
(4, z)} (4, z)}
Terms Related to Relations and Functions
Now that we have understood the meaning of relation and function, let us
understand the meanings of a few terms related to relations and functions
that will help to underst and the concept in a better way.
Cartesian Product - Given two non- empt y sets P and Q, the
Cartesian Product P × Q is the set of all ordered pairs of elements
from P and Q, that is, P × Q = {(p, q): p ∈ P, q ∈ Q}.
Domain - T he set of all first elements of the ordered pairs in a relation
R from a set A to a set B is called the domain of the relation R. It is
called the set of inputs or pre - images.
Range - T he set of all second elements of the ordered pairs in a
relation R from a set A to a set B is called the range of the relation
R. It is called the set of outputs or images.
Codomain - T he whole set B in a relation R from a set A to a set B is
called the codomain of the relation R. Range ⊆ Codomain.
Types of Relation s and Functions
Different types of relations and functions have specific properties which
make them different and unique .
Types of Relations
Given below is a list of different types of relations:
Empty Relation - A relation is an empty relation if it has no
elements, that is, no element of set A is mapped or linked to any
element of A. It is denoted by R = ∅.
For example, if there are 300 oranges in the fruit bucket. T here’s no
possibilit y of finding a relation R of getting any mangoes in the basket.
So, R is void as it has 300 oranges and no mangoes.
Universal Relation - A Relation R in a set A is a universal relation if
each element of A is related to every element of A, i.e., R = A × A. It
is called the full relation.
For example, suppose we have a set 1 that comprises all the natural
numbers and another set 2 t hat consists of all whole numbers. T hen
we can say that the relation between 1 and 2 is universal as every
element of set 1 is within set 2.
Identity Relation - A Relation R on A is said to be an identit y relation
if each element of A is related t o itself, that is, R = {(a, a): for all a ∈
A}.
For example, i f A = {1, 2, 3} then R = {(1, 1), (2, 2), (3, 3)} is the
identit y relationship.
Inverse Relation - Define R to be a relation from set P to set Q i.e.,
R ∈ P × Q. T he relation R - 1 is said to be an Inverse relation if R - 1 from
set Q to P is denoted by R - 1 = {(q, p): (p, q) ∈ R}.
For example, i f R = {(1, 2), (3, 5), (5, 7)} then R - 1 = {(2, 1) (5,
3) (7, 5)}.
Reflexive Relation - A binary relation R defined on a set A is said to
be reflexive if, for every element a ∈ A, we have aRa, that is, (a, a) ∈
R.
For example, N is the set of all natural numbers and the relation R =
{(a, b) | a = b} is a reflexive relation.
Symmetric Relation - A binary relation R defined on a set A is said
to be symmetric if and only if, for elements a, b ∈ A, we have aRb,
that is, (a, b) ∈ R, then we must have bRa, that is, (b, a) ∈ R.
For example, N is the set of all natural numbers, and the relation R
= {(a, b) | a = b} is a symmetric relation because whenever a = b, then
it means that b = a.
Transitive Relation - A Relation R is transitive if and only if (a, b) ∈
R and (b, c) ∈ R ⇒ (a, c) ∈ R for a, b, c ∈ A.
For example, N is the set of all natural numbers and the relation R =
{(a, b) | a = b} is a transitive relation because whenever a = b and b
= c then it means that a = c.
Equivalence Relation - A Relation R defined on a set A is said t o be
an equivalence relation if and only if it is reflexive, symmetric, and
transitive.
For example, w e have already seen that the relation R = {(a, b) | a =
b} on the set of natural numbers is reflexive, symmetric, and
transitive, and hence it is an equivalence relation.
Reflexive Relation Symmetric Relation Transitive Relation
States that for States that for all real States that for all real
every real number x, x numbers x and y, numbers x, y, and z,
= x. if x=y, then y=x. if x=y and y=z,
then x=z.
Types of Functions - Based on Set Elements
T hese types of functions are classified based on the number of
relationships between the elements in the domain and the codomain. T he
different types of functions based on set elements are as follows:
One-to-One Function
A one-to-one function is defined by f:
A → B such that every element of set
A is connected to a distinct element in
set B. T he one-to-one function is also
called an injective function. Here
every element of the domain has a
distinct image or co -domain element
for the given function.
Many-to-One Function
A many-to-one function is defined
by the function f: A → B, such that
more than one element of set A is
connect ed to the same element in
set B. In a many-to-one function,
more than one element has t he
same co- domain or image. If a
many-to-one function, in the
codomain, is a single value or the domain element is all connect ed to
a single element, then it is called a constant function.
Onto Function
In an, onto function, every
codomain element is re lated to the
domain element. For a function
defined by f: A → B, such that every
element in set B has a pre -image in
set A. T he onto function is also
called a subjective function .
One and Onto Function
A function that is
both one and onto
function is called a
bijective function.
Here every
element of the
domain is
connect ed 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 that has been left out.
Into Function
Into function is exactly opposit e in
properties to an onto function. Here
certain elements in the co -domain do
not have an y pre- image. T he
elements in set B are excess and are
not connected to any elements in set
A.
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.
T he constant function is
of 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.
Every element of the Every element of set A is
domain has a distinct image connect ed to a distinct
or co-domain element for element in set B, and there
the given function is not a single element in
set B which has been left
out
Relations and Functions Examples
Example 1: Given three relations R, S, T from A = {x, y, z} to B = {u, v, w}
defined as:
1. R = {(x, u), (z, v)}, S = {(x, u), (y, v), (z, w)}, T = {(x, u), (x, v), (z, w)}.
Identify which of the given relations is/are function(s) using relations
and functions definit ion.
Solution:
1. For R = {(x, u), (z, v)}, each element of A is not mapped to an element
of B which violates the definition of a function. Hence, R is not a
function.
2. For S = {(x, u), (y, v), (z, w)}, each element of A is mapped to a unique
element of B wh ich satisfies the definition of a function. Hence, S is
a function.
3. For T = {(x, u), (x, v), (z, w)}, element x of A is mapped to two different
elements of B which violates the definition of a function. Hence, T is
not a function.
Answ er: S = {(x, u), (y, v), (z, w )} is a function.
Example 2: Define a relation R from A to A = {1, 2, 3, 4, 5, 6} as R = {(x,
y): y = x + 1}. Determine the domain, codomain , and range of R.
Solution: W e can see that A = {1, 2, 3, 4, 5, 6} is the domain and codomain
of R.
T o determine the range, we det ermine the values of y for each value of x,
that is when x = 1, 2, 3, 4, 5, 6
x = 1, y = 1 + 1 = 2;
x = 2, y = 2 + 1 = 3;
x = 3, y = 3 + 1 = 4;
x = 4, y = 4 + 1 = 5;
x = 5, y = 5 + 1 = 6;
x = 6, y = 6 + 1 = 7.
Since 7 does not belong to A and the relation R is defined on A, hence, x =
6 has no image in A.
T herefore, the range of R = {2, 3, 4, 5, 6}
Answ er: Domain = Codomain = {1, 2, 3, 4, 5, 6}, Range = {2, 3, 4, 5, 6}
Practice Questions on Relation and Function
Question 1. State T rue or False.
'Every function is a relation but every relation is not a function.'
True
False
Question 2. If f is a function on real numbers defined as f(x) = x 9 − 6x 8 −
2x 7 + 12x 6 + x 4 − 7x 3 + 6x 2 + x − 3, find f(6).
4
3
0
5
Question 3. W hich of the above are many-to- many relations?
a. f b. g c. h d. q
Question 4. W hich of the above is one to one relation?
a. f b. g c. h d. q
Question 5. W hich of the above is one too many relations?
a. f b. g c. h d. q
Question 6. If A = {1, 2, 3}, the number of symmetric relations in A is
a. 3 b. 8 c. 328 d. 63