MT131 Tutorial - 5 Relations 2023-2024
MT131 Tutorial - 5 Relations 2023-2024
Example:
– Suppose that A = {a, b, c}. Then R = {(a, a),(a, b), (a,
c)} is a relation on A.
– Let A = {1, 2, 3, 4}. The ordered pairs in the relation
R = {(a, b) | a divides b} are (1, 1), (1, 2), (1, 3), (1, 4),
(2, 2), (2, 4), (3, 3), and (4, 4).
D- Table (Matrix):
R = {(1, 1), (2, 2), (3, 3), (4, 4), (1, 2), (1, 3), (1, 4), (2, 4)}
R 1 2 3 4
1 × × × × 1 1 1 1
2 × ×
0 1 0 1
3 × 0 0 1 0
4 ×
0 0 0 1
R1 = {(-1, 0), (-1, 1), (-1, 2), (0, 1), (0, 2), (1, 2)}
R2 = {(-1, -1), (0, 0), (1, 1), (2, 2), (-1, 1), (1, -1)}
R3 = {(-1, 1), (1, -1), (-1, 2), (2, -1), (0, 0), (0, 1), (1, 0)}
Answer:
1. A relation on set A is a subset from A × A.
2. A has n elements so A × A has n2 elements.
3. Number of subsets for n2 elements is 2^(n2), thus there
n2
are 2 relations on a set with n elements.
32
e.g. If S = {a, b, c}, there are 2 2 9 512 relations.
Empty set { }
Irreflexive, transitive, symmetric, antisymmetric.
Universal set U
Reflexive, transitive, symmetric.
e.g. Let R = {(1, 1), (2, 1), (3, 2), (4, 3)}. Find
R2 = R◦R = {(1, 1), (2, 1), (3, 1), (4, 2)}
R3 = R2◦R = {(1, 1), (2, 1), (3, 1), (4, 1)}
R = {(2, 1), (3, 1), (3, 2)} then the matrix for R is:
1 2
1 0 0 0 0
2 1 0
MR 1 0
3 1 1 1 1
1 any- 0 any- 1 0
1 thing 0 thing 1 0 1 0 1
1 0 1
any- thing
any-
thing 1 0 0 0
Reflexive: Irreflexive: Symmetric: Antisymmetric:
all 1’s on diagonal all 0’s on diagonal all identical all 1’s are across
across diagonal from 0’s
1 1 0
M R 1 1 1
0 1 1
Reflexive, symmetric, not antisymmetric
2- Composite
Suppose that R : A → B, S : B → C (Boolean Product)
MS○R = MR ⊙ MS
Let
1 0 1 0 1 0
M R 1 1 0 and M S 0 0 1
0 0 0 1 0 1
Find the matrix of S◦R?
1 1 1
M S R M R M S 0 1 1
0 0 0
3- Power
M Rn M [n ]
R
R 2 R R,
MR M 2
[ 2]
R .
R R R,
3 2
M R M R[ 3] .
3
0 1 0 0 1 1
If M R 0 1 1 then MR M R[ 2 ] 1 1 1.
2
1 0 0 0 1 0
MR Edge set EG
(blue arrows)
Susan Mary Sally GR
Joe 1 1 0 Joe Susan
Fred 0 1 0 Fred Mary
Mark 0 0 1 Mark Sally
Reflexive: Irreflexive: Symmetric: Antisymmetric:
Every node No node Every link is No link is
has a self-loop links to itself bidirectional bidirectional
Not symmetric, non-antisymmetric Non-reflexive, non-irreflexive
The relation R = {(1, 1), (1, 2), (2, 1), (3, 2)} on the set A =
{1, 2, 3} is not reflexive. How can you produce a reflexive
relation containing R that is as small as possible?
Answer:
By adding (2, 2) and (3, 3) so the reflexive closure of R
is:
{(1, 1), (1, 2), (2, 1), (3, 2), (2, 2), (3, 3)}.
i.e. It is R R −1 .
The relation {(1, 1), (2, 2), (1, 2), (3, 1), (2, 3), (3,2)} on
the set {1, 2, 3} is not symmetric. How can we produce a
symmetric relation that is as small as possible and
contains R ?
Answer:
By adding (2, 1) and (1, 3) so the symmetric closure of
R is:
{(1, 1), (2, 2), (1, 2), (3, 1), (2, 3), (3, 2), (2, 1), (1, 3)}.
Answer:
The Symmetric Closure of R is:
M R* M R M R[ 2] M R[ n] .
A = {1, 2, 3}
• R* = R R2 R3
Example 2:
Show that the divisibility relation “|“ is a partial ordering
on the set of positive integers Z+.
Solution:
• a | a for every positive integer a, | is reflexive.
• If a | b and b | a, then a = b, | is antisymmetric.
• Finally, | is transitive because a | b and b | c imply that a
| c.
We see that (Z+ , |) is a poset.
Example 3:
Show that the inclusion relation (⊆) is a partial ordering on
the power set of a set S.
Solution:
• Reflexivity: A ⊆ A whenever A is a subset of S.
• Antisymmetry: If A and B are subsets of S with A ⊆ B
and B ⊆ A, then A = B.
• Transitivity: If A ⊆ B and B ⊆ C, then A ⊆ C.
Example:
In the poset (Z+, |), The integers 3 and 9 are comparable
because 3 | 9.
The integers 5 and 7 are incomparable, because 5 ∤ 7 and
7 ∤ 5.
P(A) = {, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}
{a, b, c}
{a, b} {b, c}
{a, c}
{b}
{a} {c}
Solution:
Maximal elements are 12, 20
and 25.
Minimal elements are 2 and 5.
Answer:
(a) No greatest element, a is the least element.
(b) No greatest element, no least element.
(c) d is the greatest element, no least element.
(d) d is the greatest element, a is the least element.
Arab Open University – Faculty of Computer Studies MT131 - Discrete Mathematics
Example
• If A is a subset of the poset (S, ≼) and u is an element of
S such that a ≼ u for all elements a A, then u is called
an upper bound of A.
• The element x is called the least upper bound of the
subset A if x is an upper bound that is less than every
other upper bound of A.
• If l is an element of S such that I ≼ a for all elements a
A, then I is called a lower bound of A.
• The element y is called greatest lower bound of A if y is
a lower bound of A and z ≼ y whenever z is a lower
bound of A.
The greatest lower bound and least upper bound of a
subset A are denoted by glb(A) and lub(A), respectively.
Solution:
The lower bound of A is 2.
The upper bound of A is 4,12 and 20.
The glb(A) is 2.
The lub(A) is 4.