8.1 Relations and Their Properties
8.1 Relations and Their Properties
Suha Al-Shaikh-Dammam
Binary relation
Example:
Let R: A ↔ B
Ex: Let A be the set {1,2,3,4}, which ordered pairs are in the relation R={(a,b)| a
divides b}?
R= {(1,1),(2,2),(3,3),(4,4),(1,3),(1,2),(1,4),(2,4)}
C. Graph
R1 = {(1,1),(2,2),(3,3),(4,4),(1,3),(1,2),(1,4),(2,4)}
1
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
D. Table
R = {(1,1),(2,2),(3,3),(4,4),(1,3),(1,2),(1,4),(2,4)}
Relations on a Set
Example: The “<” relation defined as a relation on the set N of natural numbers.
Example:
A = {1,2,3,4}
IA = {(1,1),(2,2),(3,3),(4,4)}
Example:
R1= {(a,b)| a ≤ b}
(1,1) is in R1,R2,R3
(1,2) is in R1,R3
(1,-1) is in R2,R3
2
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
Question:
Example
S ={a, b, c}
There are :
23 29 512 Relations
2
Properties of Relations
1. R1={(1,1),(1,2),(2,1),(2,2),(3,4),(4,1),(4,4}
Not Reflexive
2. R2={(1,1),(2,1),(2,2),(3,3),(3,4),(4,4)}
Reflexive
3. R3 = {(a, b) | a ≤ b} Reflexive
Example:
A= {1, 2}
3
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
Example:
Example:
Example:
Let A = {1,2,3}
4
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
Example:
R1={(a, b) | a=b}
symmetric , antisymmetric
R2={(a, b) | a>b}
R3={(a, b) | a=b+1}
3. Transitivity
Examples: A= {1,2}
R1={(1,1),(1,2),(2,1),(2,2)} transitive
R3 ={(3,4)} transitive
Special cases
Empty set {}
U universal set.
Combining Relations:
R1={(1,1),(2,2),(3,3)}
R2={(1,1),(1,2),(1,3),(1,4)}
R1 R2 = {(1,1),(2,2),(3,3), (1,2),(1,3),(1,4)}
R1 R2= {(1,1)}
R1- R2={(2,2),(3,3)}
5
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
Composite Relations:
If R1 a relation from a set A to a set B, and R2 is a relation from set B to set C, the
R2◦ R1 is a set from A to C.
A
R1
B
R2
C
A C
R 2 R1
Ex:
R={(1,1), (1,4),(2,3),(3,1),(3,4)}
S = {{1,0), (2,0),(3,1),(3,2),(4,1)}
Power
R1 =R and Rn = Rn-1 ◦ R
Find:
R2 = {(1,1),(2,1),(3,1),(4,2)}
R3 = R2 ◦ R= {(1,1),(2,1),(3,1),(4,1)}
Let R be a Relation from a set A to a set B. The inverse relation from B to A denoted
by: R-1= {(b,a)| (a,b) R}.
R {(a, b) | (a, b) R}
6
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
E.g., Joe likes Susan and Mary, Fred likes Mary, and Mark likes Sally.
Example:
7
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
These relation characteristics are very easy to recognize by inspection of the zero-
one matrix.
Remark: 1) The relation R is reflexive if all the elements on the main diagonal of M R
(2) The relation R is symmetric if and only if mij m ji for all pairs of integers i
and j with i = 1,2,…..,n and j = 1,2,…….n
(4) The relation R is anti symmetric if and only if (a,b) R and (b,a) R → a=b. The
matrix of anti symmetric relation has the property that if mij 1 i j then m ji 0
Example:
Operations
The Boolean Operations join and meat can be used to find the matrices
representing the union and the intersection of two relations
Then: M R1 R 2 M R1 M R 2
M R1 R 2 M R1 M R 2
8
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
Example:
1 0 1 1 0 1
M R1 1 0 0 and M R2 0 1 1
0 1 0 1 0 0
Then :
1 0 1
M R1 R 2 M R1 M R 2 1 1 1
1 1 0
1 0 1
M R1 R 2 M R1 M R 2 0 0 0
0 0 0
2) Composite
Suppose that R: A ↔ B, S: B ↔ C
(Boolean Product)
M S R M R M S
Example:
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 0 1 1
0 0 0
3)Power
M R n M R[n ]
• R2 =R ◦ R = MR[2]
9
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
Example
Find the matrix that represent R2 where the matrix representing R is:
0 1 0 0 1 1
M R 0 1 1 then M R2 1 1 1
1 0 0 0 1 0
Note that : an edge from (a,a) represented using an arc from the
vertex a back to it self. Such an edge is called a loop
Example:
Edges are (a,b), (b,b), (c,b), (a,d), (b,d), (d,b), and (c,a).
Solution:
11
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
Example: Determine whether the relation for the following directed graph are
reflexive, symmetric , anti symmetric, and or transitive.
2)It is not symmetric because there are (a,b) but not (b,a).
4)R is not transitive because (a,b), and (b,c) belongs to S, but (a,c) doesn’t belong.
11
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
Closures of Relations
Definition: For any property X, the “X closure” of a set A is defined as the “smallest”
superset of A that has the given property.
I.e., it is R IA
Example
How can you produce a reflexive relation containing R that is as small as possible?
{(1,1),(1,2),(2,1),(3,2),(2,2),(3,3)}
Example
Answer:
12
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
i.e., it is R R−1
Example
The relation
How can we produce a symmetric relation that is as small as possible and contains R?
{(1,1),(2,2),(1,2),(3,1),(2,3),(3,2),(2,1),(1,3)}
Example
Answer:
i.e., it is R* R n
nZ
MR*=MR MR[2]…………MR[n]
Example
• R* = R R2 R3
• R2 = R ◦ R = {(1,1),(1,2),(2,2),(3,1)}
• R3 = R2o R = {(1,1),(1,2),(2,1),(2,2),(3,2)}
• R* = {(1,1),(1,2),(2,1),(3,2),(2,2),(3,1)}
13
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
Example:
1 0 1
*
Find MR for M R 0 1 0
1 1 0
1 1 1
M R * M R M R[ 2 ] M R[ 3 ] 0 1 0
1 1 1
Questions: 1) let R be the relation on the set {0,1,2,3} containing the pairs
(0,1),(1,1),(1,2),(2,0),(2,2) and (3,0). Find the
a) Reflexive closure of R
b) Symmetric closure of R
_____________________________________________________________________
2) Let R be the relation {(a,b)| a divides b} on the set of integers. What is the
symmetric closure of R?
_____________________________________________________________________
3) Draw the directed graph of the reflexive closure and the symm. Closure of the
relation with the directed graph shown
Solution:
14
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
Equivalence Relations
An equivalence relation on a set A is simply any binary relation on A that is reflexive,
symmetric, and transitive.
Example:
Answer:
R is transitive since for (a,b) then a-b integer and for (b,c) then b-c integer ,
so R is an Equivalence Relation.
Example:
Answer:
So that : b ≡a(mod m)
*R is transitive: Suppose
a-c=(a-b)+(b-c)=km+lm=(k+l)m
15
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
Example: show that “divides” relation on the set of positive integers is not an
equivalence relation.
Solution:
Example: let R be the relation on the set of real numbers such that x Ry if and only if
x and y are real numbers that differ by less than 1. That is |x-y|<1. Show that R is not
an equivalence relation.
Solution:
|x-y|=|y-x|<1→yRx so R is symmetric.
So R is not transitive.
Equivalence classes:
Definition: let R be an equivalence relation on a set A. The set of all elements that are
related to an element a of A is called the equivalence class of a (denoted by [a]R ).
aR s | (a, s) R
Do example8.
16
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
Example: what are the equivalence classes of 0 and 1 for congruence modulo 4?
Solution:
*The equivalence class of 0 contains all integers a such that a o(mod 4) . The
integers in this class are divisible by 4. so 04 ....,8,4,0,4,8,....
The integers in this class are those that have a remainder 1 when divided by 4.
So 14 ....,7,3,1,5,9,....
24 ....,6,2,2,6,10,...
34 ....,5,1,3,7,11,...
17
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
A set S together with R is called a partially ordered set, or poset and is denoted by
(S,R), members of S are called elements of the poset.
Example1: (page566)
Show that the “greater than or equal” relation (≥)is the partial ordering on the set of
integers.
Solution:
2) Anti symmetric: if a|b and b|a then a=b. Hence | is anti symmetric.
C=lb=l(ka)=(lk)a→a|c so | is transitive
It follows that | is a partial ordering on the set of positive integers and and ( Z , |)
is a poset.
Example: show that the inclusion relation is a partial ordering on the power set of a
set S.
Therefore is a partial ordering on the power set of a set S; and (p(s), ) is a poset.
18
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
Let R be the relation on the set of people such that xRy if x and y are people and x is
older than y. Show that R is not a partial ordering.
Solution: R is not reflexive because no person is older than himself or herself. That is
xRx for all people x it follows that R is not partial ordering.
Example: In the poset ( Z , |) are the integers 3 and 9 comparable? Are 5 and 7
comparable?
Solution: because 3|9, the integers 3 and 9 are comparable. Because 5 | 7, the integers
5 and 7 are in comparable.
Remark: when every two elements in the set are comparable, the relation is called
a total ordering.
Example:page 568:
the poset (Z,≤) is totally ordered, because a≤b or b≤a whenever a and b are integers.
Example: the poset ( Z , |) is not totally ordered because it contains elements that are
in comparable, such as 5 and 7.
19
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
Solution: because 3<4 it follows that (3,5) (4,8) and that (3,8) (4,5), we have
(4,9) (4,11), because the first entries of (4,9) and (4,11) are the same but 9<11.
Examplepage 569:
note that (1,2,3,5) (1,2,4,3), because the entries in the first 2 positions of these 4-
tuples agree, but in the third position the entry in the first 4-tuples,3 is less than 4 (
here the ordering on 4-tuples is the lexicographic ordering that comes from the usual
“less than or equals” relation on the set of integers).
The Hasse Diagram for the partial ordering relation is obtained from the associated
diagrams by deleting all the loops and all the edges that occur from transitivity
1) Starts with the directed graphs for the given relation (partial ordering set)
3) Remove the edges that must be in-the partial ordering because of the presence
of other edges and transitivity. E.g if (a,b) and (b,c) are in the partial ordering
remove (a,c)
4) Finally arrange each edge so that its initial vertex is below its terminal vertex.
Example: Draw the Hasse Diagram representing the partial ordering {(a,b):a≤b} on
the set {1,2,3,4}
Solution: R{(1,1),(2,2),(3,3),(4,4),(1,2),(1,3),(1,4),(2,3),(2,4),(3,4)}
21
M131-Chapter8 By Ms. Suha Al-Shaikh-Dammam
Example: Draw the Hasse Diagram representing the partial ordering {(a,b):a|b} on
{1,2,3,4,6,8,12}
Answer:
R={(1,1),(1,2),(1,3),(1,4),(1,6),(1,12),(2,2),(2,4),(2,6),(2,8),(2,12),(3,3),(3,6),(3,12),
(4,4),(4,8),(4,12),(6,6),(6,12),(8,8)(12,12)}
21