You are on page 1of 94

Module2

Relations

Topics to be covered :
• Definition
• Types of Relations
• Representation of Relations
• Closure of Relations
• Warshall’s Algorithm
• Equivalence Relation
• Equivalence Classes

Weightage : 15 %

Books : C. L. Liu “Elements of Discrete


Mathematics”
Domain of a Relation :
Let A and B be two non-empty sets and R be relation from A to B ,i.e. R is a
subset of A * B , then the domain of R is subset of A such that the collection
of first elements of all ordered pairs of R ie. Domain of R = {a | (a,b) belongs to
R}

Range of a Relation :
If R is a relation from A to B , then the range of R is a subset of B such that
the collection of second element of all ordered pairs of R i.e. Range of R = {b |
(a,b) belongs to R}

Inverse Relation :
Let R be a relation from A to B , then the inverse relation of R is the collection
of all (b,a) such that (a,b) belongs to R . It is denoted by 𝑅−1 , defined as 𝑅−1
=
{(b,a) | (a,b) belongs to R}
Example 1 : Let R be a relation on A = {1,2,3,4} defined by “x less than y ”
i. Write ‘R’ the set of ordered pair
ii. Find 𝑅−1 of the relation R
iii. Can 𝑅−1be described in words ?

Answer :

iv. R= {(x,y) | x R y iff x < y}


R = { (1,2) , (1,3) , (1,4) , (2,3) , (2,4) , (3,4) }

ii. 𝑅−1 = {(y,x) | (x,y) belongs to R }


= { (2,1) , (3,1) , (4,1) , (3,2} , (4,2) , (4,3) }

iii. 𝑅−1 can be described as , “ x 𝑅−1 y iff x>y” i.e. “x is greater than y ”
In-degrees : Let R be a relation on A & a belong to A then the in-degree of a
belongs to A is the number of b such that b R a i.e. number of b | (b,a) belongs
to R

Out-degrees : Let R be a relation on A & a belong to A then the out-degree of


a belongs to A is the number of b such that a R b i.e. number of b | (a,b)
belongs to R
Find the matrix relation and relation diagraph of A= {1,2,3,4,5} = B . a R b iff b
is a multiple of a . Find in-degrees and out-degrees of each vertex .
b

1 2 3 4 5
1 1 1 1 1 1
2 0 1 0 1 0
a
3 0 0 1 0 0
4 0 0 0 1 0
5 0 0 0 0 1
Composition Relations :
Let A , B and C be sets , R is a relation from A to B and
S is a relation from B to C .

We can we define a new relation , the composition of R


and S , written SoR .

The relation SoR from A to C and is defined as follows :


- If a belongs to A and c belongs to C then a(SoR)c iff for some b
belongs to B we have aRb and bSc
Let P = {2, 3, 4, 5}. Consider the relation R and S on P defined by
R = {(2, 2), (2, 3), (2, 4), (2, 5), (3, 4), (3, 5), (4, 5), (5, 3)}
S = {(2, 3), (2, 5), (3, 4), (3, 5), (4, 2), (4, 3), (4, 5), (5, 2), (5,
5)}.

Find the matrices of the above relations.


Use matrices to find the following composition of the relation R and S.
(i)RoS (ii)RoR (iii)SoR
(i) To obtain the composition of relation R and S. First multiply MR with MS to
obtain the matrix MR x MS as shown in fig below . The non zero entries in the
matrix MR x MS tells the elements related in RoS.

RoS = {(2,3) , (2,5) , (2,4) , (2,2) , (3,3) , (3,5) , (3,2) , (4,2) , (4,5) , (5,5)}
(ii) First, multiply the matrix MR by itself, as shown in fig

R = {(2, 2), (2, 3), (2, 4), (2, 5), (3, 4), (3, 5), (4, 5), (5, 3)}
RoR = { (2,2) , (2,3) , (2,4) , (2,5) , (3,5) , (3,3) , (4,3) , (5,4) , (5,5)}
R o R = { (2,2) , (2,3) , (2,4) , (2,5) , (3,5) , (3,3) , (4,3) , (5,4) ,
(5,5)}
Multiply the matrix MS with MR to obtain the matrix MS x MR as shown in fig:

R = {(2, 2), (2, 3), (2, 4), (2, 5), (3, 4), (3, 5), (4, 5), (5, 3)}
S = {(2, 3), (2, 5), (3, 4), (3, 5), (4, 2), (4, 3), (4, 5), (5, 2), (5, 5)}
SoR = {(2,4) , (2,5) , (2,3) , (3,5) , (3,3) , (4,2) , (4,3) , (4,4) , (4,5) , (5,2) ,
(5,3) , (5,4) , (5,5)}

S o R = {(2,4) , (2,5) , (2,3) , (3,5) , (3,3) , (4,2) , (4,3) , (4,4) , (4,5) ,


(5,2) ,
(5,3) , (5,4) , (5,5)}
Reflexive Closure : Let R be a relation on set A then a
smallest reflexive relation on A is called Reflexive closure
of R if it contains R .
Note :
 A smallest reflexive relation R1 containing R can be
determined by formula R1=∆ U R , where ∆ is
diagonal relation
 If R is a reflexive relation then reflexive closure of
R is itself
Symmetric Closure : Let R be a relation on set A and R is
not symmetric then a smallest symmetric relation is
said to be symmetric closure of R if it contains R.

Note :
 A smallest symmetric relation R1 for a not symmetric
relation R can be determined by formula R1 = R U 𝑅−1.
 If R is a symmetric relation then symmetric closure of
R is itself
Let R be relation on set A = {1,2,3} defined by R = {(1,1) ,
(1,2) , (2,3)} . Find the reflexive closure and symmetric
closure of R.


Transitive Closure
 Let R be relation on set A and R is not transitive .
Then the smallest transitive relation is said to be
transitive closure if it contains R

Note :
a. If R is transitive then the transitive closure of R
itself
b. Transitive closure of R =𝑅∞
c. Transitive closure of a non transitive relation can
be
found using Warshall’s Algorithm
Let A = {1,2,3,4} and R = {(1,2) , (2,1) , (2,2) , (4,3) , (3,1) }
Find the transitive closure of the Relation R.
Let A = {1,2,3,4} and R = {(1,2) , (2,1) , (2,2) , (4,3) , (3,1) }
Find the transitive closure of the Relation R.
Let A = {1,2,3,4} and R = {(1,2) , (2,1) , (2,2) , (4,3) , (3,1) }
Find the transitive closure of the Relation R.
Equivalence Relation Examples

Let R be a relation on Z which is defined by x R y , iff


2x+3y , s divisible by 5 is an equivalence relation

Z = set of integers , Z = {-∞,…-2,-1,0,1,2,…∞}


Z * Z = {(x,y) | x,y belongs to Z}
R = { (x,y) belongs to Z*Z | 2x+3y is divisible
by 5 }
Equivalence Relation Examples
Equivalence Relation Examples
Your Task

Let R be a relation on Z which is defined by x R y , iff


3x+5y , is divisible by 8 is an equivalence relation

Your Task
Let R be a relation on Z which is defined by x R y , iff
3x+5y , is divisible by 8 is an equivalence relation

Your Task
Let R be a relation on Z which is defined by x R y , iff
3x+5y , is divisible by 8 is an equivalence relation

Let A = {a,b,c,d,e} and P= {{a,b}, {c,d} , {e}}
Is P a partition on A . Write the equivalence relation and
equivalence classes

You might also like