Unit 3 Reference Material PDF
Unit 3 Reference Material PDF
𝑚ڂ
𝑖=1 𝐴_𝑖 = 𝑆
The set A is called a covering of S and the sets A_1, A_2,…, A_m are
said to cover S.
• If, in addition, the elements of A, which are subsets of S, are mutually
disjoint, then A is called a partition of S, and the sets A_1, A_2,…,A_m
are called the blocks of the partition.
• Two partitions are said to be equal if they are equal as sets.
• For a finite set, every partition is a finite partition i.e., every partition
contains only a finite number of blocks.
Equivalence Relations
• A relation on a set A is called an equivalence relation if it is reflexive,
symmetric, and transitive.
• Two elements a and b that are related by an equivalence relation are
called equivalent.
• The notation a ∼ b is often used to denote that a and b are equivalent
elements with respect to a particular equivalence relation.
• Congruence Modulo m
• Let m be an integer with m > 1.
• Show that the relation R = {(a, b) | a ≡ b (mod m)} is an equivalence
relation on the set of integers.
• Solution:
• a ≡ b (mod m) if and only if m divides a − b.
• a − a = 0 is divisible by m, because 0 = 0 · m.
• Hence, a ≡ a (mod m), so congruence modulo m is reflexive.
• Now suppose that a ≡ b (mod m).
• Then a − b is divisible by m, so a − b = km, where k is an integer.
• It follows that b − a = (−k)m, so b ≡ a (mod m).
• Hence, congruence modulo m is symmetric.
• Suppose that a ≡ b (mod m) and b ≡ c (mod m).
• Then m divides both a − b and b − c.
• Therefore, there are integers k and l with a − b = km and b − c = lm.
• Adding these two equations shows that
• a − c = (a − b) + (b − c) = km + lm = (k + l)m.
• Thus, a ≡ c (mod m).
• Therefore, congruence modulo m is transitive.
• Therefore, Congruence modulo m is an equivalence relation.
• 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,...}.
• 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.
• [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,...}.
Compatibility Relations
• A relation R in X is said to be a compatibility relation if it is reflexive
and symmetric.
• All equivalence relations are compatibility relations.
Maximal Compatibility Block
• Let X be a set and ≈ a compatibility relation on X. A subset A ⊆ X is
called a maximal compatibility block if any element of A is compatible
to every other element of A and no element of X - A is compatible to
all the elements of A.
Composition of Binary Relations
• Let R be a relation from X to Y and S be a relation from Y to Z. Then a
relation written as R∘ 𝑆 is called a composite relation of R and S
where
• R∘ 𝑆 = {(x,z)|x∈ 𝑋 ∧ z ∈ 𝑋 ∧ (∃y)(y∈ 𝑌 ∧ (x,y) ∈ R ∧ (y,z) ∈ Z}
• The operation of obtaining R∘ 𝑆 from R and S is called composition of
relations.
Closures of Relations
• A computer network has data centers in Boston, Chicago, Denver,
Detroit, New York, and San Diego.
• There are direct, one-way telephone lines from Boston to Chicago,
from Boston to Detroit, from Chicago to Detroit, from Detroit to
Denver, and from New York to San Diego.
• Let R be the relation containing (a, b) if there is a telephone line from
the data center in a to that in b.
• How can we determine if there is some (possibly indirect) link
composed of one or more telephone lines from one center to
another?
• Because not all links are direct, such as the link from Boston to
Denver that goes through Detroit, R cannot be used directly to
answer this.
• In the language of relations, R is not transitive, so it does not contain
all the pairs that can be linked.
• We can find all pairs of data centers that have a link by constructing a
transitive relation S containing R such that S is a subset of every
transitive relation containing R.
• Here, S is the smallest transitive relation that contains R.
• This relation is called the transitive closure of R.
• Let R be a relation on a set A.
• R may or may not have some property P, such as reflexivity, symmetry,
or transitivity.
• If there is a relation S with property P containing R such that S is a
subset of every relation with property P containing R, then S is called
the closure of R with respect to P.
• The relation R = {(1, 1), (1, 2), (2, 1), (3, 2)} on the set A = {1, 2, 3} is
not reflexive.
• How can we produce a reflexive relation containing R that is as small
as possible?
• Add (2, 2) and (3, 3) to R, because these are the only pairs of the form
(a, a) that are not in R.
• The new relation contains R.
• Because this relation contains R, is reflexive, and is contained within
every reflexive relation that contains R, it is called the reflexive
closure of R.
Example
• What is the reflexive closure of the relation R = {(a, b) | a<b} on the
set of integers?
• Solution: The reflexive closure of R is
• R ∪ ∆ = { (a, b) | a<b } ∪ { (a, a) | a ∈ Z } = { (a, b) | a ≤ b}.
• The relation {(1, 1), (1, 2), (2, 2), (2, 3), (3, 1), (3, 2)} on {1, 2, 3} is not
symmetric.
• How can we produce a symmetric relation that is as small as possible
and contains R?
• To do this, we need only add (2, 1) and (1, 3), because these are the
only pairs of the form (b, a) with (a, b) ∈ R that are not in R.
• This new relation is symmetric and contains R.
• Any symmetric relation that contains R must contain this new relation
because symmetric relation that contains R must contain (2, 1) and (1,
3).
• Consequently, this new relation is called the symmetric closure of R
Example
• What is the symmetric closure of the relation R = {(a, b) | a>b} on the set of
positive integers?
• This last equality follows because R contains all ordered pairs of positive
integers where the first element is greater than the second element and
R−1 contains all ordered pairs of positive integers where the first element is
less than the second.
• Suppose that a relation R is not transitive.
• How can we produce a transitive relation that contains R such that
this new relation is contained within any transitive relation that
contains R?
• Can the transitive closure of a relation R be produced by adding all
the pairs of the form (a, c), where (a, b) and (b, c) are already in the
relation?
• Consider a relation R = {(1, 3), (1, 4), (2, 1), (3, 2)} on the set {1, 2, 3,
4}.
• This relation is not transitive because it does not contain all pairs of
the form (a, c) where (a, b) and (b, c) are in R.
• The pairs of this form not in R are (1, 2), (2, 3), (2, 4), and (3, 1).
• Adding these pairs does not produce a transitive relation, because the
resulting relation contains (3, 1) and (1, 4) but does not contain (3, 4).
• This shows that constructing the transitive closure of a relation is
more complicated than constructing either the reflexive or symmetric
closure.
Path in Directed Edges
• A path from a to b in the directed graph G is a sequence of edges (x0,
x1), (x1, x2), (x2, x3), . . . , (xn−1, xn) in G, where n is a non-negative
integer, and x0 = a and xn = b, that is, a sequence of edges where the
terminal vertex of an edge is the same as the initial vertex in the next
edge in the path. This path is denoted by x0, x1, x2,...,xn−1, xn and
has length n.
• A path of length n ≥ 1 that begins and ends at the same vertex is
called a circuit or cycle.
• a, b, e, d; path, length 3.
• a, e, c, d, b; not a path.
• b, a, c, b, a, a, b; path, length 6.
• d,c; path , length 1 ((d,c) edge).
• c, b, a; path, length 2.
• e, b, a, b, a, b, e, path, length 6.
• Circuits
• b, a, c, b, a, a, b
• e, b, a, b, a, b, e
• because they begin and end at the same
vertex.
Transitive Closure
• Let R be a relation on a set A. The connectivity relation R∗ consists of
the pairs (a, b) such that there is a path of length at least one from a
to b in R.
• The transitive closure of a relation R equals the connectivity relation
R∗.
• The transitive closure of R is the union of R, R2, R3,..., and Rn.
• R∗ = R ∪ R2 ∪ R3 ∪···∪ Rn
• Let MR be the zero-one matrix of the relation R on a set with n
elements. Then the zero-one matrix of the transitive closure R∗ is MR∗
= MR ∨ MR[2] ∨ MR[3] ∨···∨ MR[n] .
Warshall’s Algorithm
• procedure Warshall (MR : n × n zero–one matrix)
• W : = MR
• for k : = 1 to n
• for i : = 1 to n
• for j : = 1 to n
• wij : = wij ∨ (wik ∧ wkj )