Professional Documents
Culture Documents
Lesson 6: Relations
Main reference : Discrete mathematics and Its Applications, 7th edition, Kenneth H. Rosen
1 Relations
Recall the definition of a Cartesian Product:
2. ⊆, ⊂, ⊇, ⊃ for sets.
3. ∈, for set membership relation A × P(A).
Note that arithmetic operators are also relations. Consider the addition operation, +:
x + y = z, for x, y, z ∈ R. The + relation can be expressed as + : (R × R) × R.
Definition 3 The inverse of a given relation R from a set X to set Y is the relation R−1
= {(y, x) : y ∈ Y, x ∈ X, and (x, y) ∈ R}.
Copyright c 2020 Nestine Hope S. Hernandez, Richelle Ann B. Juayong and Kelvin C. Buño
nshernandez@up.edu.ph;rbjuayong@up.edu.ph;kcbuno@up.edu.ph
2 CS 30 : Discrete Mathematics for Computer Science I
Example 4 Determine if the following relations, over the set of real numbers, are reflexive,
symmetric, antisymmetric, or transitive:
= < ≤ 6=
R O X O X
S O X X O
AS O O O X
T O O O X
• R≡3 is reflexive.
Proof: Suppose m is an integer. We have to show that mR≡3 m. Note here that
m − m = 0, and 3 | 0. Therefore, mR≡3 m.
• R≡3 is symmetric.
Proof: Suppose that m and n are integers, and that mR≡3 n. We have to show that
nR≡3 m. By definition of R≡3 , 3 | (m − n). By definition of divisibility, m − n = 3k,
for some integer k. Multiplying both sides by (−1), we obtain, n − m = 3(−k). Note
here that (−k) is an integer. Hence, 3 | (n − m). Therefore, nR≡3 m.
• R≡3 is transitive.
Proof: Suppose that m, n, and p are integers, and mR≡3 n, and nR≡3 p. We have to
show that mR≡3 p. By definition of R≡3 , 3 | (m − n) and 3 | (n − p). By definition
of divisibility, m − n = 3k, and n − p = 3l, for some integers k and l. By algebra,
n = m − 3k = 3l + p,
m − 3k = 3l + p
m − p = 3l + 3k
m − p = 3(l + k)
2 Equivalence Relations
Definition 5 An equivalence relation on a set X is a relation that is reflexive, symmetric,
and transitive.
Given an equivalence relation R on a set X, and two elements x, y ∈ X, x and y are said
to be equivalent if and only if xRy.
Copyright c 2020 Nestine Hope S. Hernandez, Richelle Ann B. Juayong and Kelvin C. Buño
nshernandez@up.edu.ph;rbjuayong@up.edu.ph;kcbuno@up.edu.ph
3 CS 30 : Discrete Mathematics for Computer Science I
Proof:
(R is reflexive.) Suppose (x, y) ∈ R2 . Note that byc = byc. Hence, (x, y)R(x, y). There-
fore, R is reflexive.
(R is transitive.) (x1 , y1 ), (x2 , y2 ), (x3 , y3 ) ∈ R2 , and (x1 , y1 )R(x2 , y2 ), and (x2 , y2 )R(x3 , y3 ).
By definition of R, by1 c = by2 c, and by2 c = by3 c. By transitivity of =, by1 c = by3 c. Hence,
(x1 , y1 )R(x3 , y3 ). Therefore, R is transitive.
Definition 6 Given an equivalence relation R on a set X, the equivalence class (under
R) of an element x ∈ X is the set {y|y ∈ X ∧ yRx} of all elements of X that are equivalent
to x. The equivalence class of x ∈ X under R is denoted as [x]R .
Properties of Equivalence classes
Let X be any set, and let R be an equivalence relation on X. For all x, y ∈ X,
1. yRx if and only if [y] = [x]
2. [y] 6= [x] if and only if [y] ∩ [x] = ∅
Example 7 Congruence Modulo n: For a fixed n ∈ N, n > 1, define a relation R on Z, by
aRb if and only if a≡b (mod n) if and only if n|(a − b)
1. Show that R is an equivalence relation.
2. What are the set of distinct equivalence classes of the integers modulo n?
and for a finite collection of non-empty set, if there are n sets, then:
n
[
A= Ai
i=1
Example:
1. Let A be the closed interval [−5, 5]. Let P be the collection
{−5} ∪ {(n, n + 1]|n ∈ Z ∧ −5 ≤ n ≤ 4}
Is P a partition of A?
Copyright c 2020 Nestine Hope S. Hernandez, Richelle Ann B. Juayong and Kelvin C. Buño
nshernandez@up.edu.ph;rbjuayong@up.edu.ph;kcbuno@up.edu.ph
4 CS 30 : Discrete Mathematics for Computer Science I
• As previously discussed, any positive integer divides itself, hence the reflexive prop-
erty. The transitivity of divisibility is already known. That leaves the proof for
anti-symmetry.
Proof:
(R is anti-symmetric) Suppose that x, y ∈ Z+ , and that xRy and yRx. Need to show
that x = y. By definition of R, x|y means that y = ax, and y|x means that x = by,
for some integers a, b. Note here that because x and y are positive integers, then a and
b are also positive integers. By algebra, substituting x with by, we have that y = aby.
For this to be true, a = 1 and b = 1. This implies that x = y. Therefore, R is
anti-symmetric.
Copyright c 2020 Nestine Hope S. Hernandez, Richelle Ann B. Juayong and Kelvin C. Buño
nshernandez@ up. edu. ph; rbjuayong@ up. edu. ph; kcbuno@ up. edu. ph
5 CS 30 : Discrete Mathematics for Computer Science I
Examples:
1. The relation ≤ over the set of real numbers is a total order relation.
2. Let A be a set. The relation ⊆ over the set of subsets of A (or P(A)) is not a total
order relation.
Copyright c 2020 Nestine Hope S. Hernandez, Richelle Ann B. Juayong and Kelvin C. Buño
nshernandez@up.edu.ph;rbjuayong@up.edu.ph;kcbuno@up.edu.ph
6 CS 30 : Discrete Mathematics for Computer Science I
Definition 13 Let Σ be an alphabet, and let S be the set of all finite strings over Σ. Let R
be a partial ordering relation on Σ.
The lexicographical ordering relation, denoted as , is a relation over S defined as
follows:
→ →
1. Let x = x1 x2 ...xm , y = y1 y2 ...yn ∈ S, for some integers m and n. If m ≤ n, and xi = yi
→ →
for all i, 1 ≤ i ≤ m, then, x y .
→ →
2. Let x = x1 x2 ...xm , y = y1 y2 ...yn ∈ S, for some integers m and n. If for some integer
k, k ≤ m, n, and k ≥ 1, xi = yi , for all i, 1 ≤ i ≤ k − 1, and xk Ryk , and xk 6= yk ,
→ →
then x y .
→ →
3. For any string z ∈ S, ε z .
As a final note, when the term partial order relation is used, it refers to the reflexive
or non-strict partial order relation.
Copyright c 2020 Nestine Hope S. Hernandez, Richelle Ann B. Juayong and Kelvin C. Buño
nshernandez@up.edu.ph;rbjuayong@up.edu.ph;kcbuno@up.edu.ph
7 CS 30 : Discrete Mathematics for Computer Science I
4 Exercises
1. Let R be a relation on Z × (Z − {0}), defined as
(a, b) R (c, d) ⇔ ad = bc
m R n ⇔ 5|(m2 − n2 )
8. Let R be a partial order relation on a set A, and let B be a subset of A. Show that B
is also a partially ordered set under R.
Copyright c 2020 Nestine Hope S. Hernandez, Richelle Ann B. Juayong and Kelvin C. Buño
nshernandez@up.edu.ph;rbjuayong@up.edu.ph;kcbuno@up.edu.ph