0% found this document useful (0 votes)
8 views

Module 3 Relations (1)

Uploaded by

shwetak1275
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Module 3 Relations (1)

Uploaded by

shwetak1275
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 71

RELATIONS, DIGRAPHS

Prof. Bhakti Palkar


RELATIONS, DIGRAPHS (07)
 3.1 Relations, Paths and Digraphs
 3.2 Properties and types of binary relations
 3.3 Manipulation of relations, Closures,
Warshall‟s algorithm
 3.4 Equivalence relations
INTRODUCTION
Definition: A binary relation from a set A to a set B is a
subset R  AB ={ (a,b) | aA, bB}
Let A and B be nonempty sets. A relation R from A 'to'
B is a subset of A  B.
IfR  A  B and (a, b)  R, we say that a 'is related to'
b by R, and we also write a R b.
If a is not related to b by R, we write a R b.
Frequently, A and B are equal. In this case, we often
say that R  A  A 'is a relation on' A, instead of a
relation from A to A.
EXAMPLES
Ex. 1 :
Let A={ 1, 2, 3 } and B = { r, s }
Then R={(1, r), (2, s), (3, r)} is a relation from A
to B.

Ex. 2 :
Let A={ 1, 2, 3 , 4, 5 }.
Define the following relation R (less than) on A :
a R b if and only if a < b.
Then R={(1, 2), (1, 3), (1, 4), (1, 5), (2, 3), (2,
4), (2, 5), (3, 4), (3, 5), (4, 5)}
DEFINITIONS
 Let { A1, A2, … , An } be a finite collection of sets. A
subset R of A1  A2  …  An is called an n-ary
relation on A1, A2, …, An.
 If R=, then R is called void or empty relation.
 If R=A1  A2  …  An, then R is called the universal
relation.
 If Ai =A for all i, then R is called an 'n - ary relation on
A'.
 If n=1, 2 or 3, then R is called a unary, binary or
ternary relation respectively.
 Among the relations, binary relations are the most
important being widely used in various applications.
SET ARISING FROM RELATIONS
Domain of Relation R :

Let R  A  B be a relation from A to B. The domain of R,


denoted by Dom (R), is the set of elements in A that are
related to some element in B. In other words, Dom (R), a
subset of A, is the set of all first elements in the pairs that
make up R.

Range of relation R :

Similarly, we define the range of R, denoted by Ran (R), to


be the set of elements in B that are second elements of pairs
in R, that is, all elements in B that are related to some
element in A.
EXAMPLES
Ex. 1 :
Let A= { 1, 2, 3 } , B= { r, s }
and R={(1, r), (2, s), (3, r)}
Dom (R)={ 1, 2, 3 } = A
Ran (R)={ r, s } = B
Ex. 2 :
Let A={ 1, 2, 3, 4, 5 } ,B={ 1, 2, 3, 4 , 5 }
a R b, if and only if a < b
R={(1, 2), (1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5),
(3, 4), (3, 5), (4, 5)}
Dom (R)={1, 2, 3, 4 }
Ran (R)={2, 3, 4, 5}
REPRESENTATION OF RELATION
Graphical and tabular form :
For Example :
Let A={a, b, c, d} , B={, , }
and R is a relation from A to B.
R={(a, ), (b, ), (c, ), (c, ), (d, )}
  
a 
b 
c  
d 
DIAGRAPH
If A is a finite set and R is a relation on A, we can also represent R
pictorially as follows :

(i)Draw a small circle for each element of A and label the circle
with the corresponding element of A. These circles are called
vertices.

(ii)Draw an arrow, called an edge, from vertex ai to vertex aj if


and only if ai R aj.

The resulting pictorial representation of R is called a directed


graph or digraph of R.
DIAGRAPH
Ex. 1 :Let A = {1, 2, 3, 4}, Let R is a relation from A
to A.
R = {(1, 1), (1, 2), (2, 1), (2, 2), (2, 3), (2, 4), (3, 4), (4,
1)}
DEGREE OF VERTEX IN A
DIRECTED GRAPH
 A directed graph, each vertex has an in-
