chapter 8: relations. 8.1 relations and their properties binary relations: let a and b be any two...
DESCRIPTION
Example Let R : A B, and A = {1, 2, 3} represents students, B = {a, b} represents courses. A×B = { (1, a), (1, b), (2, a), (2, b), (3, a), (3, b)}. If R = {(1, a), (1, b)}, it means that student 1 registered in courses a and bTRANSCRIPT
![Page 1: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/1.jpg)
Chapter 8: Relations
![Page 2: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/2.jpg)
8.1 Relations and Their Properties
Binary relations:• Let A and B be any two sets.
• A binary relation R from A to B, written R : A B,
is a subset of the Cartesian product A×B.
• The notation a R b means (a, b) R.
• The notation a R b means (a, b) R.• If a R b we may say that a is related to b (by
relation R ), or a relates to b (under relation R ).
![Page 3: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/3.jpg)
Example
Let R : A B, and A = {1, 2, 3} represents students,B = {a, b} represents courses.A×B = { (1, a), (1, b), (2, a), (2, b), (3, a), (3, b)}.
If R = {(1, a), (1, b)}, it means that student 1registered in courses a and b
![Page 4: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/4.jpg)
Relations can be Represented by:
Let A be the set {1, 2, 3, 4} for which ordered pairs are in the relation
R = {(a, b) | a divides b}
A- Roaster Notation: List of ordered pairs:
R = {(1, 1), (2, 2), (3, 3), (4, 4), (1, 2), (1, 3), (1, 4), (2, 4)}
B- Set builder notation: R = {(a, b) : a divides b}
![Page 5: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/5.jpg)
C- Graph:R = {(1, 1), (2, 2), (3, 3), (4, 4), (1, 2), (1, 3), (1, 4), (2, 4)}
1 1
2 2
3 3
4 4
1 2 3 4OR
Relations can be Represented by:
Domain of R
![Page 6: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/6.jpg)
D- Table:R = {(1, 1), (2, 2), (3, 3), (4, 4), (1, 2), (1, 3), (1, 4), (2, 4)}
R 1 2 3 4
1 × × × ×
2 × ×
3 ×
4 ×
Relations can be Represented by:
![Page 7: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/7.jpg)
Relations on a Set
• A (binary) relation from a set A to itself is called a relation on the set A.
e.g. The “<” relation defined as a relation on the set N of natural numbers:
let < : N N :≡ {(a, b) | a < b }If (a, b) R then a < b means (a, b) <
e.g. (1, 2) < .
![Page 8: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/8.jpg)
Examples: Consider the relations on A = {-1, 0, 1, 2},
R1 = {(a, b) | a < b}R2 = {(a, b) | a = b or a = -b}
R3 = {(a, b) | 0 ≤ a + b ≤ 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)}
Relations on a Set
![Page 9: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/9.jpg)
Relations on a Set
• The identity relation IA on a set A is the set
{(a, a) | a A}.
e.g. If A = {1, 2, 3, 4},
then IA = {(1, 1), (2, 2), (3, 3), (4, 4)}.
![Page 10: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/10.jpg)
Question
How many relations are there on a set with n elements?
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 , thus
there are relations on a set with n elements.
e.g. If S = {a, b, c}, there are relations.
2
2n2
2n
51222 932
![Page 11: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/11.jpg)
Properties of Relations1. Reflexivity and Irreflexivity
A relation R on A is reflexive if (a, a) R for every element a A.
e.g. Consider the following relations on {1, 2, 3, 4}R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)},
Not Reflexive.R2 = {(1, 1), (2, 1), (2, 2), (3, 3), (3, 4), (4, 4)},
Reflexive.R3 = {(a, b) | a ≤ b},
Reflexive.
![Page 12: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/12.jpg)
A relation R on A is irreflexive if for every element a A, (a, a) R.
Note: “irreflexive” ≠ “not reflexive”.
e.g. If A = {1, 2}, R = {(1, 2), (2, 1), (1, 1)} is not reflexive because (2, 2) R, not irrflexive because (1, 1) R.
Reflexivity and Irreflexivity
![Page 13: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/13.jpg)
1 2
3 4Not Reflexive and Not Irreflexive
Example
![Page 14: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/14.jpg)
1 2 1 2 3 4 3 4 Irreflexive Reflexive
Examples
![Page 15: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/15.jpg)
2. Symmetry and Antisymmetry
• A binary relation R on A is symmetric if (a, b) R ↔ (b, a) R, where a, b A.
• A binary relation R on A is antisymmetric if (a, b) R → (b, a) R.
That is, if (a, b) R (b, a) R → a = b.
![Page 16: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/16.jpg)
Examples
Consider these relations on the set of integers:R1 = {(a, b) | a = b}
Symmetric , antisymmetric.R2 = {(a, b) | a > b},
Not symmetric, antisymmetric.R3 = {(a, b) | a = b + 1},
Not symmetric, antisymmetric.
![Page 17: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/17.jpg)
Examples
Let A = {1, 2, 3}.
R1 = {(1, 2), (2, 2), (3, 1), (1, 3)} Not reflexive, not irreflexive, not symmetric, not antisymmetric
R2 = {(2, 2), (1, 3), (3, 2)} Not reflexive, not irreflexive, not symmetric, antisymmetric
R3 = {(1, 1), (2, 2), (3, 3)} Reflexive, not irreflexive, symmetric, antisymmetric
R4 = {(2, 3)} Not reflexive, irreflexive, not symmetric, antisymmetric
![Page 18: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/18.jpg)
3. Transitivity
• A relation R is said to be transitive if and only if (for all a, b, c),
(a, b) R (b, c) R → (a, c) R.
e.g. Let A = {1, 2}.
R1 = {(1, 1), (1, 2), (2, 1), (2, 2)} is transitive.
R2 = {(1, 1), (1, 2), (2, 1)} is not transitive, (2, 2) R2.
R3 = {(3, 4)} is transitive.
![Page 19: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/19.jpg)
Special Cases
Empty set { } Irreflexive, transitive, symmetric, antisymmetric.
Universal set U Reflexive, transitive, symmetric.
![Page 20: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/20.jpg)
Combining Relations
Let A = {1, 2, 3} , B = {1, 2, 3, 4},
R1 = {(1, 1), (2, 2), (3, 3)},
R2 = {(1, 1), (1, 2), (1, 3), (1, 4)}, then
R1 R2 = {(1, 1), (2, 2), (3, 3), (1, 2), (1, 3), (1, 4)}
R1 R2 = {(1, 1)}
R1 − R2 = {(2, 2), (3, 3)}
![Page 21: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/21.jpg)
Composite Relations
• If (a, c) is in R1 and (c, b) is in R2 then (a, b) is in R2◦R1 .
e.g. R is the relation from {1, 2, 3} to {1, 2, 3, 4} R = {(1, 1), (1, 4), (2, 3), (3, 1), (3, 4)}.
S is the relation from {1, 2, 3, 4} to {0, 1, 2} S = {(1, 0), (2, 0), (3, 1), (3, 2), (4, 1)}.
S◦R = {(1, 0), (1, 1), (2, 1), (2, 2), (3, 0), (3, 1)}.
![Page 22: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/22.jpg)
Powers
• Let R be a relation on the set A. the power Rn, n = 1, 2, 3, … are defined by
R1 = R and Rn = Rn -1 ◦ R
e.g. Let R = {(1, 1), (2, 1), (3, 2), (4, 3)}. FindR2 =R ◦ R = {(1, 1), (2, 1), (3, 1), (4, 2)}
R3 = R2 ◦ R = {(1, 1), (2, 1), (3, 1), (4, 1)}
![Page 23: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/23.jpg)
8.3 Representing Relations
• Some special ways to represent binary relations:– With a zero-one matrix.– With a directed graph.
![Page 24: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/24.jpg)
Using Zero-One Matrices
• To represent a relation R by a matrix MR = [mij ], let mij = 1 if (ai , bj) R, otherwise 0.
e.g., Joe likes Susan and Mary, Fred likes Mary, and Mark likes Sally.
• The 0-1 matrix representation of that relation:
1 000100 1 1
MarkFredJoe
SallyMarySusan
![Page 25: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/25.jpg)
Let A = {1, 2, 3} , B = {1, 2} , R : A → B such that:
R = {(2, 1), (3, 1), (3, 2)} then the matrix for R is: 1 2
1
2
3
Example
100
110
RM
100
110
![Page 26: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/26.jpg)
Zero-One Reflexive, SymmetricThe terms: Reflexive, non-reflexive, irreflexive,
symmetric and antisymmetric.– These relation characteristics are very easy to
recognize by inspection of the zero-one matrix.
1 0 1 01 0 1 0 1 0 1
1 0 1
1 0 0 0
Reflexive:all 1’s on diagonal
Irreflexive:all 0’s on diagonal
Symmetric:all identical
across diagonal
Antisymmetric:all 1’s are across
from 0’s
any-thing
any-thing
any-thing
any-thing anything
anything
![Page 27: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/27.jpg)
Example
Is R reflexive, symmetric, antisymmetric?
Reflexive, symmetric, not antisymmetric
110111011
RM
![Page 28: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/28.jpg)
Operations
1- Union and the Intersection The Boolean Operations join and meet can
be used to find the matrices representing the union and the intersection of two relations
2121
2121
RRRR
RRRR
MMM
MMM
![Page 29: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/29.jpg)
ExampleSuppose R1 and R2 are relations on a set A which are
represented by the matrices:
001110101
and010001101
21 RR MM
.000000101
,011111101
2121
2121
RRRR
RRRR
MMM
MMM
![Page 30: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/30.jpg)
2- CompositeSuppose that R : A ↔ B, S : B ↔ C (Boolean Product)
SRRS MMM
Operations
![Page 31: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/31.jpg)
Example
Let
Find the matrix of ?
RS
000110111
SRRS MMM
101100010
and000011101
SR MM
![Page 32: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/32.jpg)
3- Power][n
RRMM n
Operations
.,
.,
]3[
23
]2[
2
3
2
RR
RR
MMRRR
MMRRR
![Page 33: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/33.jpg)
Example
• Find the matrix that represents R2 where the matrix representing R is:
.010111110
then001110010
If ]2[2
RRR MMM
![Page 34: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/34.jpg)
Using Directed Graphs
A directed graph or digraph G = (VG , EG) is a set VG of vertices (nodes) with a set EG VG ×VG of edges (arcs or links). Visually represented using dots for nodes, and arrows for edges. Notice that a relation R : A ↔ B can be represented as a graph GR = (VG = A B, EG = R).
1 000100 1 1
MarkFredJoe
SallyMarySusanMR
GR
JoeFred
Mark
SusanMarySally
Node set VG (black dots)
Edge set EG
(blue arrows)
![Page 35: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/35.jpg)
Digraph Reflexive, Symmetric
It is extremely easy to recognize the reflexive, irreflexive, symmetric, antisymmetric properties by graph inspection.
Reflexive:Every node
has a self-loop
Irreflexive:No node
links to itself
Symmetric:Every link isbidirectional
Antisymmetric:
No link isbidirectional
Not symmetric, non-antisymmetric Non-reflexive, non-irreflexive
![Page 36: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/36.jpg)
8.4 Closures of Relations
• For any property X, the “X closure” of a set A is defined as the “smallest” superset of A that has the given property.
• The reflexive closure of a relation R on A is obtained by adding (a, a) to R for each a A not already in R .
i.e. It is R IA .
![Page 37: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/37.jpg)
Example 1
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)}.
![Page 38: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/38.jpg)
Example 2
What is the reflexive closure of the relation: R = {(a ,b) | a < b} on the set of integers?
Answer:
The reflexive closure of R is:
{(a, b) | a < b} {(a, a) | a Z} = {(a, b) | a ≤ b}.
![Page 39: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/39.jpg)
Symmetric Closure
The symmetric closure of R is obtained by
adding (b, a ) to R for each (a, b ) in R.
i.e. It is R R −1 .
![Page 40: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/40.jpg)
Example 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)}.
![Page 41: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/41.jpg)
Example 2
What is the symmetric closure of the relation: R = {(a, b) | a > b} on the set of positive integers?
Answer:
The Symmetric Closure of R is:
{(a, b) | a > b} {(b, a) | a > b} = {(a, b) | a ≠ b}.
![Page 42: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/42.jpg)
Transitive Closure
• The transitive closure or connectivity relation of R is obtained by repeatedly adding (a, c) to R for each (a, b), (b, c) in R.– i.e. It is
– Or in term of zero-one matrices:
Zn
nRR*
.][]2[* nRRRR MMMM
![Page 43: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/43.jpg)
Example 1
e.g. R = {(1,1), (1, 2), (2,1), (3, 2)} on the set
A = {1, 2, 3}
• R* = R R2 R3
• R2 = R o R = {(1,1), (1, 2), (2, 2), (3,1)}
• R3 = R2 o R = {(1,1), (1, 2), (2,1), (2, 2), (3, 2)}
• R* = {(1,1), (1, 2), (2,1), (3, 2), (2, 2), (3,1)}
![Page 44: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/44.jpg)
Example 2
• Find MR* for
111010111
011010101
]3[]2[* RRRR
R
MMMM
M
![Page 45: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/45.jpg)
8.5 Equivalence Relations
An equivalence relation on a set A is simply any binary relation on A that is reflexive, symmetric, and transitive.
Example1: Show that a relation on the set of real numbersR = {(a, b) | a – b is an integer}.
is an equivalence relation.
R is reflexive: Since a – a = 0 is an integer a R a for all a.R is symmetric: If a R b then whenever a – b is an integer
b – a is an integer b R a.R is transitive: If a R b and b R c then a – b and b – c are
integers, therefore, a – b + b – c = a – c is also an integer, which means a R c.
![Page 46: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/46.jpg)
Example 2: Let R : Z Z. Show that R = {(a, b) | a ≡ b (mod m)}, m > 1
is an equivalence relation.
Answer: a ≡ b (mod m) if and only if m divides a – b R is reflexive, a ≡ a (mod m) , m divides a – a = 0.
R is symmetric: Suppose a ≡ b (mod m) then m divides a – b, therefore m divides –(a – b) = b – a b ≡ a (mod m).
R is transitive: Suppose a ≡ b (mod m) and b ≡ c (mod m), then: m divides both a – b and b – c, therefore, m divides their sum (a – b) + (b – c) = a – c , thus a ≡ c (mod m).
Equivalence Relations
![Page 47: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/47.jpg)
Example 3: Let R be a relation on Z defined as follows: a R b if and only if 5 | (a2 – b2).
Show that R is an equivalence relation. R is reflexive: a2 – a2 = 0 = 0×5 5 | (a2 – a2) a R a.
R is symmetric: If a R b 5 | (a2 – b2) a2 – b2 = m×5, m Z b2 – a2 = (-m)×5 5 | (b2 – a2) b R a.
R is transitive: Suppose that a R b 5 | (a2 – b2) a2 – b2 = m×5, m Z and b R c 5 | (b2 – c2) b2 – c2 = k×5, k Z . Now (a2 – b2) + (b2 – c2) = (a2 – c2) =(m + k)×5 5 | (a2 – c2) a R c.
Equivalence Relations
![Page 48: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/48.jpg)
Equivalence Classes
• 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.
• The equivalence class of a with respect to R is denoted by [a]R . When only one relation is under consideration, we can delete the subscript R and write [a] for this equivalence class.
[a]R = {s | (a, s) R }.
![Page 49: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/49.jpg)
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 ≡ 0 (mod 4). The integers in this class are those divisible by 4. Hence, the equivalence class of 0 for this relation is
[0] = { . . . , -8, -4, 0, 4, 8 , . . . } . The equivalence class of 1 contains all the integers a
such that a ≡ 1 (mod 4). The integers in this class are those that have a remainder of 1 when divided by 4. Hence, the equivalence class of 1 for this relation is
[1] = { . . . , -7, -3, 1, 5, 9, . . . } .
Equivalence Classes
![Page 50: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/50.jpg)
Equivalence Classes and Partitions
• A partition of a set S is a collection of disjoint nonempty subsets of S that have S as their union. In other words, the collection of subsets Ai , i I (where I is an index set) forms a partition of S if and only if
![Page 51: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/51.jpg)
Example: What are the sets in the partition of the integers arising from congruence modulo 4?
Solution: There are four congruence classes, corresponding to [0]4, [1]4, [2]4, and [3]4 . They are the sets
[0]4 = { . . . , -8, -4, 0, 4, 8, . . . } ,
[1]4 = { . . . , -7, -3, 1, 5, 9, . . . } ,
[2]4 = { . . . , -6, -2, 2, 6, 10, . . . } ,
[3]4 = { . . . , -5, -1, 3, 7, 11, . . . } .
These congruence classes are disjoint, and every integer is in exactly one of them. In other words, these congruence classes form a partition.
Equivalence Classes and Partitions
![Page 52: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/52.jpg)
8.6 Partial Orderings
• A relation R on a set S is called a partial ordering or partial order if it is reflexive, antisymmetric, and transitive.
• A set S together with a partial ordering R is called a partially ordered set, or poset, and is denoted by (S, R). Members of S are called elements of the poset.
![Page 53: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/53.jpg)
Example 1
Show that the "greater than or equal" relation ( ) is a partial ordering on the set of integers.Solution:•a ≥ a for every integer a, ≥ is reflexive.•If a ≥ b and b ≥ a, then a = b. Hence, ≥ is antisymmetric. •Finally, ≥ is transitive because a ≥ b and b ≥ c imply that a ≥ c.It follows that ≥ is a partial ordering on the set of integers and (Z, ≥) is a poset.
![Page 54: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/54.jpg)
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.
![Page 55: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/55.jpg)
The elements a and b of a poset (S, ) are called comparable if either a b or b a . When a and b are elements of S such that neither a b nor b a, a and b are called incomparable.
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.
Definition
![Page 56: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/56.jpg)
If (S, ) is a poset and every two elements of S are comparable, S is called a totally ordered or linearly ordered set, and is called a total order or a linear order. A totally ordered set is also called a chain.
Example 1: The poset (Z, ≤) is totally ordered, because a ≤ b or b ≤ a whenever a and b are integers.
Example 2: The poset (Z+, |) is not totally ordered because it contains elements that are incomparable, such as 5 and 7.
Definition
![Page 57: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/57.jpg)
Hasse Diagrams
We can represent a partial ordering on a finite set using this procedure:
• Start with the directed graph for this relation. Because a partial ordering is reflexive, a loop is present at every vertex. Remove these loops.
• Remove all edges that must be in the partial ordering because of the presence of other edges and transitivity. For instance, if (a, b) and (b, c) are in the partial ordering, remove the edge (a, c), because it must be present also. Furthermore, if (c, d) is also in the partial ordering, remove the edge (a, d), because it must be present also.
• Finally, arrange each edge so that its initial vertex is below its terminal vertex (as it is drawn on paper). Remove all the arrows on the directed edges, because all edges point "upward" toward their terminal vertex. (The edges left correspond to pairs in the covering relation of the poset.
![Page 58: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/58.jpg)
Example 1
Constructing the Hasse Diagram for ({ 1, 2, 3, 4 }, ≤).
![Page 59: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/59.jpg)
Example 1
Let A = {a, b, c}. Constructing the Hasse Diagram for (P(A), ).
P(A) = {, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}
{a} {c}{b}
{a, b}{a, c} {b, c}
{a, b, c}
![Page 60: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/60.jpg)
Maximal and Minimal Elements
• Elements of posets that have certain extremal properties are important for many applications.
• An element of a poset is called maximal if it is not less than any element of the poset. That is, a is maximal in the poset (S, ) if there is no b S such that a b. Similarly, an element of a poset is called minimal if it is not greater than any element of the poset. That is, a is minimal if there is no element b S such that b a. Maximal and minimal elements are easy to spot using a Hasse diagram. They are the "top" and "bottom" elements in the diagram.
![Page 61: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/61.jpg)
Which elements of the Poset ({2, 4, 5 ,10, 12 , 20, 25 } , | ) are maximal, and which are minimal?
Solution: Maximal elements are 12, 20 and 25.Minimal elements are 2 and 5.
The Hasse Diagram of the Poset.This example shows that a poset can have more than
one maximal element and more than one minimal element.
Example
![Page 62: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/62.jpg)
Greatest Element and Least Element
• We say that a is the greatest element of the poset (S, ) if b a for all b S.
The greatest element is unique when it exists.
• Also, a is siad the least element of the poset (S, ) if a b for all b S . The least element is unique when it exists.
![Page 63: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/63.jpg)
Determine whether the posets represented by each of the Hasse diagrams in the Figure have a greatest element and/or a least element.
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.
Example
![Page 64: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/64.jpg)
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.
Example
![Page 65: Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A](https://reader036.vdocuments.us/reader036/viewer/2022062223/5a4d1b0b7f8b9ab05998b1f9/html5/thumbnails/65.jpg)
Consider the poset ({2, 4, 5 ,10, 12 , 20, 25 } , | ). Find the lower and upper bounds of A = {2, 4}. Find the glb(A) and lub(A).
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.
The Hasse Diagram of the Poset.
Example