Nguyen An Khuong, Huynh Tuong NguyenContents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks Relation Definition Let
Trang 1Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Trang 2Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Trang 3Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations HomeworksIntroduction
Function?
Trang 4Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Relation
Definition
Let A and B be sets Abinary relation(quan hệ hai ngôi ) from a
set A to a set B is a set
R ⊆ A × B
• Notations:
(a, b) ∈ R ←→ aRb
• n-ary relations:R ⊂ A1× A2× · · · × An
Trang 5Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Example
Example
Let A = {a, b, c} be the set of students, B = {l, c, s, g, d} be the
set of the available optional courses We can have relation R that
consists of pairs (x, y), where x is a student enrolled in course y
R = {(a, l), (a, s), (a, g), (b, c),
Trang 6Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Trang 7Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Trang 8Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Relations on a Set
Definition
Arelation on the set A is a relation from A to A
Example
Let A be the set {1, 2, 3, 4} Which ordered pairs are in the
relation R = {(a, b) | a divides b} (a là ước số của b)?
Trang 9Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Trang 10Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Trang 11Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Trang 12Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Counting the number of all relations on a given set having a
certain property is an extremely important and difficult problem
Trang 13Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Combining Relations
Because relations from A to B are subsetsof A × B, two
relations from A to B can be combined in any way two sets can
Let A and B be the set of all students and the set of all courses at
school, respectively SupposeR1= {(a, b) | a has taken the course
b}andR2= {(a, b) | a requires course b to graduate} What are
the relations R1∪ R2, R1∩ R2, R1⊕ R2, R1− R2, R2− R1?
Trang 14Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Trang 15Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Power of Relations
Definition
Let R be a relation on the set A Thepowers(lũy thừa)
Rn, n = 1, 2, 3, are defined recursively by
Trang 16Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Representing Relations Using Matrices
Definition
Suppose R is a relation from A = {a1, a2, , am} to
B = {b1, b2, , bn}, R can be represented by thematrix
R is relation from A = {1, 2, 3} to B = {1, 2} Let
R = {(2, 1), (3, 1), (3, 2)}, the matrix for R is
Trang 17Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Representing Relations Using Digraphs
Definition
Suppose R is a relation in A = {a1, a2, , am}, R can be
represented by thedigraph(đồ thị có hướng ) G = (V, E), where
V = A(ai, aj) ∈ E if (ai, aj) ∈ R
Trang 18Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Trang 19Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Closure
Definition
Theclosure(bao đóng ) of relationRwith respect toproperty P
is the relation S that
i containsR
ii has property P
iii iscontained in anyrelation satisfying (i) and (ii)
S is the “smallest” relation satisfying (i) & (ii)
Trang 20Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Reflexive Closure
Example
Let R = {(a, b), (a, c), (b, d), (d, c)}
Thereflexive closureof R
{(a, b), (a, c), (b, d), (d, c),(a, a), (b, b), (c, c), (d, d)}
Trang 21Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations HomeworksReflexive Closure
Trang 22Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Symmetric Closure
Example
Let R = {(a, b), (a, c), (b, d), (c, a), (d, e)}
Thesymmetric closureof R
{(a, b), (a, c), (b, d), (c, a), (d, e),(b, a), (d, b), (e, d)}
Trang 23Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations HomeworksSymmetric Closure
Trang 24Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Transitive Closure
Example
Let R = {(a, b), (a, c), (b, d), (d, e)}
Thetransitive closureof R
{(a, b), (a, c), (b, d), (d, e),(a, d), (b, e), (a, e)}
∪∞ n=1Rn
Trang 25Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations HomeworksTransitive Closure
Trang 26Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Equivalence Relations
Definition
A relation on a set A is called an equivalence relation(quan hệ
tương đương ) if it isreflexive,symmetricandtransitive
Example (1)
The relation R = {(a, b)|a and b are in the same provinces} is an
equivalence relation a isequivalentto b and vice versa, denoted
Trang 27Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Example
Example (Congruence Modulo m - Đồng dư modulo m)
Let m be a positive integer with m > 1 Show that the relation
R = {(a, b) | a ≡ b (mod m)}
is an equivalence relation on the set of integers
Remark: This is an extremely important example, please read its
proof carefully and prove all related properties
Trang 28Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Equivalence Classes
Definition
Let R be an equivalence relationon the set A The set of all
elements that are related to an element a of A is called the
equivalence class (lớp tương đương ) of a, denoted by
[a]R= {s | (a, s) ∈ R}
Example
The equivalence class of “Thủ Đức” for the equivalence relation “in
the same provinces” is { “Thủ Đức”, “Gò Vấp”, “Bình Thạnh”,
“Quận 10”, .}
Trang 29Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Trang 30Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Equivalence Relations and Partitions
Theorem
Let R be an equivalence relation on a set A These statements for
elements a and b of A are equivalent:
i aRb
ii [a] = [b]
iii [a] ∩ [b] 6= ∅
Trang 31Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Example 1
Example
Suppose that S = {1, 2, 3, 4, 5, 6} The collection of sets
A1= {1, 2, 3}, A2= {4, 5}, and A3= {6} forms a partition of S,
because these sets are disjoint and their union is S
Trang 32Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Example 2
Example
Divides set of all cities and towns
in Vietnam into set of 64provinces We know that:
• there are no provinces with
Trang 33Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Relation in a Partition
• We divided based onrelation
R = {(a, b)|a and b are in the same provinces}
• “Thủ Đức” is related(equivalent) to “Gò Vấp”
• “Đà Lạt” isnotrelated (notequivalent) to ”Long Xuyên”
Trang 34Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Partial Order Relations
• Order words such that x comes before y in the dictionary
• Schedule projects such that x must be completed before y
• Order set of integers, where x < y
Definition
A relation R on a set S is called apartial ordering(có thứ tự bộ
phận) if it isreflexive,antisymmetricandtransitive A set S
together with a partial ordering R is called a partially ordered set,
orposet(tập có thứ tự bộ phận), and is denoted by (S, R) or
Trang 35Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations HomeworksExample
Trang 36Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Totally Order Relations
Example
In the poset (Z+, |), 3 and 9 arecomparable(so sánh được),
because 3 | 9, but 5 and 7 are not, because 5 - 7 and 7 - 5
→ That’s why we call it partiallyordering
Definition
If (S, 4) is a poset and every two elements of S are comparable, S
is called atotally ordered(có thứ tự toàn phần) A totally
ordered set is also called a chain(dây xích)
Example
The poset (Z, ≤) is totally ordered
Trang 37Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Maximal & Minimal Elements
Trang 38Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Greatest Element& Least Element
Let S be a set In the poset (P (S), ⊆), the least element is ∅ and
the greatest element is S
Trang 39Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Upper Bound & Lower Bound
Definition
Let A ⊆ (S, 4)
• If u is an element of S such that a 4 u for all elements
a ∈ A, then u is called anupper bound (cận trên) of A
• If l is an element of S such that l 4 a for all elements a ∈ A,
then l is called alower bound(cận dưới ) of A
Example
• Subset A doesnothaveupper bound and lowerbound
• The upper bound of B are
20, 40 and the lower bound
is 2
Trang 40Nguyen An Khuong, Huynh Tuong Nguyen
Contents Properties of Relations Combining Relations Representing Relations Closures of Relations Types of Relations Homeworks
Problems
I Do as much as possible the Problems in Rosen’s Chapter 9
(7th ed.) and related Problems in Bender and Williamson’s
book
II Solve all Exercises in the exercises set provided