(CH 8) Relations 1. Basics: 400 Lecture Note #6
(CH 8) Relations 1. Basics: 400 Lecture Note #6
[Ch 8] Relations
1. Basics
• There are various kinds of relations between mathematical objects – e.g. +, /, xy (exponent), =, ≠, ≥, ˄, ~,
→, ≡, ∩
• Formal definition of (Binary) Relation:
a. Is 57 L 53?
b. Is (−17) L (−14)?
c. Is 143 L 143?
d. Is (−35) L 1?
(a1, a2, a3, a4) ∈ R ⇔ a patient with patient ID number a1, named a2, was
admitted on date a3, with primary diagnosis a4.
Example instances/tuples:
1. R is not reflexive ⇔ there is an element x in A such that x R x [that is, such that (x, x) ∉ R].
2. R is not symmetric ⇔ there are elements x and y in A such that x R y but y R x [that is, such that
(x, y) ∈ R but (y, x) ∉ R].
3. R is not transitive ⇔ there are elements x, y and z in A such that x R y and y R z but x R z [that
is, such that (x, y) ∈ R and (y, z) ∈ R but (x, z) ∉ R].
• Examples:
[8.2.1, p. 451] Let A = {0, 1, 2, 3} and define relations R, S, and T on A as follows:
R = {(0, 0), (0, 1), (0, 3), (1, 0), (1, 1), (2, 2), (3, 0), (3, 3)},
S = {(0, 0), (0, 2), (0, 3), (2, 3)},
T = {(0, 1), (2, 3)}.
2. [8.2.3, p. 454] Define a relation R on R (the set of all real numbers) as follows:
ANSWER: {(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)}.
4. Equivalence Relations
• A relation on a set that satisfies the three properties of reflexivity, symmetry, and transitivity is called an
equivalence relation.
• Example:
Consider the relation R on a set {1,2,3,4,5}.
R = {(1,1), (1,2), (1,3), (1,4), (2,2), (2,3), (2,4), (3,3), (3,4), (4,4)}
5. Equivalence Classes
• “In mathematics, when the elements of some set S have a notion of equivalence (formalized as an
equivalence relation) defined on them, then one may naturally split the set S into equivalence classes.
These equivalence classes are constructed so that elements a and b belong to the same equivalence class
if and only if a and b are equivalent.” [Wikipedia]
• Example [8.3.5, p. 465]: Let A = {0, 1, 2, 3, 4} and define a relation R on A as follows:
R = {(0, 0), (0, 4), (1, 1), (1, 3), (2, 2), (3, 1), (3, 3), (4, 0), (4, 4)}.
The directed graph for R is as shown below. As can be seen by inspection, R is an equivalence relation
on A. Find the distinct equivalence classes of R.
• [0] = {x ∈ A | x R 0} = {0, 4}
• [1] = {x ∈ A | x R 1} = {1, 3}
• [2] = {x ∈ A | x R 2} = {2}
• [3] = {x ∈ A | x R 3} = {1, 3}
• [4] = {x ∈ A | x R 4} = {0, 4}
Note that [0] = [4] and [1] = [3]. Thus the distinct equivalence classes of the relation are {0, 4}, {1, 3},
and {2}.
• Exercises:
1. The relation R on a set {1,2,3,4,5}.
R = {(1,1), (1,3), (1,5), (2,2), (2,4), (3,1), (3,3), (3,5), (4,2), (4,4), (5,1), (5,3), (5,5)}
is an equivalence relation (as shown in the previous examples). First find the equivalence classes.
Let us determine the members of the equivalence classes. The equivalence class [1] consists of
all x with xR1, thus
Example: The relation R on a set {1,2,3,4}, and a relation R defined over X as (x,y) ∈ R if x <= y:
R = {(1,1), (1,2), (1,3), (1,4), (2,2), (2,3), (2,4), (3,3), (3,4), (4,4)}
• Partial order relation – VERY IMPORTANT in Computer Science (related to data structures such as
trees, graphs).
Two fundamental partial order relations are the “less than or equal to (<=)” relation on a set of real
⊆)” relation on a set of sets.
numbers and the “subset (⊆
• Example [8.5.4, p. 501] Another useful partial order relation is the “divides” relation.
Let | be the “divides” relation on a set A of positive integers. That is, for all a, b ∈ A,
ANSWER: is shown on the textbook, but we will work it out in the class.