egree and an out-degree.
 In-degree of a Graph-Number of edges which

are coming into the vertex V.


 Out-degree of a Graph-Number of edges

which are going out from the vertex V

VERTEX 1 2 3 4

In Degree 0 2 2 1

Out- 2 0 2 1
degree
FIND OUT IN DEGREE AND OUT
DEGREE

VERTEX 1 2 3 4

In
2 2 1 2
Degree

Out-
1 4 1 1
degree
EXAMPLE
Let A = {1, 2, 3, 4, 6} and let R be the relation on A defined by 'x
divides y'. Find R and draw the digraph of R. Find Matrix of R. Find
inverse relation of R.
(4,4)

R-1={(1,1),(2,1),(3,1),(4,1),(6,1),(2,2),(3,3),(4,4),(6,6),(4,2),(6,2),(6,3)
EXAMPLE
Let A = {1, 2, 3, 4, 6} = B, a R b if and only if a is a multiple of b.
Find R and draw the digraph of R. Find Matrix of R. Find each of the
following :
Solution: (i) R(3) (ii) R(6) (iii) R({2, 4, 6})
R={(1, 1), (2, 1), (2, 2), (3, 1), (3, 3), (4,1), (4, 2), (4, 4), (6, 1), (6, 2),
(6, 3), (6, 6)}
Dom (R) ={1, 2, 3, 4, 6}
Ran (R) ={1, 2, 3, 4, 6}
(i) R (3) ={1, 3},
Since (3, 1)  R and (3, 3)  R
(ii) R (6) ={1, 2, 3, 6},
Since (6, 1)  R, (6, 2)  R, (6, 3)  R and
(6,6)  R.
(iii) R ({2, 4, 6}) = {1, 2, 4, 3, 6}
Since (2, 1)  R, (4, 2)  R, (6,1)  R, (6,2) 
R,
(6, 3)  R, (6, 6)  R, (4,4)  R
PATHS IN RELATIONS AND
DIGRAPHS
Suppose that R is a relation on a set A. A path of length
n in R from a to b is a finite sequence π : a, x1, x2, … , xn
– 1 , b, beginning with a and ending with b, such that

a R x1, x1 R x2, ………………, xn – 1 R b

Note that a path of length n involves n + 1


elements of A, although they are not necessarily distinct.

The length of a path is the number of edges in the


path, where the vertices need not all be distinct.

A path that begins and ends at the same vertex is


called a cycle.
PATHS IN RELATIONS AND
DIGRAPHS
R = { ( 1 , 2 ) ,( 2 , 3 ) , ( 2 , 4 ), ( 3 , 3 ) } is a
relation on A = {1,2,3,4}

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

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


1 R2 3 Since 1 R 2 and 2 R 3
1 R2 4 Since 1 R 2 and 2 R 4 ...
R 3 = { ( 1 , 3 ) , ( 2 , 3 ), ( 3 , 3 ) }
R 4 = { ( 1 , 3 ) , (2 , 3 ), ( 3 , 3 )}
PATHS IN RELATIONS AND
DIGRAPHS
Let A = {1, 2, 3, 4, 5, 6}.
Let R be the relation
whose digraph is shown
in Fig. Find R2 and draw
digraph of the relation R2.
PATHS IN RELATIONS AND
DIGRAPHS
BOOLEAN PRODUCT
The 'Boolean product' of A and B, denoted A ⊙
B is the m  n Boolean matrix.

MR 2 = MR ⊙ M R

MRn= MR⊙MR ⊙ ………… ⊙ MR (n factors)


PATHS IN RELATIONS AND
DIGRAPHS
Let A = {a, b, c, d, e} and
R = {(a, a), (a, b), (b, c), (c,e), (c, d), (d, e)}
M R2 = M R ⊙ M R
MR MR MR 2 = MR
(i,k) (k,j) ⊙ MR
(a,a) (a,a) (a,a)
(a,b) (b,c) (a,c)
(b,c) (c,d)(c,e) (b,d)(b,e)
(c,d) (d,e) (c,e)
(c,e) -
(d,e) -
(a,a) (a,b) (a,b)
PROPERTIES/TYPES OF
RELATIONS
 Reflexive

 Symmetric

 Transitive

 Antisymmetric

 Asymmetric
PROPERTIES: REFLEXIVITY
A relation R on a set A is reflexive if for 'every' element
a  A, a R a, i.e. (a, a)  R.
R is not a reflexive relation if for 'some' element aA,
(a, a) ∉ R
Ex. 1 : Let A = {a, b} and let R = {(a, a), (a, b), (b, b)}.
Then R is reflexive.

Ex. 2 : Let A = {1,2} and let R = {(1,1), (1, 2)}.


R is not reflexive since (2,2) ∉ R.
PROPERTIES: SYMMETRY
A relation R on a set A is symmetric if whenever a R b,
then b R a. It then follows that R is not symmetric if we
have some a and b  A with a R b, but b R a.
Ex. 1 : A = { 1 , 2, 3} , Is R symmetric ?
R = { ( 1,2 ) , ( 2,1 ) , ( 2,3 ), (3,2) , (1,1) ) }
Ex. 2 : A = { 1 , 2 , 3 , 4 } , Is R symmetric ?
R= { (1,2), (1,3 ), (1,4), (2,1), (2,3), (2,4), (3,1), (3,2),
(3,4), (4,1) , (4,2), (4,3) }
Ex. 3 : A ={a, b, c, d, e}
R={(a, b), (b, a), (a, c), (c, a), (b, c),
(c, b), (b, e), (e, b), (e, d), (d, e),
(c, d), (d, c)}
PROPERTIES: ASYMMETRIC
RELATION
ANTISYMMETRIC RELATIONS
A relation R on a set A is antisymmetric if whenever a
R b and b R a, then a = b.

