Module 3 Relations (1)
Module 3 Relations (1)
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 :
Range of relation R :
(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.
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
R 1 = R = {(1,2),(2,3),(2,4), (3,3)}
MR 2 = MR ⊙ M R
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 aA,
(a, a) ∉ R
Ex. 1 : Let A = {a, b} and let R = {(a, a), (a, b), (b, b)}.
Then R is reflexive.
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.:
Soln.:
but (3, 2) ∉ R
Soln.:
(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,cA ((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.
Solution:
(i)R={(1, 2), (2, 3), (1, 3)}
(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)}.
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
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 AB and R2BC
the composite of R1 and R2 is the relation
consisting of ordered pairs (a,c) where aA,
cC and for which there exists an element
bB 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
and n = 4