12 Relations
12 Relations
2
Binary Relations - Example
• Let A = {0, 1, 2} and B = {a, b}. Then relation R from A to B
is defined as:
– R = {(0, a), (0, b), (1, a), (2, b)}
– Relations can be represented graphically
• Arrow representation
• Table representation
0
R a b
a
1 0 × ×
1 ×
b
2 ×
2
3
Relations on a set
• A relation on the set A is a relation from A to A.
• A relation on a set is a subset of A × A
– Example: Consider the following relations on set of integers:
• R1 = {(a, b) | a ≤ b}
• R2 = {(a, b) | a > b}
• R3 = {(a, b) | a = b or a = ̶ b}
• R4 = {(a, b) | a = b}
• R5 = {(a, b) | a = b + 1}
• R6 = {(a, b) | a + b ≤ 3}
– Which of these relation contain each pairs (1, 1), (1, 2), (2, 1), (1, -1),
and (2, 2)?
– Answer:
• (1, 1) is in R1, R3, R4, and R6
• (1, 2) is in R1, and R6
• (2, 1) is in R2, R5, and R6
• (1, -1) is in R2, R3, and R6
• (2, 2) is in R1, R3, and R4
4
Relations Functions
5
Properties on Relations
• There are several properties that are used to
classify relations on a set.
– Reflexive
– Symmetric
– Antisymmetric
– Transitive
6
Reflexive
• A relation R on a set A is called reflexive if (a,a) ∈ R for
every element a ∈ A.
• ∀a ((a, a) ∈ R), where the u. of d. is the set of all elements
in the set.
• A relation R on a set A is reflexive if every element of A is
related to itself.
– Example: Is the “divides” relation i.e. R = {(a, b) | a divides b} on
the set of integers is reflexive?
– Answer: Yes, because a |a is true for all positive integers. So the
“divides” relation is reflexive.
7
a
b c
8
Symmetric
• A relation R on a set A is called symmetric if (b, a) ∈ R
whenever (a, b) ∈ R, for some a, b ∈ A.
• A relation R on a set A such that (a, b) ∈ R and (b, a) ∈ R only
if a = b for a, b ∈ A is called antisymmetric.
– Note that antisymmetric is not the opposite of symmetric. A relation
can be both.
• A relation R on a set A is called asymmetric if (a, b) ∈ R 🡪
(b,
a) ∉ R.
– Example: Is the “divides” relation i.e. R = {(a, b) | a divides b} on the
set of integers is symmetric? Is it antisemmetric?
– Answer: The relation is not symmetric because (1, 2) ∈ R but (2, 1)
∉ R.
– The relation is antisymmetric, if a and b are positive integer s with a |
b and b | a, then a = b.
9
10
Transitive
• A relation R on a set A, is called transitive if whenever (a, b)
∈ R and (b, c) ∈ R, then (a, c) ∈ R , for (a, b, c) ∈ A.
– Example: Is the “divides” relation i.e. R = {(a, b) | a divides b} on
the set of integers is transitive?
– Answer: Suppose a divides b and b divides c. Then there are positive
integers k and l such that b = ak and c = bl. Hence c = akl = a (kl), so
a divides c. It follows that the relation is transitive.
– Suppose 3 | 6 and 6 | 12 then 3 | 12.
11
List of Examples
If R is a relation on Z where (x, y) ∈ R when x ≠ y.
Is R reflexive?
No, x = x is not included.
Is R symmetric?
Yes, if x ≠ y, then y ≠ x.
Is R antisymmetric?
No, x ≠ y and y ≠ x does not imply x = y.
Is R transitive?
No, (1,2) ∈ R and (2,1) ∈ R but (1,1) ∉ R.
12
List of Examples
If R is a relation on Z where (x, y) ∈ R when xy ≥ 1
Is R reflexive?
No, 0*0 ≥ 1 is not true.
Is R symmetric?
Yes, if xy ≥ 1, then yx ≥ 1. (1*2 ≥ 1; 2*1 ≥ 1)
Is R antisymmetric?
No, 1*2 ≥ 1 and 2*1 ≥ 1, but 1 ≠ 2.
Is R transitive?
Yes, xy ≥ 1 and yz ≥ 1 implies xz ≥ 1 (1*2 ≥ 1; 2*3 ≥ 1; 1*3 ≥ 1)
(x, y and z can’t be zero and must be all positive or all negative.)
13
List of Examples
If R is a relation on Z where (x, y) ∈R when x = y + 1 or x = y - 1
Is R reflexive?
No, (2,2) ∉ R. 2 ≠ 2+1 and 2 ≠ 2-1.
Is R symmetric?
Yes, if (x, y) ∈ R, x = y + 1 🡪 y = x - 1 or
x = y - 1 ∈y = x + 1. So (y, x) ∈ R. (3 = 2 + 1; 2 = 3 - 1)
Is R antisymmetric?
No, (2,1) ∈ R and (1,2) ∈ R, but 1 ≠ 2.
Is R transitive?
No, (1,2) and (2,3) ∈ R , but (1,3) ∉ R.
1 ≠ 3 + 1 and 1 ≠ 3 - 1.
14
List of Examples
If R is a relation on Z where (x, y) ∈ R when x is a multiple of y.
Is R reflexive?
Yes, (x, x) ∈ R for all x, because x is a multiple of itself.
Is R symmetric?
No, (4,2) ∈ R, but (2,4) ∉ R.
Is R antisymmetric?
No, (2,-2) ∈ R and (-2,2) ∈ R, but 2 ≠ -2.
Is R transitive?
Yes, if (x, y) ∈ R and (y, z) ∈ R, x = k*y and y = j*z j,k ∈ Z.
x = kj*z and kj ∈ Z, thus x is a multiple of z and (x, z) ∈ R.
15
List of Examples
If R is a relation on Z where (x, y) ∈ R when x and y are both negative or
both nonnegative
Is R reflexive?
Yes, x has the same sign as itself so (x, x) ∈ R for all x.
Is R symmetric?
Yes, if (x, y) ∈ R then x and y are both negative or both nonnegative. It
follows that y and x are as well.
Is R antisymmetric?
No, (99,132) ∈ R and (132,99) ∈ R, but 99 ≠ 132.
Is R transitive?
Yes, if (x, y) ∈ R and (y, z) ∈ R, then x, y and z are all negative or all
nonnegative. Thus (x, z) ∈ R. ((-2, -3), (-3, -4), (-2, -4) ∈ R)
16
List of Examples
If R is a relation on Z where (x, y) ∈ R when x = y 2
Is R reflexive?
No, (2,2) ∉ R. 2 ≠ 22.
Is R symmetric?
No, (4,2) ∈ R, but (2,4) ∉ R.
Is R antisymmetric?
Yes, if (x, y) ∈ R and (y, x) ∈ R then x = y2 and y = x2. The only time
this holds true is when x = y (and more specifically when x = y = 1 or
0).
Is R transitive?
No, (16,4) ∈ R and (4,2) ∈ R, but (16,2) ∉ R.
17
List of Examples
If R is a relation on Z where (x, y) ∈ R when x ≥ y 2
Is R reflexive?
No, (2,2) ∉ R. 2 < 22.
Is R symmetric?
No, (10,3) ∈ R, but (3,10) ∉ R.
Is R antisymmetric?
Yes, (x, y) ∈ R and (y, x) ∈ R implies that x ≥ y2 and y ≥ x2. The only
time this holds true is when x = y (=1 or 0).
Is R transitive?
Yes, if (x, y) ∈ R and (y, z) ∈ R, then x ≥ y2 and y ≥ z2.
x ≥ y2 ≥ (z2)2 (≥ z2). Thus (x, z) ∈ R.
18
Combining Relations
• Example: Let A = {1, 2, 3} and B = {1, 2, 3, 4}. The relation
R1 = {(1, 1), (2, 2), (3, 3)} and R2 = {(1, 1), (1, 2), (1, 3), (1,
4)} can be combine to obtain
– R1 ∪ R2 = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (3, 3)}
– R1 ∩ R2 = {(1, 1)}
– R1 − R2 = {(2, 2), (3, 3)}
– R2 − R1 = {(1, 2), (1, 3), (1, 4)}
– R1 ⊕ R2 = R1 ∪ R2 − R1 ∩ R2 = {(1, 2), (1, 3), (1, 4), (2, 2), (3, 3)}
19
Combining Relations
the composite of R and S
• Let R be a relation from a set A to a set B and S a relation from
set B to a set C. The composite of R and S is the relation
consisting of ordered pairs (a,c) where a ∈ A, c ∈ C, and for
which there exists an element b ∈ B such that (a, b) ∈ R and
(b, c) ∈ S.
• The composite of R and S is written S º R.
– Example: What is the composite of the relations R and S, where R is the
relation from {1, 2, 3} to {1, 2, 3, 4} and S is a relation from {1, 2, 3,
4} to {0, 1, 2} with R = {(1, 1), (1, 4), (2, 3), (3, 1), (3, 4)} and S =
{(1, 0), (2, 0), (3, 1), (3, 2), (4, 1)}?
– Answer: S º R is constructed using all ordered pair in R and S, where
the second element of the ordered pair in R agrees with the first element
of the ordered pair in S.
– S º R = {(1, 0), (1, 1), (2, 1), (2, 2), (3, 0), (3, 1)}
20
The powers of R, Rn
• Let R be a relation on the set A. The powers Rn, n = 1, 2, 3,
…, are defined inductively by
• R1 = R and Rn+1 = Rn ° R
• Thus the definition shows that:
– R2 = R ° R
– R3 = R2 ° R = (R ° R) ° R and so on.
21
Theorem 1
Prove: The relation R on a set A is transitive if and only if Rn ⊆
R for n = 1,2,3 . . .
22
The Proof – Part 1
23
The Proof – Part 1 (continued)
Inductive Step: Assume that Rn ⊆ R.
We must show that this implies that Rn+1 ⊆ R.
Assume (a, b) ∈ Rn+1.
Then since Rn+1 = Rn ° R, there is an element x in A such that
(a, x) ∈ R and (x, b) ∈ Rn.
By the inductive hypothesis, i. e. Rn ⊆ R; (x, b) ∈ R.
Since R is transitive and (a, x) ∈ R and (x, b) ∈ R, (a, b) ∈ R.
Thus Rn+1 ⊆ R.
24
The Proof – Part 2
Now we must show that
Rn ⊆ R for n = 1, 2, 3 . . . → R is transitive.
Proof: Assume Rn ⊆ R for n = 1, 2, 3 . . . .
In particular, R2 ⊆ R.
This means that if (a, b) ∈ R and (b, c) ∈ R, then by the
definition of composition, (a, c) ∈ R2. Since R2 ⊆ R, (a,
c) ∈ R.
Hence R is transitive.
25
Thank You
• Study all the solved problem from your text
book.
• Try to solve related problems from exercise.
• Text from Rosen 8.1
26