The contrapositive of this definition is that R is


antisymmetric if whenever a ≠ b, then (a,b) ϵ R or (b,a)
∉R.

It follows that R is not antisymmetric if we have a and b


in A, a ≠ b, and both a R b and b R a.
SYMMETRY VERSUS ANTISYMMETRY
 In a symmetric relation aRb  bRa
 In an antisymmetric relation, if we have aRb

and bRa hold only when a=b


 An antisymmetric relation is not necessarily a

reflexive relation
A={1,2,3}
R={(1,1),(2,2)}
 A relation that is not symmetric is not
necessarily asymmetric
A={1,2,3}
R={(1,2),(2,2)}
EXAMPLES
Ex. : Let A = Z, the set of integers, and let R = {(a, b) 
A  A | a < b} Is R symmetric, asymmetric, or
antisymmetric ?

Soln.:

Symmetry : If a < b,then it is not true that b < a, so R is


not symmetric.

Asymmetry : If a < b, then b a (b is not less than a), so R is


asymmetric.

Antisymmetry : If a ≠ b, then either a< b or b < a, so that R


is antisymmetric.
EXAMPLES
Ex. : Let A = {1, 2, 3} and let R = {(1, 2), (2, 1), (2,
3)}. Is R symmetric, asymmetric, or antisymmetric?

Soln.:

Symmetry : R is not symmetric either since (2, 3)  R

but (3, 2) ∉ R

Asymmetry : R is also not asymmetric since both (1, 2)


and (2, 1)  R.

Antisymmetry : R is not antisymmetric since (1, 2) and


(2, 1)  R.
EXAMPLES
Ex. : Let A = {1, 2, 3, 4} and let R = {(1, 2), (2, 2), (3,
4), (4,1)}. Is R symmetric, asymmetric, or
antisymmetric?

Soln.:

Symmetry : R is not symmetric, since (1, 2)  R,


