Discrete Class 23-24
Discrete Class 23-24
3. Relations
Class – 23-24
Relations Problem: Set Relations
Let A = {1, 2, 3}. Consider the following relations on the power set of A (the set of all subsets of A):
R1: {(X, Y) | X ⊆ Y} (X is a subset of Y)
R2: {(X, Y) | X ∩ Y ≠ ∅} (X and Y have a non-empty intersection)
R3: {(X, Y) | |X| = |Y|} (X and Y have the same cardinality/number of elements)
Determine which of these relations are reflexive, symmetric, antisymmetric, and transitive.
Sol:
Relation Reflexive Symmetric Antisymmetric Transitive
({1} ⊆ {1, 2}, but
(If X ⊆ Y and Y (If X ⊆ Y and Y
R1: X ⊆ Y (X ⊆ X) {1, 2} is not a subset
⊆ X, then X = Y) ⊆ Z, then X ⊆ Z)
of {1})
(X ∩ X = X,
({1} ∩ {2} = ∅,
which is non-empty ({1} ∩ {2} = ∅,
R2: X ∩ Y ≠ ∅ (X ∩ Y = Y ∩ X) {2} ∩ {3} = ∅, but
unless X is the empty {2} ∩ {1} = ∅, 1 != 2)
{1} ∩ {3} = ∅)
set)
Zero–one matrix:
A relation between finite sets can be represented using a zero–one matrix. Suppose that R is a relation
from A = {a1, a2,…, am} to B = {b1, b2,…, bn}. (Here the elements of the sets A and B have been listed in b1 b2 b3
a particular, but arbitrary, order. Furthermore, when A = B we use the same ordering for A and B.) The a1 1 0 0
relation R can be represented by the matrix a2 0 0 1
MR = [mij], where mij = 1 if (ai, bj) ∈ R,
0 if (ai, bj) ∉ R.
Representing Relations Using Matrices * indicates 0 or 1
Property Matrix Characteristic Explanation Example
Every element is related b1 b2 b3
Reflexive All diagonal entries are 1
to itself. a1 1 * *
a2 * 1 *
a3 * * 1
If (a, b) is in the relation,
Matrix is equal to its transpose b1 b2 b3
Symmetric then (b, a) is also in the
(M = Mᵀ) a1 * 0 0
relation.
a2 0 * 1
a3 0 1 *
MR₁ = 1 0 ; MR₂ = 0 1
MR₁∪R₂ = MR₁∨ MR₂ The resulting matrix has a 1
Union 0 1 1 1
(element-wise logical where either MR₁ or MR₂ (or
(R₁ ∪ R₂) MR₁∪R₂ = 1 1
OR) both) have a 1.
1 1
MR₁ = 1 0 ; MR₂ = 0 1
MR₁∩R₂ = MR₁ ∧ MR₂ The resulting matrix has a 1
Intersection 0 1 1 1
(element-wise logical only where both MR₁ and MR₂
(R₁ ∩ R₂) MR₁∩R₂ = 0 0
AND) have a 1.
0 1
Important note:
Representing Relations Using Digraphs: A Visual Journey
Relations, those intricate connections between elements of a set, can be brought to life in more ways than one. We’ve
already explored how to represent them as a list of ordered pairs or as a zero–one matrix. But now, let’s step into the
world of visual storytelling—where relations are transformed into directed graphs, or digraphs, a vivid and intuitive
way to depict connections.
The Art of Digraphs
Imagine a canvas where each element of a set is a point (or a vertex), and every ordered pair is an arc (or edge)—a
directed arrow flowing from one point to another. This is the essence of a digraph: a pictorial representation that
breathes life into abstract relations.
❖ Vertices (Nodes): Each element of the set is a vertex, a dot on the canvas.
❖ Edges (Arcs): Each ordered pair (a, b) is an edge, an arrow pointing from a to b.
❖ Loop: When a and b are the same, the edge becomes a loop—a circular arrow that
starts and ends at the same vertex, symbolizing a relation of an element to itself.
The Anatomy of Digraphs
Let’s break it down:
1.Vertices (V): The set of points representing the elements of the set.
2.Edges (E): The set of ordered pairs (a,b), where:
1. a is the initial vertex (the starting point of the arrow).
2. b is the terminal vertex (the endpoint of the arrow).
A loop, an edge of the form (a, a), is a self-referential arc that curls back to its origin, adding a touch of symmetry to the
graph.
Representing Relations Using Digraphs: A Visual Journey
EXAMPLE Draw the directed graph of the relation R1 = {(1, 1), (1, 3), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2), (4, 1)} on
the set {1, 2, 3, 4}.
EXAMPLE What are the ordered pairs in the relation R2 represented by the directed graph shown in Figure 5?
Solution: The ordered pairs (x, y) in the relation are
R2 = {(1, 3), (1, 4), (2, 1), (2, 2), (2, 3), (3, 1), (3, 3), (4, 1), (4, 3)}.
Each of these pairs corresponds to an edge of the directed graph, with (2, 2) and (3, 3) corresponding to loops.
EXAMPLE Determine whether the relations for the directed graphs shown in Figure 6 are reflexive, symmetric,
antisymmetric, and/or transitive.
Solution: S1: Reflexive (loops at all vertices), neither symmetric nor antisymmetric (edge a→b but not b→a, and
bidirectional edges between b and c), and not transitive (no edge a→c despite a→b and b→c).
S2: Not reflexive (missing loops), symmetric (edges between distinct vertices are bidirectional), not
antisymmetric, and not transitive ((c,a) and (a,b) exist, but (c,b) does not).
Def: If R is a relation on a set A, then the closure of R with respect to P, if it exists, is the relation S on A with
property P that contains R and is a subset of every subset of A × A containing R with property P.
Uniqueness of a closure: If a relation S with property P is a subset of every relation containing R with property P,
then S is unique. This means there's only one “smallest” relation that satisfies the criteria.
Thus, closure of a relation is always unique.
Reflexive Closure
❖ Consider the set A: {1, 2, 3} and
❖ Consider the relation R: {(1, 1), (1, 2), (2, 1), (3, 2)} (Not reflexive because 2 and 3 are not related to themselves)
❖ Reflexive Property: For every a in A, (a, a) must be in the relation.
❖ Reflexive Closure: Add (2, 2) and (3, 3).
❖ Resulting Relation (S): {(1, 1), (1, 2), (2, 1), (3, 2), (2, 2), (3, 3)}
❖ General Rule: The reflexive closure of R is R ∪ Δ, where Δ = {(a, a) | a ∈ A} (the diagonal relation).
EXAMPLE (reflexive closure) What is the reflexive closure of the relation R = {(a, b) ∣ a < b} on the set of integers?
Solution: The reflexive closure of R is
R∪Δ = {(a, b) ∣ a < b} ∪ {(a, a) ∣ a ∈ Z} = {(a, b) ∣ a ≤ b}.
Closure of a Relation:
Symmetric Closure
❖ Consider the set A: {1, 2, 3} and
❖ Consider the relation R: {(1, 1), (1, 2), (2, 3), (3, 1)} (Not symmetric because (1,2) exists but (2,1) doesn't exist,
similarly (2,3) exists but (3,2) doesn't exist)
❖ Symmetric Property: If (a,b) is in the relation then (b, a) must be in the relation.
❖ Symmetric Closure: Add (2, 1) and (3, 2).
❖ Resulting Relation (S): {(1, 1), (1, 2), (2, 1), (3, 2), (2, 3), (3, 1)}
❖ General Rule: The symmetric closure of R is R ∪ R⁻¹, where R⁻¹ = {(b, a) | (a, b) ∈ R} (the inverse relation).
EXAMPLE (symmetric closure) What is the symmetric closure of the relation R = {(a, b) ∣ a > b} on the set of
positive integers?