Relations - Slide - Discrete Math - DSU
Relations - Slide - Discrete Math - DSU
Discrete Mathematics
Example:
▶ What is the difference between a relation and a function from
A to B? A function defined on sets A, B A → B assigns to
each element in the domain set A exactly one element from
B. So it is a special relation.
Relation on the Set
Example:
▶ Let A = {1, 2, 3, 4}.
▶ Define a relation aR̸= b if and only if a ̸= b.
▶ 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)}
Table:
R̸= 1 2 3 4
1 × × ×
2 × × ×
3 × × ×
4 × × ×
Binary Relations
Reflexive Relation:
▶ Rdiv = {(a, b) if a|b} on A = {1, 2, 3, 4}.
▶ Rdiv = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)}
1 1 1 1
0 1 0 1
MRdiv =
0
0 1 0
0 0 0 1
A relation R is reflexive if and only if MR has 1 in every position
on its main diagonal.
Reflexive Relation
Irreflexive Relation
▶ R̸= on A = {1, 2, 3, 4}, such that aR̸= b if and only if a ̸= b.
▶ 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)}
0 1 1 1
1 0 1 1
MR = 1 1 0 1
1 1 1 0
A relation R is irreflexive if and only if MR has 0 in every position
on its main diagonal.
Properties of Relations
Symmetric Relation:
▶ R̸= on A = {1, 2, 3, 4}, such that aR̸= b if and only if a ̸= b.
▶ 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)}
0 1 1 1
1 0 1 1
MR = 1 1 0 1
1 1 1 0
A relation R is symmetric if and only if mij = mji for all i, j.
Properties of Relations
Anti-symmetric Relation
▶ Relation Rfun = {(1, 2), (2, 2), (3, 3)}
0 1 0 0
0 1 0 0
MRfun =
0
0 1 0
0 0 0 0
A relation is anti-symmetric if and only if mij = 1 → mji = 0 for
i ̸= j.
Properties of Relations
We can compute MR 2
J
as MR · MR :
K 1 1 1 1 1 1 1 1 1
MR 2 = 0 0 1 · 0 0 1 = 0 0 1
0 0 1 0 0 1 0 0 1
Since, MR 2
J
=M JR , the relation R is transitive.
Formula: if MR 2 = MR then the relation is transitive
Equivalence Relations