but (2, 1) ∉ R.

Asymmetry : R is not asymmetric, since (2, 2)  R.

Antisymmetry : R is antisymmetric, since if a ≠ b, either

(a, b) ∉ R or (b, a) ∉ R.
PROPERTIES: TRANSITIVITY
Definition: A relation R on a set A is called
transitive if whenever (a,b)R and (b,c)R then
(a,c)R for all a,b,c  A.
a,b,cA ((aRb)(bRc))  aRc
Example
Let A = Z+, the set of positive integers, and let
R = {(a, b)  A  A | a divides b} Is R
transitive?
Soln.: a divides b , aR b and b divides c, bRc
a divides c, aRc . Thus R is transitive.
SPECIAL CASES
1) Let A = { 1 , 2 , 3 , 4 }
R= { ( 1 , 2 ) , ( 1 , 3 ) , ( 4 , 2 ) }
Is R transitive?
YES
2) R = { }
3)A relation that is symmetric and anti-
symmetric
R = {(1,1),(2,2)} on the set A = {1,2,3}
EXAMPLE
Give examples of relations R on A = {1, 2, 3}
having the stated property.
(i)R is transitive but not symmetric.

(ii)R is symmetric but not transitive.

(iii)R is both symmetric and anti-symmetric.

(iv)R is neither symmetric nor anti–symmetric.

Solution:
(i)R={(1, 2), (2, 3), (1, 3)}

(ii)R={(1, 2), (2, 1)}

(iii)R={(1,1), (2,2)}

(iv)R={(1,2), (2,3),(3,2)}
EXAMPLE
Define a relation on the set {a, b, c, d} that is
(i) transitive, reflexive and symmetric,
(ii) symmetric and transitive.
Solution:
(i) Transitive, reflexive and symmetric,
A={ a, b, c, d }
R={(a, a), (b, b), (c, c), (d, d), (a, b), (b, a), (a, c),
(c, a), (a, d), (d, a), (b, c), (c, b), (b, d), (d, b), (c,
d), (d, c)}
(ii) Symmetric and transitive.
A={ a, b, c, d }
R={(a, b), (b, a), (c, d), (d, c), (a, a), (c, c)}
IRREFLEXIVE RELATIONS
A relation R on a set A is irreflexive if a not
related to a, i.e. (a,a) ∉ R for every a  A.
Thus R is irreflexive if no element is related to
itself.
Examples
1.Let A = {1, 2} and let R = {(1, 2), (2, 1)}.

2.R is not reflexive (1,1) (2,2) ∉ R

Then R is irreflexive since (1, 1) (2, 2) ∉ R.


2. Let A = {1, 2} and let R = {(1, 2), (2, 2)}.
Then R is not irreflexive since (2, 2)  R.
Note that R is not reflexive either; since (1,
1) ∉ R.
IDENTITY RELATION
Identity relation I on set A is reflexive,
transitive and symmetric.
Example:
A= {1, 2, 3}
R= {(1, 1), (2, 2), (3, 3)}
VOID RELATION
It is given by R: A →B such that R = ∅ (⊆ A x B)
is a null relation.
Void Relation R = ∅ is symmetric and transitive
but not reflexive.
UNIVERSAL RELATION
A relation R: A →B such that R = A x B (⊆ A x
B) is a universal relation.
Universal Relation from A →B is reflexive,
symmetric and transitive.
EXAMPLE
Let A = {1, 2, 3, 4, 5}
Determine whether the
relation R whose digraph is
given is reflexive, irreflexive,
symmetric, asymmetric,
antisymmetric or transitive.
R is not reflexive
R is not irreflexive
R is not symmetric
R is not asymmetric
R is antisymmetric
R is transitive
EXERCISE : PROPERTIES OF
RELATIONS
State whether R satisfies property of reflexive ,
irreflexive , symmetry, asymmetry ,
antisymmetry , transitivity for A={1,2,3,4}
R={(1,1),(1,2),(2,1),(2,2),(3,3),(4,3),(3,4),
(4,4)}
R= {(1,3),(1,1),(3,1),(1,2),(3,3),(4,4)}
R={(1,1),(1,2),(2,1),(2,2),(3,3),(3,4)}
R={(1,3),(1,4),(2,3),(2,4),(3,1),(3,4)}
R={(1,1),(2,2),(3,3),(4,4)}
EQUIVALENCE RELATION
A relation is an Equivalence Relation if it
is reflexive, symmetric, and transitive.
Let A = { a , b , c } and
R= { (a,a),(b,b),(b,c),(c,b),(c,c)}
is an equivalence relation since it is reflexive,
symmetric, and transitive.
DETERMINE WHETHER R IS AN
EQUIVALENCE RELATION
DETERMINE WHETHER R IS AN
EQUIVALENCE RELATION
Let A = Z, the set of integers, and let R be
defined by a R b if and only if a  b. Is R an
equivalence relation?
Since a  a, R is reflexive.

If a  b, it need not follow that b  a, so R is

not symmetric.
Incidentally, R is transitive, since a  b and b

 c imply that a  c.
We see that R is not an equivalence relation.
DETERMINE WHETHER R IS AN
EQUIVALENCE RELATION
Let A = {1, 2, 3, 4} and
Let R = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 1),
(3, 3), (1, 3), (4, 1), (4, 4)}
Determine whether the relation R on the set
A is an equivalence relation.
Soln.:
R is reflexive since (1, 1), (2, 2), (3, 3), (4, 4) ϵ R. R
is not symmetric since, (4, 1) ϵ R but (1, 4) ∉ R.
R is not transitive since,
(2, 1), (1, 3) ϵ R but (2, 3) ∉ R
Hence given relation R is not an equivalence
relation.
Let R be a binary relation on the set of all positive integers such that,
R= {(a, b) | a – b is an odd positive integer}
Is R reflexive ? Symmetric ? Transitive ? An equivalence relation ?
EQUIVALENCE CLASS AND
PARTITIONS
Let A = { 1 , 2 , 3 , 4 } and consider the partition
P={{1,2,3},
{ 4} } of A.
Find the equivalence relation R on A determined by
P
“ Each element in a block is related to every other
element in the same block and only to those
elements”
R= {(1,1),(1,2),(1,3),(2,1),(2,2),(2,3),(3,1),(3,2),
(3,3),(4,4)}
PROBLEMS
Find the equivalence relation on A by P
1)Let A ={ a , b , c , d } and P = {{a , b } , { c }, {
d}}
R={(a,a),(a,b),(b,b),(b,a),(c,c),(d,d)}
2) Let A={1,2,3,4,5} and P={{ 1 ,2 },{ 3 },{ 4,
5}}
R={(1,1),(1,2),(2,1),(2,2),(3,3),(4,4),(4,5),(5,5),
(5,4)}
3) If {{1,3,5},{2,4}} is a partition on the set
A={1,2,3,4,5},determine the corresponding
equivalence relation
R={(1,1),(1,3),(1,5),(3,1),(3,3),(3,5),(5,1),(5,3),
(5,5),(2,2),(2,4),(4,2),(4,4)}
EQUIVALENCE CLASS
Let A ={1,2,3,4,5,6} and let R be the
equivalence relation on A defined by R={(1,1),
(1,5),(2,2),(2,3),(2,6),(3,2),(3,3),(3,6),(4,4),
(5,1),(5,5),(6,2),(6,3),(6,6)}
Find the equivalence classes of R and find the
partition of A induced by R
R={(1,1),(1,5),(2,2),(2,3),(2,6),(3,2),
(3,3) ,(3,6),(4,4),(5,1),(5,5),(6,2),
(6,3),(6,6)}
Equivalence Classes:
R(1)={1,5} R(2)={2,3,6}

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

R(5)={1,5} R(6)={2,3,6}
Therefore, the partition of A induced by R i.e
A|R={{1,5},{2,3,6},{4}}
Rank R (Number of distinct equivalence classes)
=3
PROBLEMS: FIND ECLASSES, PARTITION AND
RANK
1. Let A={1,2,3} and let R={(1,1),(2,2),(1,3),(3,1),(3,3)}.
Find A|R.
Ans: R(1)={1,3}, R(2)={2}, R(3)={1,3}
A|R={{1,3},{2}}, rank=2

2. Let A ={1,2,3,4},and let R={(1,1),(1,2),(2,1),(2,2),(3,4),(4,3),(3,3),


(4,4)}
Determine A|R.
Ans:R(1)={1,2}, R(2)={1,2},R(3)={3,4},R(4)={3,4}
A|R={{1,2},{3,4}}, rank=2

3. Let A ={1,2,3,4},and let R={(1,1),(1,2),(1,3),(2,1),(2,2),(3,1),(2,3),


(3,2),(3,3),(4,4)} Show that R is an equivalence relation and
determine the equivalence classes and hence find the rank of R
Ans:R(1)={1,2,3},R(2)={1,2,3}, R(3)={1,2,3}, R(4)={4}
A|R={{1,2,3},{4}}, rank=2
COMBINING RELATIONS
EXAMPLES
Let A ={1,2,3} and B={u,v} and
R1={(1,u),(2,u),(2,v),(3,u)} and
R2={(1,v),(3,u),(3,v)}
R1 U R2 = {(1,u),(1,v),(2,u),(2,v),(3,u),(3,v)}
R 1 ∩ R2 ={(3,u)}
R 1 – R 2 = {(1,u),(2,u),(2,v)}
R 2 – R 1 ={(1,v),(3,v)}
EXAPLES

Let A={ 1 , 2 , 3 , 4 } and B={ a , b , c } and


let R ={(1,a),(1,b),(2,b),(2,c),(3,b),
(4,a)} and

S={(1,b),(2,c),(3,b),(4,b)}

Compute R ∩ S , R U S , R -1

R ∩ S={(1,b),(2,c),(3,b)}

R U S={(1,a),(1,b),(2,b),(2,c),(3,b),(4,a),(4,b)}

R -1
={(a,1),(b,1),(b,2),(c,2),(b,3),(a,4)}
COMBINING RELATIONS: EXAMPLE
Let
A={1,2,3,4}
B={1,2,3,4}
R1={(1,2),(1,3),(1,4),(2,2),(3,4),(4,1),(4,2)}
R2={(1,1),(1,2),(1,3),(2,3)}

R1  R 2 =
R1  R2 ={(1,2),(1,3)}
R1 − R2 ={(1,4),(2,2),(3,4),(4,1),(4,2)}
R2 − R1 ={(1,1),(2,3)}
COMPOSITE OF RELATIONS
 Definition: Let R1 be a relation from the set
A to B and R2 be a relation from B to C, i.e.
R1  AB and R2BC
the composite of R1 and R2 is the relation
consisting of ordered pairs (a,c) where aA,
cC and for which there exists an element
bB such that (a,b)R1 and (b,c)R2. We
denote the composite of R1 and R2 by
R2  R1
COMPOSITE OF RELATIONS
Ex: Let A = {1,2,3} , B ={0,1,2} and C =
{a,b}
R = {(1,0),(1,2),(3,1),(3,2)}
S = {(0,b),(1,a),(2,b)}
SoR=?
{(1,b),(3,a),(3,b)}
Since (1,0) ∈ R and (0,b) ∈ S, ∴ (1,b) ∈ S o R
Since (1,2) ∈ R and (2,b) ∈ S, ∴ (1,b) ∈ S o R
Since (3,1) ∈ R and (1,a) ∈ S, ∴ (3,a) ∈ S o R
Since (3,2) ∈ R and (2,b) ∈ S, ∴ (3,b) ∈ S o R
PROBLEMS
Let A={1,2,3} and let
R={(1,1),(1,3),(2,1),(2,2),(2,3),(3,2)} and
S={(1,1),(2,2),(2,3),(3,2),(3,3)}.
Find M SoR
SoR={(1,1),(1,3),(1,2),(2,1),(2,2),(2,3),(3,2),(3,3)}
2. Let A={1,2,3,4}
R={(1,1),(1,2),(2,3),(2,4),(3,4),(4,1),(4,2)}
S={(3,1),(4,4),(2,3),(2,4),(1,1),(1,4)}
Compute SoR,RoS,RoR,SoS
SoR={(1,1),(1,3),(2,1),(2,4),(3,4),(4,1),(4,4),(1,4)}
RoS={(3,1),(3,2),(4,1),(4,2),(2,4),(2,1),(2,2),(1,1),(1,2)}
RoR
SoS
Let A={1,2,3,4}
R={(1,1),(1,2),(2,3),(2,4),(3,4),(4,1),(4,2)}
S={(3,1),(4,4),(2,3),(2,4),(1,1),(1,4)}
Compute SoR,RoS,RoR,SoS
SoR={(1,1),(1,3),(1,4),(2,1),(2,4),(3,4),(4,1),(4,4),(4,3),(4,4)}
RoS={(3,1),(3,2),(4,1),(4,2),(2,4),(2,1),(2,2),(1,1),(1,2)}
RoR={
CLOSURES
The 'smallest' relation R1 on A that
contains R and possesses the property we
desire. Sometimes R1 does not exist. If a
relation such as R1 does exist, we call it the
'closure' of R with respect to the property in
question.
REFLEXIVE CLOSURE
Let R be a relation on a set A, and R is
not reflexive (i.e. some pairs of the diagonal
relation  are not in R).
A relation R1 = R   is the reflexive closure of
the relation R if R   is the smallest relation
containing R which is reflexive.
R1=R  
where  is the set of elements of the type (a,
a) where a  A.
EXAMPLE
A ={1, 2, 3} and the relation R is given by
R ={(1, 1), (1, 2), (2, 3)} then
R1 = R   where
 ={(1, 1), (2, 2), (3, 3)}
R   ={(1, 1), (1, 2), (2, 2), (2, 3), (3, 3)}
Reflexive closure is,
R1 ={(1, 1), (1, 2), (2, 2), (2, 3), (3, 3)}
SYMMETRIC CLOSURE
Suppose that R is a relation on A that is
not symmetric. Then there must exist pairs (x,
y) in R such that (y, x) is not in R. Of course, (y,
x)  R–1, so if R is to be symmetric we must add
all pairs from R–1; that is we must enlarge R to
R  R–1. Clearly (R  R–1)–1 = R  R–1, So R  R–1
is the smallest symmetric relation containing
R; that is
R  R–1 is the 'symmetric closure' of R.
EXAMPLE
A = {a, b, c, d} and
R={(a, b), (b, c), (a, c), (c, d)} then
R–1={(b, a), (c, b), (c, a), (d, c)}
so the symmetric closure of R is

R  R–1={(a, b), (b, a), (b, c), (c, b), (a, c), (c,
a), (c, d), (d, c)}
TRANSITIVE CLOSURE
EXAMPLE
Find the transitive closure R* of the relation R on A = {1,
2, 3, 4} defined by the directed graph shown
Soln.:
R= {(1, 3), (1, 4), (3, 2), (3, 3), (3, 4)}
Here transitive closure of R is
=R  {(a, c) | if (a, b), (b, c)  R}
To find transitive closure
(1, 3)  R and (3, 2)  R, hence add (1, 2) in R
Transitive closure of R = {(1, 2), (1, 3), (1, 4),(3, 2), (3, 3),
(3, 4)}
MATRIX METHOD
Let A = {1, 2, 3, 4} and let R = {(1, 2), (2, 3), (3, 4), (2, 1)}.
Find the transitive closure of R. The matrix of R is

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


R3 ={(1, 2), (1, 4), (2, 1), (2, 3)}
R4 ={(1, 1), (1, 3), (2, 2), (2, 4)}
R = R U R 2 U R 3 U R 4
R ={(1, 1), (1, 2), (1, 3), (1, 4),
(2, 1), (2, 2), (2, 3),
(2, 4), (3, 4)}
WARSHALL’S ALGORITHM
Ex. 1 : Let A = {1, 2, 3, 4} i j
and let R = {(1, 2), (2, 3), (3, 4), p1:(2, 1)
(2, 1)}. i j
Find transitive closure of R using q1:(1, 2)
Warshall's algorithm. add (pi, qj) i.e. (2, 2) in Wk
Solution:
Thus W1 is just W0 with a new 1
in
position (2, 2)

and n = 4

First we find W1, so that k = 1. W0


has 1's in location 2 of column 1
i.e. (2, 1) and location 2 of row 1
i.e. (1, 2)
Matrix W1 has 1's at row 1 and
2 of column 2 and columns 1,
2, and 3 of row 2. i.e.
(1, 4) and (2, 4)

We must put 1’s in positions


(pi, qj) i.e. (1, 1), (1, 2), (1, 3), Finally, W3 has 1's in locations
(2, 1), (2,2) and (2, 3) of 1, 2, 3 of column 4 and no
matrix W1 (if 1's are not 1's in row 4, so no new 1's
are added and MR = W4 =
already there).
W3.
EXAMPLE:
Let A = {1,2,3,4,5} R = {(1,1), (1,2), (2,1),
(2,2) (3,3), (3,4), (4,3),(4,4), (5,5)} and S =
{(1,1), (2,2), (3,3), (4,4), (4,5), (5,4), (5,5)} The
reader may verify that both R and S are
equivalence relations. The partition A | R of A
corresponding to R is {{1,2}, {3,4}, {5}}, and
the partition A | S of A corresponding to S is
{{1}, {2}, {3}, {4,5}}. Find the smallest
equivalence relation containing R and S, and
compute the partition of A that it produces.
K=1

To obtain W1, we must put is in


positions (1, 1), (1, 2), (2, 1)
and (2, 2). We see that
We now compute M(R  S) by
Warshall’s algorithm. First, Wo = MR 
S . We next compute W1 so k = 1.
Since Wo has 1's in locations 1 and 2
of column 1 and in locations 1 and 2
of row 1, we find that no new 1's
must be adjoined to W1 . Thus
Thus W1 =W0 Thus W2=W1
We now compute W2, so k = 2. We next compute W3, so k = 3. Since W2
Since W1 has 1's in locations 1 and has 1's in locations 3 and 4 of column 3
2 : of column 2 and in locations 1 and in locations 3 and 4 of row 3, we find
and 2 of row 2, we find that no new that no new 1's must be added to W2. That
1's must be added to W1. That is, is

To obtain W3, we must put 1's in position


(3, 3), (3, 4), (4, 3), (4, 4). We see that
To obtain W2, we must put is in positions
(1, 1), (1, 2), (2, 1), (2, 2). We see that
Thus W3=W2
Things change when we now compute W4.
Since W3 has I's in locations 3, 4, and 5 of
column 4 and in locations 3, 4 and 5 of You may verify that W5 = W4
column 4, and in locations 3, 4 and 5 of and thus
row 4 we must add new 1's to W3 in (R  S) ={(1, 1), (1, 2), (2,
positions 3, 5, and 5, 3, i.e. 1), (2, 2), (3, 3), (3, 4), (3, 5),
(4, 3), (4, 4), (4, 5), (5, 3),
(5, 4), (5, 5)}

To obtain W4, we must put 1's in positions


(3, 3), (3, 4), (3, 5), (4, 3), (4, 4), (4, 5), (5,
3), (5, 4), (5, 5). We see that,

You might also like