You are on page 1of 281

Discrete Mathematics 2

Chapter 8: Relations

Department of Mathematics
The FPT university

TrungDT (FUHN) MAD121 Chapter 8 1/1


Course Introduction

TrungDT (FUHN) MAD121 Chapter 8 2/1


Course Introduction

Course name: Discrete Mathematics 2 — MAD121

TrungDT (FUHN) MAD121 Chapter 8 2/1


Course Introduction

Course name: Discrete Mathematics 2 — MAD121

Textbook: Discrete Mathematics and Its Applications, K. Rosen

TrungDT (FUHN) MAD121 Chapter 8 2/1


Course Introduction

Course name: Discrete Mathematics 2 — MAD121

Textbook: Discrete Mathematics and Its Applications, K. Rosen

Topics covered:

TrungDT (FUHN) MAD121 Chapter 8 2/1


Course Introduction

Course name: Discrete Mathematics 2 — MAD121

Textbook: Discrete Mathematics and Its Applications, K. Rosen

Topics covered:

Chapter 8: Relations

TrungDT (FUHN) MAD121 Chapter 8 2/1


Course Introduction

Course name: Discrete Mathematics 2 — MAD121

Textbook: Discrete Mathematics and Its Applications, K. Rosen

Topics covered:

Chapter 8: Relations
Chapter 9: Graphs

TrungDT (FUHN) MAD121 Chapter 8 2/1


Course Introduction

Course name: Discrete Mathematics 2 — MAD121

Textbook: Discrete Mathematics and Its Applications, K. Rosen

Topics covered:

Chapter 8: Relations
Chapter 9: Graphs
Chapter 10: Trees

TrungDT (FUHN) MAD121 Chapter 8 2/1


Course Introduction

Course name: Discrete Mathematics 2 — MAD121

Textbook: Discrete Mathematics and Its Applications, K. Rosen

Topics covered:

Chapter 8: Relations
Chapter 9: Graphs
Chapter 10: Trees
Chapter 11: Boolean Algebra

TrungDT (FUHN) MAD121 Chapter 8 2/1


Course Introduction

Course name: Discrete Mathematics 2 — MAD121

Textbook: Discrete Mathematics and Its Applications, K. Rosen

Topics covered:

Chapter 8: Relations
Chapter 9: Graphs
Chapter 10: Trees
Chapter 11: Boolean Algebra
Chapter 12: Modeling Computation

TrungDT (FUHN) MAD121 Chapter 8 2/1


Chapter 8: Introduction

TrungDT (FUHN) MAD121 Chapter 8 3/1


Chapter 8: Introduction

Topics covered:

TrungDT (FUHN) MAD121 Chapter 8 3/1


Chapter 8: Introduction

Topics covered:

8.1 Relations and Their Properties

TrungDT (FUHN) MAD121 Chapter 8 3/1


Chapter 8: Introduction

Topics covered:

8.1 Relations and Their Properties


8.2 n-ary Relations and Their Applications

TrungDT (FUHN) MAD121 Chapter 8 3/1


Chapter 8: Introduction

Topics covered:

8.1 Relations and Their Properties


8.2 n-ary Relations and Their Applications
8.3 Representing Relations

TrungDT (FUHN) MAD121 Chapter 8 3/1


Chapter 8: Introduction

Topics covered:

8.1 Relations and Their Properties


8.2 n-ary Relations and Their Applications
8.3 Representing Relations
8.4 Closures of Relations

TrungDT (FUHN) MAD121 Chapter 8 3/1


Chapter 8: Introduction

Topics covered:

8.1 Relations and Their Properties


8.2 n-ary Relations and Their Applications
8.3 Representing Relations
8.4 Closures of Relations
8.5 Equivalence Relations

TrungDT (FUHN) MAD121 Chapter 8 3/1


8.1 Relations and Their Properties

TrungDT (FUHN) MAD121 Chapter 8 4/1


8.1 Relations and Their Properties
A={Berlin, Seoul, Tokyo, Kyoto, New York, Hue}

B={Japan, Korea, USA, France, Vietnam, Germany}

TrungDT (FUHN) MAD121 Chapter 8 4/1


8.1 Relations and Their Properties
A={Berlin, Seoul, Tokyo, Kyoto, New York, Hue}

B={Japan, Korea, USA, France, Vietnam, Germany}

Which cities belong to which countries?

TrungDT (FUHN) MAD121 Chapter 8 4/1


8.1 Relations and Their Properties
A={Berlin, Seoul, Tokyo, Kyoto, New York, Hue}

B={Japan, Korea, USA, France, Vietnam, Germany}

Which cities belong to which countries?

TrungDT (FUHN) MAD121 Chapter 8 4/1


8.1 Relations and Their Properties
A={Berlin, Seoul, Tokyo, Kyoto, New York, Hue}

B={Japan, Korea, USA, France, Vietnam, Germany}

Which cities belong to which countries?

TrungDT (FUHN) MAD121 Chapter 8 4/1


TrungDT (FUHN) MAD121 Chapter 8 5/1
Which cities are capitals?

TrungDT (FUHN) MAD121 Chapter 8 5/1


Which cities are capitals?

TrungDT (FUHN) MAD121 Chapter 8 5/1


Which cities are capitals?

TrungDT (FUHN) MAD121 Chapter 8 5/1


Which cities are capitals?

Which cities are former capitals?

TrungDT (FUHN) MAD121 Chapter 8 5/1


Which cities are capitals?

Which cities are former capitals?


(Hue, Vietnam), (Kyoto, Japan)
TrungDT (FUHN) MAD121 Chapter 8 5/1
TrungDT (FUHN) MAD121 Chapter 8 6/1
TrungDT (FUHN) MAD121 Chapter 8 6/1
TrungDT (FUHN) MAD121 Chapter 8 6/1
Let A and B be two sets.

TrungDT (FUHN) MAD121 Chapter 8 6/1


Let A and B be two sets. A binary relation R from A to B is a subset
of the Cartesian product A × B

TrungDT (FUHN) MAD121 Chapter 8 6/1


Let A and B be two sets. A binary relation R from A to B is a subset
of the Cartesian product A × B
If (a, b) ∈ R we say a is related to b by R, and write a R b.
TrungDT (FUHN) MAD121 Chapter 8 6/1
Let A and B be two sets. A binary relation R from A to B is a subset
of the Cartesian product A × B
If (a, b) ∈ R we say a is related to b by R, and write a R b.
TrungDT (FUHN) MAD121 Chapter 8 6/1
Combining Relations

TrungDT (FUHN) MAD121 Chapter 8 7/1


Combining Relations
Let R and S be relations from A to B.

TrungDT (FUHN) MAD121 Chapter 8 7/1


Combining Relations
Let R and S be relations from A to B.

R ∪ S = Union relation of R and S

TrungDT (FUHN) MAD121 Chapter 8 7/1


Combining Relations
Let R and S be relations from A to B.

R ∪ S = Union relation of R and S


R ∩ S = Intersection relation of R and S

TrungDT (FUHN) MAD121 Chapter 8 7/1


Combining Relations
Let R and S be relations from A to B.

R ∪ S = Union relation of R and S


R ∩ S = Intersection relation of R and S
R ⊕ S = Exclusive or relation of R and S

TrungDT (FUHN) MAD121 Chapter 8 7/1


Combining Relations
Let R and S be relations from A to B.

R ∪ S = Union relation of R and S


R ∩ S = Intersection relation of R and S
R ⊕ S = Exclusive or relation of R and S
R − S = Difference relation of R and S

TrungDT (FUHN) MAD121 Chapter 8 7/1


Combining Relations
Let R and S be relations from A to B.

R ∪ S = Union relation of R and S


R ∩ S = Intersection relation of R and S
R ⊕ S = Exclusive or relation of R and S
R − S = Difference relation of R and S
R = Complementary relation of R (in A × B)

TrungDT (FUHN) MAD121 Chapter 8 7/1


Combining Relations
Let R and S be relations from A to B.

R ∪ S = Union relation of R and S


R ∩ S = Intersection relation of R and S
R ⊕ S = Exclusive or relation of R and S
R − S = Difference relation of R and S
R = Complementary relation of R (in A × B)
R −1 = Inverse relation of R, which consists of all pairs (b, a) where
(a, b) ∈ R

TrungDT (FUHN) MAD121 Chapter 8 7/1


Combining Relations
Let R and S be relations from A to B.

R ∪ S = Union relation of R and S


R ∩ S = Intersection relation of R and S
R ⊕ S = Exclusive or relation of R and S
R − S = Difference relation of R and S
R = Complementary relation of R (in A × B)
R −1 = Inverse relation of R, which consists of all pairs (b, a) where
(a, b) ∈ R
Composite of two relations:

TrungDT (FUHN) MAD121 Chapter 8 7/1


Combining Relations
Let R and S be relations from A to B.

R ∪ S = Union relation of R and S


R ∩ S = Intersection relation of R and S
R ⊕ S = Exclusive or relation of R and S
R − S = Difference relation of R and S
R = Complementary relation of R (in A × B)
R −1 = Inverse relation of R, which consists of all pairs (b, a) where
(a, b) ∈ R
Composite of two relations: Let R and S be relations

TrungDT (FUHN) MAD121 Chapter 8 7/1


Combining Relations
Let R and S be relations from A to B.

R ∪ S = Union relation of R and S


R ∩ S = Intersection relation of R and S
R ⊕ S = Exclusive or relation of R and S
R − S = Difference relation of R and S
R = Complementary relation of R (in A × B)
R −1 = Inverse relation of R, which consists of all pairs (b, a) where
(a, b) ∈ R
Composite of two relations: Let R and S be relations
R S
A −→ B −→ C

TrungDT (FUHN) MAD121 Chapter 8 7/1


Combining Relations
Let R and S be relations from A to B.

R ∪ S = Union relation of R and S


R ∩ S = Intersection relation of R and S
R ⊕ S = Exclusive or relation of R and S
R − S = Difference relation of R and S
R = Complementary relation of R (in A × B)
R −1 = Inverse relation of R, which consists of all pairs (b, a) where
(a, b) ∈ R
Composite of two relations: Let R and S be relations
R S
A −→ B −→ C

The composition S ◦ R is the set of al pairs (a, c) such that there


exists b ∈ B with (a, b) ∈ R and (b, c) ∈ S.
TrungDT (FUHN) MAD121 Chapter 8 7/1
Properties of Relations

TrungDT (FUHN) MAD121 Chapter 8 8/1


Properties of Relations

Let A be a set. A relation from A to A is called a relation on A.

TrungDT (FUHN) MAD121 Chapter 8 8/1


Properties of Relations

Let A be a set. A relation from A to A is called a relation on A.

Let R be a relation on A.

TrungDT (FUHN) MAD121 Chapter 8 8/1


Properties of Relations

Let A be a set. A relation from A to A is called a relation on A.

Let R be a relation on A.

R is called reflexive if R contains all pairs (a, a) where a ∈ A.

TrungDT (FUHN) MAD121 Chapter 8 8/1


Properties of Relations

Let A be a set. A relation from A to A is called a relation on A.

Let R be a relation on A.

R is called reflexive if R contains all pairs (a, a) where a ∈ A. In other


words, R is reflexive on A if every element in A is related to itself by
R.

TrungDT (FUHN) MAD121 Chapter 8 8/1


Properties of Relations

Let A be a set. A relation from A to A is called a relation on A.

Let R be a relation on A.

R is called reflexive if R contains all pairs (a, a) where a ∈ A. In other


words, R is reflexive on A if every element in A is related to itself by
R.
R is called symmetric if whenever (a, b) ∈ R then (b, a) ∈ R.

TrungDT (FUHN) MAD121 Chapter 8 8/1


Properties of Relations

Let A be a set. A relation from A to A is called a relation on A.

Let R be a relation on A.

R is called reflexive if R contains all pairs (a, a) where a ∈ A. In other


words, R is reflexive on A if every element in A is related to itself by
R.
R is called symmetric if whenever (a, b) ∈ R then (b, a) ∈ R.
R is called antisymmetric if there do not exist a 6= b such that both
(a, b) and (b, a) are in R.

TrungDT (FUHN) MAD121 Chapter 8 8/1


Properties of Relations

Let A be a set. A relation from A to A is called a relation on A.

Let R be a relation on A.

R is called reflexive if R contains all pairs (a, a) where a ∈ A. In other


words, R is reflexive on A if every element in A is related to itself by
R.
R is called symmetric if whenever (a, b) ∈ R then (b, a) ∈ R.
R is called antisymmetric if there do not exist a 6= b such that both
(a, b) and (b, a) are in R.
R is called transitive if whenever (a, b) ∈ R and (b, c) ∈ R then
(a, c) ∈ R.

TrungDT (FUHN) MAD121 Chapter 8 8/1


TrungDT (FUHN) MAD121 Chapter 8 9/1
Example.

TrungDT (FUHN) MAD121 Chapter 8 9/1


Example. Check if the following relations are reflexive, symmetric,
antisymmetric and transitive

TrungDT (FUHN) MAD121 Chapter 8 9/1


Example. Check if the following relations are reflexive, symmetric,
antisymmetric and transitive

(1) R = set of pairs of students in a class that have the same birthday

TrungDT (FUHN) MAD121 Chapter 8 9/1


Example. Check if the following relations are reflexive, symmetric,
antisymmetric and transitive

(1) R = set of pairs of students in a class that have the same birthday
(2) R = set of pairs of two integers (a, b) with a divisible by b

TrungDT (FUHN) MAD121 Chapter 8 9/1


Example. Check if the following relations are reflexive, symmetric,
antisymmetric and transitive

(1) R = set of pairs of students in a class that have the same birthday
(2) R = set of pairs of two integers (a, b) with a divisible by b
(3) R = set of pairs of real numbers (x, y ) with x + y = 0

TrungDT (FUHN) MAD121 Chapter 8 9/1


Example. Check if the following relations are reflexive, symmetric,
antisymmetric and transitive

(1) R = set of pairs of students in a class that have the same birthday
(2) R = set of pairs of two integers (a, b) with a divisible by b
(3) R = set of pairs of real numbers (x, y ) with x + y = 0
(4) R = set of pairs of negative numbers (a, b) with a > 2b

TrungDT (FUHN) MAD121 Chapter 8 9/1


Example. Check if the following relations are reflexive, symmetric,
antisymmetric and transitive

(1) R = set of pairs of students in a class that have the same birthday
(2) R = set of pairs of two integers (a, b) with a divisible by b
(3) R = set of pairs of real numbers (x, y ) with x + y = 0
(4) R = set of pairs of negative numbers (a, b) with a > 2b

TrungDT (FUHN) MAD121 Chapter 8 9/1


Example. Check if the following relations are reflexive, symmetric,
antisymmetric and transitive

(1) R = set of pairs of students in a class that have the same birthday
(2) R = set of pairs of two integers (a, b) with a divisible by b
(3) R = set of pairs of real numbers (x, y ) with x + y = 0
(4) R = set of pairs of negative numbers (a, b) with a > 2b

TrungDT (FUHN) MAD121 Chapter 8 9/1


TrungDT (FUHN) MAD121 Chapter 8 10 / 1
Note.

TrungDT (FUHN) MAD121 Chapter 8 10 / 1


Note. The relation R is transitive if and only if R 2 ⊆ R.

TrungDT (FUHN) MAD121 Chapter 8 10 / 1


Note. The relation R is transitive if and only if R 2 ⊆ R. (Explain!)

TrungDT (FUHN) MAD121 Chapter 8 10 / 1


Note. The relation R is transitive if and only if R 2 ⊆ R. (Explain!)

TrungDT (FUHN) MAD121 Chapter 8 10 / 1


8.2 n-ary Relations and Their Applications

TrungDT (FUHN) MAD121 Chapter 8 11 / 1


8.2 n-ary Relations and Their Applications

TrungDT (FUHN) MAD121 Chapter 8 11 / 1


8.2 n-ary Relations and Their Applications
An n-ary relation on the sets A1 , A2 , . . . , An is a subset of
A1 × A2 × · · · × An

TrungDT (FUHN) MAD121 Chapter 8 11 / 1


8.2 n-ary Relations and Their Applications
An n-ary relation on the sets A1 , A2 , . . . , An is a subset of
A1 × A2 × · · · × An

Exampe. Given the sets

TrungDT (FUHN) MAD121 Chapter 8 11 / 1


8.2 n-ary Relations and Their Applications
An n-ary relation on the sets A1 , A2 , . . . , An is a subset of
A1 × A2 × · · · × An

Exampe. Given the sets

A1 ={NamNT, TrungTT, HuongNTQ, ThaoNP, HienPQ},


A2 ={00198, 00011, 00345, 00786, 00321, 00546},
A3 ={MAD111, MAA101, MAS291, PFC111, DSA1}
A4 ={3.5, 4.0, 5.7, 8.0, 9.5, 6.4}

TrungDT (FUHN) MAD121 Chapter 8 11 / 1


8.2 n-ary Relations and Their Applications
An n-ary relation on the sets A1 , A2 , . . . , An is a subset of
A1 × A2 × · · · × An

Exampe. Given the sets

A1 ={NamNT, TrungTT, HuongNTQ, ThaoNP, HienPQ},


A2 ={00198, 00011, 00345, 00786, 00321, 00546},
A3 ={MAD111, MAA101, MAS291, PFC111, DSA1}
A4 ={3.5, 4.0, 5.7, 8.0, 9.5, 6.4}

A relation R on these sets can be expressed as a database

TrungDT (FUHN) MAD121 Chapter 8 11 / 1


8.2 n-ary Relations and Their Applications
An n-ary relation on the sets A1 , A2 , . . . , An is a subset of
A1 × A2 × · · · × An

Exampe. Given the sets

A1 ={NamNT, TrungTT, HuongNTQ, ThaoNP, HienPQ},


A2 ={00198, 00011, 00345, 00786, 00321, 00546},
A3 ={MAD111, MAA101, MAS291, PFC111, DSA1}
A4 ={3.5, 4.0, 5.7, 8.0, 9.5, 6.4}

A relation R on these sets can be expressed as a database

Name Code Subject Grade


HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0
TrungDT (FUHN) MAD121 Chapter 8 11 / 1
TrungDT (FUHN) MAD121 Chapter 8 12 / 1
Name Code Subject Grade
HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

TrungDT (FUHN) MAD121 Chapter 8 12 / 1


Name Code Subject Grade
HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

We say R is a relation on 4 domains (Name, Code, Subject and Grade).

TrungDT (FUHN) MAD121 Chapter 8 12 / 1


Name Code Subject Grade
HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

We say R is a relation on 4 domains (Name, Code, Subject and Grade).

An element of this relation is a record consisting of 4 fields.

TrungDT (FUHN) MAD121 Chapter 8 12 / 1


Name Code Subject Grade
HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

We say R is a relation on 4 domains (Name, Code, Subject and Grade).

An element of this relation is a record consisting of 4 fields. For example

(TrungTT, 00786, DSA1, 3.5)

TrungDT (FUHN) MAD121 Chapter 8 12 / 1


Name Code Subject Grade
HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

We say R is a relation on 4 domains (Name, Code, Subject and Grade).

An element of this relation is a record consisting of 4 fields. For example

(TrungTT, 00786, DSA1, 3.5)

TrungDT (FUHN) MAD121 Chapter 8 12 / 1


TrungDT (FUHN) MAD121 Chapter 8 13 / 1
Primary key - Composite key

TrungDT (FUHN) MAD121 Chapter 8 13 / 1


Primary key - Composite key
A domain of an n-ary relation is a primary key if the value from this
domain of the n-tuple determines this n-tuple.

TrungDT (FUHN) MAD121 Chapter 8 13 / 1


Primary key - Composite key
A domain of an n-ary relation is a primary key if the value from this
domain of the n-tuple determines this n-tuple.
A set of domains of an n-ary relation is a composite key if they
determines uniquely n-tuples.

TrungDT (FUHN) MAD121 Chapter 8 13 / 1


Primary key - Composite key
A domain of an n-ary relation is a primary key if the value from this
domain of the n-tuple determines this n-tuple.
A set of domains of an n-ary relation is a composite key if they
determines uniquely n-tuples.

Example.

TrungDT (FUHN) MAD121 Chapter 8 13 / 1


Primary key - Composite key
A domain of an n-ary relation is a primary key if the value from this
domain of the n-tuple determines this n-tuple.
A set of domains of an n-ary relation is a composite key if they
determines uniquely n-tuples.

Example. In the 4-ary relation,

TrungDT (FUHN) MAD121 Chapter 8 13 / 1


Primary key - Composite key
A domain of an n-ary relation is a primary key if the value from this
domain of the n-tuple determines this n-tuple.
A set of domains of an n-ary relation is a composite key if they
determines uniquely n-tuples.

Example. In the 4-ary relation,

Name Code Subject Grade


HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

TrungDT (FUHN) MAD121 Chapter 8 13 / 1


Primary key - Composite key
A domain of an n-ary relation is a primary key if the value from this
domain of the n-tuple determines this n-tuple.
A set of domains of an n-ary relation is a composite key if they
determines uniquely n-tuples.

Example. In the 4-ary relation,

Name Code Subject Grade


HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

Each domain Name or Code can be primary key.

TrungDT (FUHN) MAD121 Chapter 8 13 / 1


Primary key - Composite key
A domain of an n-ary relation is a primary key if the value from this
domain of the n-tuple determines this n-tuple.
A set of domains of an n-ary relation is a composite key if they
determines uniquely n-tuples.

Example. In the 4-ary relation,

Name Code Subject Grade


HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

Each domain Name or Code can be primary key.


Each domain Subject or Grade is not primary key, but together they
form a composite key.

TrungDT (FUHN) MAD121 Chapter 8 13 / 1


Operations on n-ary Relations

TrungDT (FUHN) MAD121 Chapter 8 14 / 1


Operations on n-ary Relations
Selection operator SC .

TrungDT (FUHN) MAD121 Chapter 8 14 / 1


Operations on n-ary Relations
Selection operator SC . Given relation

Name Code Subject Grade


HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

TrungDT (FUHN) MAD121 Chapter 8 14 / 1


Operations on n-ary Relations
Selection operator SC . Given relation

Name Code Subject Grade


HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

If C is the condition (Subject = ”DSA1”) then the selection SC


produces a 4-ary relation with 2 records

TrungDT (FUHN) MAD121 Chapter 8 14 / 1


Operations on n-ary Relations
Selection operator SC . Given relation

Name Code Subject Grade


HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

If C is the condition (Subject = ”DSA1”) then the selection SC


produces a 4-ary relation with 2 records
Name Code Subject Grade
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

TrungDT (FUHN) MAD121 Chapter 8 14 / 1


Operations on n-ary Relations
Selection operator SC . Given relation

Name Code Subject Grade


HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

If C is the condition (Subject = ”DSA1”) then the selection SC


produces a 4-ary relation with 2 records
Name Code Subject Grade
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0
If C is the condition (Subject = ”DSA1”) ∧ (Grade > 5.0) then the
selection SC produces a relation with how many records?

TrungDT (FUHN) MAD121 Chapter 8 14 / 1


TrungDT (FUHN) MAD121 Chapter 8 15 / 1
Projection operator P.

TrungDT (FUHN) MAD121 Chapter 8 15 / 1


Projection operator P. Given the relation

Name Code Subject Gtade


HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

TrungDT (FUHN) MAD121 Chapter 8 15 / 1


Projection operator P. Given the relation

Name Code Subject Gtade


HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

The projection P2,3,4 produces a 3-ary relation with 3 records

TrungDT (FUHN) MAD121 Chapter 8 15 / 1


Projection operator P. Given the relation

Name Code Subject Gtade


HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

The projection P2,3,4 produces a 3-ary relation with 3 records


Code Subject Grade
00345 MAS291 8.0
00786 DSA1 3.5
00321 DSA1 8.0

TrungDT (FUHN) MAD121 Chapter 8 15 / 1


Projection operator P. Given the relation

Name Code Subject Gtade


HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

The projection P2,3,4 produces a 3-ary relation with 3 records


Code Subject Grade
00345 MAS291 8.0
00786 DSA1 3.5
00321 DSA1 8.0
The projection P2,4 on the above relation will produce a relation of
how many domains and how many records?

TrungDT (FUHN) MAD121 Chapter 8 15 / 1


TrungDT (FUHN) MAD121 Chapter 8 16 / 1
Join operator J. Given two relations

TrungDT (FUHN) MAD121 Chapter 8 16 / 1


Join operator J. Given two relations

Name Code Subject


HuongNTQ 00345 MAS291
NamNT 00011 MAD121
TrungTT 00786 DSA1
HienPQ 00321 DSA1

TrungDT (FUHN) MAD121 Chapter 8 16 / 1


Join operator J. Given two relations

Name Code Subject Code Subject Grade


HuongNTQ 00345 MAS291 00345 MAS291 8.0
NamNT 00011 MAD121 00786 DSA1 3.5
TrungTT 00786 DSA1 00546 MAD121 5.7
HienPQ 00321 DSA1 00321 DSA1 8.0

TrungDT (FUHN) MAD121 Chapter 8 16 / 1


Join operator J. Given two relations

Name Code Subject Code Subject Grade


HuongNTQ 00345 MAS291 00345 MAS291 8.0
NamNT 00011 MAD121 00786 DSA1 3.5
TrungTT 00786 DSA1 00546 MAD121 5.7
HienPQ 00321 DSA1 00321 DSA1 8.0

TrungDT (FUHN) MAD121 Chapter 8 16 / 1


Join operator J. Given two relations

Name Code Subject Code Subject Grade


HuongNTQ 00345 MAS291 00345 MAS291 8.0
NamNT 00011 MAD121 00786 DSA1 3.5
TrungTT 00786 DSA1 00546 MAD121 5.7
HienPQ 00321 DSA1 00321 DSA1 8.0

The join operator J2 used on these relations will produce the relation

TrungDT (FUHN) MAD121 Chapter 8 16 / 1


Join operator J. Given two relations

Name Code Subject Code Subject Grade


HuongNTQ 00345 MAS291 00345 MAS291 8.0
NamNT 00011 MAD121 00786 DSA1 3.5
TrungTT 00786 DSA1 00546 MAD121 5.7
HienPQ 00321 DSA1 00321 DSA1 8.0

The join operator J2 used on these relations will produce the relation

Name Code Subject Grade


HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

TrungDT (FUHN) MAD121 Chapter 8 16 / 1


Join operator J. Given two relations

Name Code Subject Code Subject Grade


HuongNTQ 00345 MAS291 00345 MAS291 8.0
NamNT 00011 MAD121 00786 DSA1 3.5
TrungTT 00786 DSA1 00546 MAD121 5.7
HienPQ 00321 DSA1 00321 DSA1 8.0

The join operator J2 used on these relations will produce the relation

Name Code Subject Grade


HuongNTQ 00345 MAS291 8.0
TrungTT 00786 DSA1 3.5
HienPQ 00321 DSA1 8.0

TrungDT (FUHN) MAD121 Chapter 8 16 / 1


8.3 Representing Relations

TrungDT (FUHN) MAD121 Chapter 8 17 / 1


8.3 Representing Relations
Representing Relations Using Directed Graphs.

TrungDT (FUHN) MAD121 Chapter 8 17 / 1


8.3 Representing Relations
Representing Relations Using Directed Graphs.

Let R = {(1, 3), (2, 2), (1, 4), (2, 1), (3, 1)} on A = {1, 2, 3, 4}.

TrungDT (FUHN) MAD121 Chapter 8 17 / 1


8.3 Representing Relations
Representing Relations Using Directed Graphs.

Let R = {(1, 3), (2, 2), (1, 4), (2, 1), (3, 1)} on A = {1, 2, 3, 4}.

We can use digraphs to represent this relation.

TrungDT (FUHN) MAD121 Chapter 8 17 / 1


8.3 Representing Relations
Representing Relations Using Directed Graphs.

Let R = {(1, 3), (2, 2), (1, 4), (2, 1), (3, 1)} on A = {1, 2, 3, 4}.

We can use digraphs to represent this relation.

TrungDT (FUHN) MAD121 Chapter 8 17 / 1


8.3 Representing Relations
Representing Relations Using Directed Graphs.

Let R = {(1, 3), (2, 2), (1, 4), (2, 1), (3, 1)} on A = {1, 2, 3, 4}.

We can use digraphs to represent this relation.

TrungDT (FUHN) MAD121 Chapter 8 17 / 1


TrungDT (FUHN) MAD121 Chapter 8 18 / 1
Question. What are the properties of digraphs representing relations
which are

TrungDT (FUHN) MAD121 Chapter 8 18 / 1


Question. What are the properties of digraphs representing relations
which are

reflexive

TrungDT (FUHN) MAD121 Chapter 8 18 / 1


Question. What are the properties of digraphs representing relations
which are

reflexive
symmetric

TrungDT (FUHN) MAD121 Chapter 8 18 / 1


Question. What are the properties of digraphs representing relations
which are

reflexive
symmetric
antisymmetric

TrungDT (FUHN) MAD121 Chapter 8 18 / 1


Question. What are the properties of digraphs representing relations
which are

reflexive
symmetric
antisymmetric
transitive

TrungDT (FUHN) MAD121 Chapter 8 18 / 1


TrungDT (FUHN) MAD121 Chapter 8 19 / 1
Representing Relations using 0-1 Matrices.

TrungDT (FUHN) MAD121 Chapter 8 19 / 1


Representing Relations using 0-1 Matrices.

Given a relation R on {1, 2, . . . , n}.

TrungDT (FUHN) MAD121 Chapter 8 19 / 1


Representing Relations using 0-1 Matrices.

Given a relation R on {1, 2, . . . , n}. To represent R we use a square matrix


n × n, denoted by MR = [aij ], whose entries are defined as follows:

TrungDT (FUHN) MAD121 Chapter 8 19 / 1


Representing Relations using 0-1 Matrices.

Given a relation R on {1, 2, . . . , n}. To represent R we use a square matrix


n × n, denoted by MR = [aij ], whose entries are defined as follows:

1 if (i, j) ∈ R,
aij =
0 if (i, j) 6∈ R

TrungDT (FUHN) MAD121 Chapter 8 19 / 1


Operations on 0-1 Matrices

TrungDT (FUHN) MAD121 Chapter 8 20 / 1


Operations on 0-1 Matrices

Let A and B be two 0-1 matrices of the same sizes.

TrungDT (FUHN) MAD121 Chapter 8 20 / 1


Operations on 0-1 Matrices

Let A and B be two 0-1 matrices of the same sizes.


 
a11 · · · a1n
 .. .. ..  ,
A = [aij ] =  . . . 
am1 · · · amn

TrungDT (FUHN) MAD121 Chapter 8 20 / 1


Operations on 0-1 Matrices

Let A and B be two 0-1 matrices of the same sizes.


   
a11 · · · a1n b11 ··· b1n
 .. .. ..  , B = [b ] =  .. .. .. 
A = [aij ] =  . . .  ij  . . . 
am1 · · · amn bm1 ··· bmn

TrungDT (FUHN) MAD121 Chapter 8 20 / 1


Operations on 0-1 Matrices

Let A and B be two 0-1 matrices of the same sizes.


   
a11 · · · a1n b11 ··· b1n
 .. .. ..  , B = [b ] =  .. .. .. 
A = [aij ] =  . . .  ij  . . . 
am1 · · · amn bm1 ··· bmn

Then:

TrungDT (FUHN) MAD121 Chapter 8 20 / 1


Operations on 0-1 Matrices

Let A and B be two 0-1 matrices of the same sizes.


   
a11 · · · a1n b11 ··· b1n
 .. .. ..  , B = [b ] =  .. .. .. 
A = [aij ] =  . . .  ij  . . . 
am1 · · · amn bm1 ··· bmn

Then:

A ∧ B = [aij ∧ bij ]

TrungDT (FUHN) MAD121 Chapter 8 20 / 1


Operations on 0-1 Matrices

Let A and B be two 0-1 matrices of the same sizes.


   
a11 · · · a1n b11 ··· b1n
 .. .. ..  , B = [b ] =  .. .. .. 
A = [aij ] =  . . .  ij  . . . 
am1 · · · amn bm1 ··· bmn

Then:

A ∧ B = [aij ∧ bij ]
A ∨ B = [aij ∨ bij ]

TrungDT (FUHN) MAD121 Chapter 8 20 / 1


Operations on 0-1 Matrices

Let A and B be two 0-1 matrices of the same sizes.


   
a11 · · · a1n b11 ··· b1n
 .. .. ..  , B = [b ] =  .. .. .. 
A = [aij ] =  . . .  ij  . . . 
am1 · · · amn bm1 ··· bmn

Then:

A ∧ B = [aij ∧ bij ]
A ∨ B = [aij ∨ bij ]
A ⊕ B = [aij ⊕ bij ]

TrungDT (FUHN) MAD121 Chapter 8 20 / 1


Operations on 0-1 Matrices

Let A and B be two 0-1 matrices of the same sizes.


   
a11 · · · a1n b11 ··· b1n
 .. .. ..  , B = [b ] =  .. .. .. 
A = [aij ] =  . . .  ij  . . . 
am1 · · · amn bm1 ··· bmn

Then:

A ∧ B = [aij ∧ bij ]
A ∨ B = [aij ∨ bij ]
A ⊕ B = [aij ⊕ bij ]
A = [aij ]

TrungDT (FUHN) MAD121 Chapter 8 20 / 1


TrungDT (FUHN) MAD121 Chapter 8 21 / 1
Boolean product A B.

TrungDT (FUHN) MAD121 Chapter 8 21 / 1


Boolean product A B.

If A is a row matrix of size 1 × m and B is a column matrix of size m × 1


then the Boolean product A B is the matrix consisting of only one entry,

TrungDT (FUHN) MAD121 Chapter 8 21 / 1


Boolean product A B.

If A is a row matrix of size 1 × m and B is a column matrix of size m × 1


then the Boolean product A B is the matrix consisting of only one entry,
this entry is 1 if A and B both have at least a 1 at the same position, and
it is 0 otherwise.

TrungDT (FUHN) MAD121 Chapter 8 21 / 1


Boolean product A B.

If A is a row matrix of size 1 × m and B is a column matrix of size m × 1


then the Boolean product A B is the matrix consisting of only one entry,
this entry is 1 if A and B both have at least a 1 at the same position, and
it is 0 otherwise.

Example.

TrungDT (FUHN) MAD121 Chapter 8 21 / 1


Boolean product A B.

If A is a row matrix of size 1 × m and B is a column matrix of size m × 1


then the Boolean product A B is the matrix consisting of only one entry,
this entry is 1 if A and B both have at least a 1 at the same position, and
it is 0 otherwise.

Example.
 
  1
0 1 0 0 =
1

TrungDT (FUHN) MAD121 Chapter 8 21 / 1


Boolean product A B.

If A is a row matrix of size 1 × m and B is a column matrix of size m × 1


then the Boolean product A B is the matrix consisting of only one entry,
this entry is 1 if A and B both have at least a 1 at the same position, and
it is 0 otherwise.

Example.
 
  1  
0 1 0 0 = 0 ,
1

TrungDT (FUHN) MAD121 Chapter 8 21 / 1


Boolean product A B.

If A is a row matrix of size 1 × m and B is a column matrix of size m × 1


then the Boolean product A B is the matrix consisting of only one entry,
this entry is 1 if A and B both have at least a 1 at the same position, and
it is 0 otherwise.

Example.
   
  1     0
0 1 0 0 = 0 , 0 1 0 1 =
1 1

TrungDT (FUHN) MAD121 Chapter 8 21 / 1


Boolean product A B.

If A is a row matrix of size 1 × m and B is a column matrix of size m × 1


then the Boolean product A B is the matrix consisting of only one entry,
this entry is 1 if A and B both have at least a 1 at the same position, and
it is 0 otherwise.

Example.
   
  1     0  
0 1 0 0 = 0 , 0 1 0 1 = 1
1 1

TrungDT (FUHN) MAD121 Chapter 8 21 / 1


Boolean product A B.

If A is a row matrix of size 1 × m and B is a column matrix of size m × 1


then the Boolean product A B is the matrix consisting of only one entry,
this entry is 1 if A and B both have at least a 1 at the same position, and
it is 0 otherwise.

Example.
   
  1     0  
0 1 0 0 = 0 , 0 1 0 1 = 1
1 1

If A is an m × n matrix, B is an n × p matrix, the Boolean product A B


is a 0-1 matrix of size m × p.

TrungDT (FUHN) MAD121 Chapter 8 21 / 1


Boolean product A B.

If A is a row matrix of size 1 × m and B is a column matrix of size m × 1


then the Boolean product A B is the matrix consisting of only one entry,
this entry is 1 if A and B both have at least a 1 at the same position, and
it is 0 otherwise.

Example.
   
  1     0  
0 1 0 0 = 0 , 0 1 0 1 = 1
1 1

If A is an m × n matrix, B is an n × p matrix, the Boolean product A B


is a 0-1 matrix of size m × p. To determine the (i, j)-entry of A B we
perform the Boolean product on the ith row of A and the jth column of B.

TrungDT (FUHN) MAD121 Chapter 8 21 / 1


Boolean product A B.

If A is a row matrix of size 1 × m and B is a column matrix of size m × 1


then the Boolean product A B is the matrix consisting of only one entry,
this entry is 1 if A and B both have at least a 1 at the same position, and
it is 0 otherwise.

Example.
   
  1     0  
0 1 0 0 = 0 , 0 1 0 1 = 1
1 1

If A is an m × n matrix, B is an n × p matrix, the Boolean product A B


is a 0-1 matrix of size m × p. To determine the (i, j)-entry of A B we
perform the Boolean product on the ith row of A and the jth column of B.

Example.

TrungDT (FUHN) MAD121 Chapter 8 21 / 1


Boolean product A B.

If A is a row matrix of size 1 × m and B is a column matrix of size m × 1


then the Boolean product A B is the matrix consisting of only one entry,
this entry is 1 if A and B both have at least a 1 at the same position, and
it is 0 otherwise.

Example.
   
  1     0  
0 1 0 0 = 0 , 0 1 0 1 = 1
1 1

If A is an m × n matrix, B is an n × p matrix, the Boolean product A B


is a 0-1 matrix of size m × p. To determine the (i, j)-entry of A B we
perform the Boolean product on the ith row of A and the jth column of B.
 
  1 1
0 1 0
Example. 0 1 =
1 1 0
1 0
TrungDT (FUHN) MAD121 Chapter 8 21 / 1
Boolean product A B.

If A is a row matrix of size 1 × m and B is a column matrix of size m × 1


then the Boolean product A B is the matrix consisting of only one entry,
this entry is 1 if A and B both have at least a 1 at the same position, and
it is 0 otherwise.

Example.
   
  1     0  
0 1 0 0 = 0 , 0 1 0 1 = 1
1 1

If A is an m × n matrix, B is an n × p matrix, the Boolean product A B


is a 0-1 matrix of size m × p. To determine the (i, j)-entry of A B we
perform the Boolean product on the ith row of A and the jth column of B.
 
  1 1  
0 1 0 0 1
Example. 0 1 =
1 1 0 1 1
1 0
TrungDT (FUHN) MAD121 Chapter 8 21 / 1
TrungDT (FUHN) MAD121 Chapter 8 22 / 1
Let R and S be relations on A with their representing matrices MR and
MS . Then:

TrungDT (FUHN) MAD121 Chapter 8 22 / 1


Let R and S be relations on A with their representing matrices MR and
MS . Then:

MR∪S = MR ∨ MS

TrungDT (FUHN) MAD121 Chapter 8 22 / 1


Let R and S be relations on A with their representing matrices MR and
MS . Then:

MR∪S = MR ∨ MS
MR∩S = MR ∧ MS

TrungDT (FUHN) MAD121 Chapter 8 22 / 1


Let R and S be relations on A with their representing matrices MR and
MS . Then:

MR∪S = MR ∨ MS
MR∩S = MR ∧ MS
MR⊕S = MR ⊕ MS

TrungDT (FUHN) MAD121 Chapter 8 22 / 1


Let R and S be relations on A with their representing matrices MR and
MS . Then:

MR∪S = MR ∨ MS
MR∩S = MR ∧ MS
MR⊕S = MR ⊕ MS
MR = MR

TrungDT (FUHN) MAD121 Chapter 8 22 / 1


Let R and S be relations on A with their representing matrices MR and
MS . Then:

MR∪S = MR ∨ MS
MR∩S = MR ∧ MS
MR⊕S = MR ⊕ MS
MR = MR
MR −1 = (MR )T

TrungDT (FUHN) MAD121 Chapter 8 22 / 1


Let R and S be relations on A with their representing matrices MR and
MS . Then:

MR∪S = MR ∨ MS
MR∩S = MR ∧ MS
MR⊕S = MR ⊕ MS
MR = MR
MR −1 = (MR )T
MS◦R = MR MS

TrungDT (FUHN) MAD121 Chapter 8 22 / 1


Let R and S be relations on A with their representing matrices MR and
MS . Then:

MR∪S = MR ∨ MS
MR∩S = MR ∧ MS
MR⊕S = MR ⊕ MS
MR = MR
MR −1 = (MR )T
MS◦R = MR MS
[n]
MR n = MR MR · · · MR =: MR

TrungDT (FUHN) MAD121 Chapter 8 22 / 1


Let R and S be relations on A with their representing matrices MR and
MS . Then:

MR∪S = MR ∨ MS
MR∩S = MR ∧ MS
MR⊕S = MR ⊕ MS
MR = MR
MR −1 = (MR )T
MS◦R = MR MS
[n]
MR n = MR MR · · · MR =: MR

TrungDT (FUHN) MAD121 Chapter 8 22 / 1


TrungDT (FUHN) MAD121 Chapter 8 23 / 1
Question 1. What are the properties of the representing matrix of a
relation which is:

TrungDT (FUHN) MAD121 Chapter 8 23 / 1


Question 1. What are the properties of the representing matrix of a
relation which is:

reflexive

TrungDT (FUHN) MAD121 Chapter 8 23 / 1


Question 1. What are the properties of the representing matrix of a
relation which is:

reflexive
symmetric

TrungDT (FUHN) MAD121 Chapter 8 23 / 1


Question 1. What are the properties of the representing matrix of a
relation which is:

reflexive
symmetric
antisymmetric

TrungDT (FUHN) MAD121 Chapter 8 23 / 1


Question 1. What are the properties of the representing matrix of a
relation which is:

reflexive
symmetric
antisymmetric
transitive

TrungDT (FUHN) MAD121 Chapter 8 23 / 1


Question 1. What are the properties of the representing matrix of a
relation which is:

reflexive
symmetric
antisymmetric
transitive

Question 2. Which properties: reflexive, symmetric, antisymmetric, or


transitive that are possessed by the relation represented by the following
matrix:

TrungDT (FUHN) MAD121 Chapter 8 23 / 1


Question 1. What are the properties of the representing matrix of a
relation which is:

reflexive
symmetric
antisymmetric
transitive

Question 2. Which properties: reflexive, symmetric, antisymmetric, or


transitive that are possessed by the relation represented by the following
matrix:
 
1 1 0
(a) 0 0 1
0 1 0

TrungDT (FUHN) MAD121 Chapter 8 23 / 1


Question 1. What are the properties of the representing matrix of a
relation which is:

reflexive
symmetric
antisymmetric
transitive

Question 2. Which properties: reflexive, symmetric, antisymmetric, or


transitive that are possessed by the relation represented by the following
matrix:
   
1 1 0 1 0 1
(a) 0 0 1 (b) 0 1 0
0 1 0 1 0 1

TrungDT (FUHN) MAD121 Chapter 8 23 / 1


Question 1. What are the properties of the representing matrix of a
relation which is:

reflexive
symmetric
antisymmetric
transitive

Question 2. Which properties: reflexive, symmetric, antisymmetric, or


transitive that are possessed by the relation represented by the following
matrix:
   
1 1 0 1 0 1
(a) 0 0 1 (b) 0 1 0
0 1 0 1 0 1

TrungDT (FUHN) MAD121 Chapter 8 23 / 1


TrungDT (FUHN) MAD121 Chapter 8 24 / 1
Question 3. Let A be a set of cardinality n. How many relations on A are
there that are:

TrungDT (FUHN) MAD121 Chapter 8 24 / 1


Question 3. Let A be a set of cardinality n. How many relations on A are
there that are:

reflexive?

TrungDT (FUHN) MAD121 Chapter 8 24 / 1


Question 3. Let A be a set of cardinality n. How many relations on A are
there that are:

reflexive?
symmetric?

TrungDT (FUHN) MAD121 Chapter 8 24 / 1


Question 3. Let A be a set of cardinality n. How many relations on A are
there that are:

reflexive?
symmetric?
reflexive and symmetric?

TrungDT (FUHN) MAD121 Chapter 8 24 / 1


8.4 Closures of Relations

TrungDT (FUHN) MAD121 Chapter 8 25 / 1


8.4 Closures of Relations

TrungDT (FUHN) MAD121 Chapter 8 25 / 1


8.4 Closures of Relations

Let R be a relation on A. The relation obtained from R by adding a


minimal number of new pairs so that the new relation is reflexive
(symmetric, antisymmetric, transitive) is called the reflexive closure
(symmetric, antisymmetric, transitive closure) of R.

TrungDT (FUHN) MAD121 Chapter 8 25 / 1


8.4 Closures of Relations

Let R be a relation on A. The relation obtained from R by adding a


minimal number of new pairs so that the new relation is reflexive
(symmetric, antisymmetric, transitive) is called the reflexive closure
(symmetric, antisymmetric, transitive closure) of R.

TrungDT (FUHN) MAD121 Chapter 8 25 / 1


TrungDT (FUHN) MAD121 Chapter 8 26 / 1
Example 1.

TrungDT (FUHN) MAD121 Chapter 8 26 / 1


Example 1. Find the reflexive closure of:

TrungDT (FUHN) MAD121 Chapter 8 26 / 1


Example 1. Find the reflexive closure of:

R = {(1, 2), (2, 3), (3, 3)} on A = {1, 2, 3}.

TrungDT (FUHN) MAD121 Chapter 8 26 / 1


Example 1. Find the reflexive closure of:

R = {(1, 2), (2, 3), (3, 3)} on A = {1, 2, 3}.


R = {(a, b)| a 6= b} on the set of real numbers.

TrungDT (FUHN) MAD121 Chapter 8 26 / 1


Example 1. Find the reflexive closure of:

R = {(1, 2), (2, 3), (3, 3)} on A = {1, 2, 3}.


R = {(a, b)| a 6= b} on the set of real numbers.
R = {(a, b)| a ≥ b} on the set of real numbers.

TrungDT (FUHN) MAD121 Chapter 8 26 / 1


Example 1. Find the reflexive closure of:

R = {(1, 2), (2, 3), (3, 3)} on A = {1, 2, 3}.


R = {(a, b)| a 6= b} on the set of real numbers.
R = {(a, b)| a ≥ b} on the set of real numbers.

Example 2.

TrungDT (FUHN) MAD121 Chapter 8 26 / 1


Example 1. Find the reflexive closure of:

R = {(1, 2), (2, 3), (3, 3)} on A = {1, 2, 3}.


R = {(a, b)| a 6= b} on the set of real numbers.
R = {(a, b)| a ≥ b} on the set of real numbers.

Example 2. Find the symmetric closure of:

TrungDT (FUHN) MAD121 Chapter 8 26 / 1


Example 1. Find the reflexive closure of:

R = {(1, 2), (2, 3), (3, 3)} on A = {1, 2, 3}.


R = {(a, b)| a 6= b} on the set of real numbers.
R = {(a, b)| a ≥ b} on the set of real numbers.

Example 2. Find the symmetric closure of:

R = {(1, 2), (2, 3), (3, 3)} on A = {1, 2, 3}.

TrungDT (FUHN) MAD121 Chapter 8 26 / 1


Example 1. Find the reflexive closure of:

R = {(1, 2), (2, 3), (3, 3)} on A = {1, 2, 3}.


R = {(a, b)| a 6= b} on the set of real numbers.
R = {(a, b)| a ≥ b} on the set of real numbers.

Example 2. Find the symmetric closure of:

R = {(1, 2), (2, 3), (3, 3)} on A = {1, 2, 3}.


R = {(a, b)| a > b} on the set of real numbers.

TrungDT (FUHN) MAD121 Chapter 8 26 / 1


Example 1. Find the reflexive closure of:

R = {(1, 2), (2, 3), (3, 3)} on A = {1, 2, 3}.


R = {(a, b)| a 6= b} on the set of real numbers.
R = {(a, b)| a ≥ b} on the set of real numbers.

Example 2. Find the symmetric closure of:

R = {(1, 2), (2, 3), (3, 3)} on A = {1, 2, 3}.


R = {(a, b)| a > b} on the set of real numbers.
R = {(a, b)| a 6= b} on the set of real numbers.

TrungDT (FUHN) MAD121 Chapter 8 26 / 1


Example 1. Find the reflexive closure of:

R = {(1, 2), (2, 3), (3, 3)} on A = {1, 2, 3}.


R = {(a, b)| a 6= b} on the set of real numbers.
R = {(a, b)| a ≥ b} on the set of real numbers.

Example 2. Find the symmetric closure of:

R = {(1, 2), (2, 3), (3, 3)} on A = {1, 2, 3}.


R = {(a, b)| a > b} on the set of real numbers.
R = {(a, b)| a 6= b} on the set of real numbers.

Example 3.

TrungDT (FUHN) MAD121 Chapter 8 26 / 1


Example 1. Find the reflexive closure of:

R = {(1, 2), (2, 3), (3, 3)} on A = {1, 2, 3}.


R = {(a, b)| a 6= b} on the set of real numbers.
R = {(a, b)| a ≥ b} on the set of real numbers.

Example 2. Find the symmetric closure of:

R = {(1, 2), (2, 3), (3, 3)} on A = {1, 2, 3}.


R = {(a, b)| a > b} on the set of real numbers.
R = {(a, b)| a 6= b} on the set of real numbers.

Example 3. Find the antisymmetric closure of


R = {(1, 2), (1, 3), (2, 2), (2, 1)} on {1, 2, 3}.

TrungDT (FUHN) MAD121 Chapter 8 26 / 1


Transitive Closure

TrungDT (FUHN) MAD121 Chapter 8 27 / 1


Transitive Closure

Let
R = {(1, 3), (1, 4), (2, 1), (3, 2)}
on the set A = {1, 2, 3, 4}.

TrungDT (FUHN) MAD121 Chapter 8 27 / 1


Transitive Closure

Let
R = {(1, 3), (1, 4), (2, 1), (3, 2)}
on the set A = {1, 2, 3, 4}.

The relation R is not transitive.

TrungDT (FUHN) MAD121 Chapter 8 27 / 1


Transitive Closure

Let
R = {(1, 3), (1, 4), (2, 1), (3, 2)}
on the set A = {1, 2, 3, 4}.

The relation R is not transitive.

To get a transitive relation from R, we first need to add the pairs of R 2 .

TrungDT (FUHN) MAD121 Chapter 8 27 / 1


Transitive Closure

Let
R = {(1, 3), (1, 4), (2, 1), (3, 2)}
on the set A = {1, 2, 3, 4}.

The relation R is not transitive.

To get a transitive relation from R, we first need to add the pairs of R 2 .

These new pairs together with those of R may form new ones, meaning we
might need to add pairs of R 3 ,...

TrungDT (FUHN) MAD121 Chapter 8 27 / 1


Transitive Closure

Let
R = {(1, 3), (1, 4), (2, 1), (3, 2)}
on the set A = {1, 2, 3, 4}.

The relation R is not transitive.

To get a transitive relation from R, we first need to add the pairs of R 2 .

These new pairs together with those of R may form new ones, meaning we
might need to add pairs of R 3 ,...

Denote R ∗ the transitive closure of R.

TrungDT (FUHN) MAD121 Chapter 8 27 / 1


Transitive Closure

Let
R = {(1, 3), (1, 4), (2, 1), (3, 2)}
on the set A = {1, 2, 3, 4}.

The relation R is not transitive.

To get a transitive relation from R, we first need to add the pairs of R 2 .

These new pairs together with those of R may form new ones, meaning we
might need to add pairs of R 3 ,...

Denote R ∗ the transitive closure of R. Then R ∗ is the infinite union

R∗ = R ∪ R2 ∪ R3 ∪ · · ·

TrungDT (FUHN) MAD121 Chapter 8 27 / 1


Transitive Closure

Let
R = {(1, 3), (1, 4), (2, 1), (3, 2)}
on the set A = {1, 2, 3, 4}.

The relation R is not transitive.

To get a transitive relation from R, we first need to add the pairs of R 2 .

These new pairs together with those of R may form new ones, meaning we
might need to add pairs of R 3 ,...

Denote R ∗ the transitive closure of R. Then R ∗ is the infinite union

R∗ = R ∪ R2 ∪ R3 ∪ · · ·

TrungDT (FUHN) MAD121 Chapter 8 27 / 1


Connectivity Relations

TrungDT (FUHN) MAD121 Chapter 8 28 / 1


Connectivity Relations
Let R = {(1, 3), (1, 4), (2, 1), (3, 2)} on A = {1, 2, 3, 4}

TrungDT (FUHN) MAD121 Chapter 8 28 / 1


Connectivity Relations
Let R = {(1, 3), (1, 4), (2, 1), (3, 2)} on A = {1, 2, 3, 4}

TrungDT (FUHN) MAD121 Chapter 8 28 / 1


Connectivity Relations
Let R = {(1, 3), (1, 4), (2, 1), (3, 2)} on A = {1, 2, 3, 4}

R n = set of pairs of vertices (u, v ) for which there is a path of length


n from u to v .

TrungDT (FUHN) MAD121 Chapter 8 28 / 1


Connectivity Relations
Let R = {(1, 3), (1, 4), (2, 1), (3, 2)} on A = {1, 2, 3, 4}

R n = set of pairs of vertices (u, v ) for which there is a path of length


n from u to v .
R ∪ R 2 ∪ · · · ∪ R n = set of pairs of vertices (u, v ) for which there is a
path of length at most n from u to v .

TrungDT (FUHN) MAD121 Chapter 8 28 / 1


Connectivity Relations
Let R = {(1, 3), (1, 4), (2, 1), (3, 2)} on A = {1, 2, 3, 4}

R n = set of pairs of vertices (u, v ) for which there is a path of length


n from u to v .
R ∪ R 2 ∪ · · · ∪ R n = set of pairs of vertices (u, v ) for which there is a
path of length at most n from u to v .
R ∗ = R ∪ R 2 ∪ R 3 ∪ · · · = set of pairs of vertices (u, v ) for which
there is a path from u to v .
TrungDT (FUHN) MAD121 Chapter 8 28 / 1
An Algorithm for Commputing Transitive Closures

TrungDT (FUHN) MAD121 Chapter 8 29 / 1


An Algorithm for Commputing Transitive Closures

Let R be a relation on a set of n elements.

TrungDT (FUHN) MAD121 Chapter 8 29 / 1


An Algorithm for Commputing Transitive Closures

Let R be a relation on a set of n elements. It is showed that to compute


R ∗ we only need to compute a finite union of relations.

TrungDT (FUHN) MAD121 Chapter 8 29 / 1


An Algorithm for Commputing Transitive Closures

Let R be a relation on a set of n elements. It is showed that to compute


R ∗ we only need to compute a finite union of relations.
Theorem

TrungDT (FUHN) MAD121 Chapter 8 29 / 1


An Algorithm for Commputing Transitive Closures

Let R be a relation on a set of n elements. It is showed that to compute


R ∗ we only need to compute a finite union of relations.
Theorem
Let R be a relation on a set of n elements. Then

R ∗ = R ∪ R 2 ∪ R 3 ∪ · · · ∪ R n.

TrungDT (FUHN) MAD121 Chapter 8 29 / 1


An Algorithm for Commputing Transitive Closures

Let R be a relation on a set of n elements. It is showed that to compute


R ∗ we only need to compute a finite union of relations.
Theorem
Let R be a relation on a set of n elements. Then

R ∗ = R ∪ R 2 ∪ R 3 ∪ · · · ∪ R n.

Equivalently, the matrix of R ∗ is determined from the following equation

TrungDT (FUHN) MAD121 Chapter 8 29 / 1


An Algorithm for Commputing Transitive Closures

Let R be a relation on a set of n elements. It is showed that to compute


R ∗ we only need to compute a finite union of relations.
Theorem
Let R be a relation on a set of n elements. Then

R ∗ = R ∪ R 2 ∪ R 3 ∪ · · · ∪ R n.

Equivalently, the matrix of R ∗ is determined from the following equation


[2] [3] [n]
MR ∗ = MR ∨ MR ∨ MR ∨ · · · ∨ MR

TrungDT (FUHN) MAD121 Chapter 8 29 / 1


TrungDT (FUHN) MAD121 Chapter 8 30 / 1
Example. Find the transitive closure of R = {(1, 3), (1, 4), (2, 1), (3, 2)}
on A = {1, 2, 3, 4}.

TrungDT (FUHN) MAD121 Chapter 8 30 / 1


Example. Find the transitive closure of R = {(1, 3), (1, 4), (2, 1), (3, 2)}
on A = {1, 2, 3, 4}.
 
0 0 1 1
1 0 0 0
MR = 0 1 0 0

0 0 0 0

TrungDT (FUHN) MAD121 Chapter 8 30 / 1


Example. Find the transitive closure of R = {(1, 3), (1, 4), (2, 1), (3, 2)}
on A = {1, 2, 3, 4}.
   
0 0 1 1 0 1 0 0
1 0 0 0 [2] 0 0 1 1
MR = 0 1 0 0
 MR =  1

0 0 0
0 0 0 0 0 0 0 0

TrungDT (FUHN) MAD121 Chapter 8 30 / 1


Example. Find the transitive closure of R = {(1, 3), (1, 4), (2, 1), (3, 2)}
on A = {1, 2, 3, 4}.
   
0 0 1 1 0 1 0 0
1 0 0 0 [2] 0 0 1 1
MR = 0 1 0 0
 MR =  1

0 0 0
0 0 0 0 0 0 0 0
 
1 0 0 0
[3] 0 1 0 0
MR =  0 0 1 1

0 0 0 0

TrungDT (FUHN) MAD121 Chapter 8 30 / 1


Example. Find the transitive closure of R = {(1, 3), (1, 4), (2, 1), (3, 2)}
on A = {1, 2, 3, 4}.
   
0 0 1 1 0 1 0 0
1 0 0 0 [2] 0 0 1 1
MR = 0 1 0 0
 M R = 
1 0 0 0

0 0 0 0 0 0 0 0
   
1 0 0 0 0 0 1 1
[3] 0 1 0 0 [4] 1 0 0 0
MR =  0 0 1 1
 M R = 
0 1 0 0

0 0 0 0 0 0 0 0

TrungDT (FUHN) MAD121 Chapter 8 30 / 1


Example. Find the transitive closure of R = {(1, 3), (1, 4), (2, 1), (3, 2)}
on A = {1, 2, 3, 4}.
   
0 0 1 1 0 1 0 0
1 0 0 0 [2] 0 0 1 1
MR = 0 1 0 0
 M R = 
1 0 0 0

0 0 0 0 0 0 0 0
   
1 0 0 0 0 0 1 1
[3] 0 1 0 0 [4] 1 0 0 0
MR =  0 0 1 1
 M R = 
0 1 0 0

0 0 0 0 0 0 0 0
 
1 1 1 1
1 1 1 1
Then MR ∗ =  1 1 1 1

0 0 0 0

TrungDT (FUHN) MAD121 Chapter 8 30 / 1


Warshall’s Algorithm for Computing Transitive Closures

TrungDT (FUHN) MAD121 Chapter 8 31 / 1


Warshall’s Algorithm for Computing Transitive Closures

Let R be a relation on a set of n elements. To compute the transitive


closure of R, Warshall’s algorithm constructs a sequence of matrices
M0 , M1 , . . . recursively:

TrungDT (FUHN) MAD121 Chapter 8 31 / 1


Warshall’s Algorithm for Computing Transitive Closures

Let R be a relation on a set of n elements. To compute the transitive


closure of R, Warshall’s algorithm constructs a sequence of matrices
M0 , M1 , . . . recursively:

M0 := MR

TrungDT (FUHN) MAD121 Chapter 8 31 / 1


Warshall’s Algorithm for Computing Transitive Closures

Let R be a relation on a set of n elements. To compute the transitive


closure of R, Warshall’s algorithm constructs a sequence of matrices
M0 , M1 , . . . recursively:

M0 := MR
Mk := Mk−1 ∨ (Boolean product of kth column and kth row of Mk−1 )

TrungDT (FUHN) MAD121 Chapter 8 31 / 1


Warshall’s Algorithm for Computing Transitive Closures

Let R be a relation on a set of n elements. To compute the transitive


closure of R, Warshall’s algorithm constructs a sequence of matrices
M0 , M1 , . . . recursively:

M0 := MR
Mk := Mk−1 ∨ (Boolean product of kth column and kth row of Mk−1 )

TrungDT (FUHN) MAD121 Chapter 8 31 / 1


Warshall’s Algorithm for Computing Transitive Closures

Let R be a relation on a set of n elements. To compute the transitive


closure of R, Warshall’s algorithm constructs a sequence of matrices
M0 , M1 , . . . recursively:

M0 := MR
Mk := Mk−1 ∨ (Boolean product of kth column and kth row of Mk−1 )

The algorithm terminates when k = n, and the matrix Mn is the matrix of


the transitive closure of R.

TrungDT (FUHN) MAD121 Chapter 8 31 / 1


TrungDT (FUHN) MAD121 Chapter 8 32 / 1
Example. Use Warshall’s algorithm to compute the transitive closure of
R = {(1, 3), (1, 4), (2, 1), (3, 2)} on A = {1, 2, 3, 4}.

TrungDT (FUHN) MAD121 Chapter 8 32 / 1


TrungDT (FUHN) MAD121 Chapter 8 33 / 1
Exercise.

TrungDT (FUHN) MAD121 Chapter 8 33 / 1


Exercise. Read and understand the proof of correctness of Warshall’s
algorithm in textbook.

TrungDT (FUHN) MAD121 Chapter 8 33 / 1


8.5 Equivalence relations

TrungDT (FUHN) MAD121 Chapter 8 34 / 1


8.5 Equivalence relations
Partitions.

TrungDT (FUHN) MAD121 Chapter 8 34 / 1


8.5 Equivalence relations
Partitions. Let A be a set. The subsets A1 , A2 , . . . , An are called a
partition of A if:

TrungDT (FUHN) MAD121 Chapter 8 34 / 1


8.5 Equivalence relations
Partitions. Let A be a set. The subsets A1 , A2 , . . . , An are called a
partition of A if:

(i) A1 ∪ A2 ∪ · · · ∪ An = A

TrungDT (FUHN) MAD121 Chapter 8 34 / 1


8.5 Equivalence relations
Partitions. Let A be a set. The subsets A1 , A2 , . . . , An are called a
partition of A if:

(i) A1 ∪ A2 ∪ · · · ∪ An = A
(ii) Ai ∩ Aj = Ø for all i 6= j.

TrungDT (FUHN) MAD121 Chapter 8 34 / 1


8.5 Equivalence relations
Partitions. Let A be a set. The subsets A1 , A2 , . . . , An are called a
partition of A if:

(i) A1 ∪ A2 ∪ · · · ∪ An = A
(ii) Ai ∩ Aj = Ø for all i 6= j.

TrungDT (FUHN) MAD121 Chapter 8 34 / 1


TrungDT (FUHN) MAD121 Chapter 8 35 / 1
Example.

TrungDT (FUHN) MAD121 Chapter 8 35 / 1


Example. Which of the following subsets form a partition of the set of all
real numbers?

TrungDT (FUHN) MAD121 Chapter 8 35 / 1


Example. Which of the following subsets form a partition of the set of all
real numbers?

(a) The subset of positive integers, the subset of negative integers

TrungDT (FUHN) MAD121 Chapter 8 35 / 1


Example. Which of the following subsets form a partition of the set of all
real numbers?

(a) The subset of positive integers, the subset of negative integers


(b) The subset of non-positive integers, the subset of non-negative
integers

TrungDT (FUHN) MAD121 Chapter 8 35 / 1


Example. Which of the following subsets form a partition of the set of all
real numbers?

(a) The subset of positive integers, the subset of negative integers


(b) The subset of non-positive integers, the subset of non-negative
integers
(c) The subset of rational numbers, the subset of irrational numbers

TrungDT (FUHN) MAD121 Chapter 8 35 / 1


Example. Which of the following subsets form a partition of the set of all
real numbers?

(a) The subset of positive integers, the subset of negative integers


(b) The subset of non-positive integers, the subset of non-negative
integers
(c) The subset of rational numbers, the subset of irrational numbers
(d) The closed intervals [n, n + 1] where n is an integer

TrungDT (FUHN) MAD121 Chapter 8 35 / 1


Example. Which of the following subsets form a partition of the set of all
real numbers?

(a) The subset of positive integers, the subset of negative integers


(b) The subset of non-positive integers, the subset of non-negative
integers
(c) The subset of rational numbers, the subset of irrational numbers
(d) The closed intervals [n, n + 1] where n is an integer
(e) The intervals (n, n + 1] where n is an integer.

TrungDT (FUHN) MAD121 Chapter 8 35 / 1


Equivalence Relations

TrungDT (FUHN) MAD121 Chapter 8 36 / 1


Equivalence Relations

TrungDT (FUHN) MAD121 Chapter 8 36 / 1


Equivalence Relations

The relation R on A is called an equivalence relation if it is reflexive,


symmetric and transitive.

TrungDT (FUHN) MAD121 Chapter 8 36 / 1


Equivalence Relations

The relation R on A is called an equivalence relation if it is reflexive,


symmetric and transitive.

Example.

TrungDT (FUHN) MAD121 Chapter 8 36 / 1


Equivalence Relations

The relation R on A is called an equivalence relation if it is reflexive,


symmetric and transitive.

Example. The following relations are equivalence relations:

TrungDT (FUHN) MAD121 Chapter 8 36 / 1


Equivalence Relations

The relation R on A is called an equivalence relation if it is reflexive,


symmetric and transitive.

Example. The following relations are equivalence relations:

(a) The congruence modular m relation on the set of integers

TrungDT (FUHN) MAD121 Chapter 8 36 / 1


Equivalence Relations

The relation R on A is called an equivalence relation if it is reflexive,


symmetric and transitive.

Example. The following relations are equivalence relations:

(a) The congruence modular m relation on the set of integers


(b) The born-in-the-same-city relation in a class

TrungDT (FUHN) MAD121 Chapter 8 36 / 1


Equivalence Relations

The relation R on A is called an equivalence relation if it is reflexive,


symmetric and transitive.

Example. The following relations are equivalence relations:

(a) The congruence modular m relation on the set of integers


(b) The born-in-the-same-city relation in a class
 
1 1 0
(c) The relation whose representing matrix is MR = 1 1 0
0 0 1

TrungDT (FUHN) MAD121 Chapter 8 36 / 1


Equivalence Relations

The relation R on A is called an equivalence relation if it is reflexive,


symmetric and transitive.

Example. The following relations are equivalence relations:

(a) The congruence modular m relation on the set of integers


(b) The born-in-the-same-city relation in a class
 
1 1 0
(c) The relation whose representing matrix is MR = 1 1 0
0 0 1
(d) R = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (4, 4)} on A = {1, 2, 3, 4}

TrungDT (FUHN) MAD121 Chapter 8 36 / 1


Equivalence Relations

The relation R on A is called an equivalence relation if it is reflexive,


symmetric and transitive.

Example. The following relations are equivalence relations:

(a) The congruence modular m relation on the set of integers


(b) The born-in-the-same-city relation in a class
 
1 1 0
(c) The relation whose representing matrix is MR = 1 1 0
0 0 1
(d) R = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (4, 4)} on A = {1, 2, 3, 4}

TrungDT (FUHN) MAD121 Chapter 8 36 / 1


TrungDT (FUHN) MAD121 Chapter 8 37 / 1
Theorem

TrungDT (FUHN) MAD121 Chapter 8 37 / 1


Theorem
Let R be an equivalence relation on A.

TrungDT (FUHN) MAD121 Chapter 8 37 / 1


Theorem
Let R be an equivalence relation on A. Then
The set A is partitioned into disjoint subsets, elements in each subset
are mutually related to each other (and to themself), and any two
elements of two different subsets are not related by R.

TrungDT (FUHN) MAD121 Chapter 8 37 / 1


Theorem
Let R be an equivalence relation on A. Then
The set A is partitioned into disjoint subsets, elements in each subset
are mutually related to each other (and to themself), and any two
elements of two different subsets are not related by R.
These subsets are called equivalence classes of R.

TrungDT (FUHN) MAD121 Chapter 8 37 / 1


Theorem
Let R be an equivalence relation on A. Then
The set A is partitioned into disjoint subsets, elements in each subset
are mutually related to each other (and to themself), and any two
elements of two different subsets are not related by R.
These subsets are called equivalence classes of R.
Therefore, an equivalence relation on A forms a partition of A
consisting of equivalence classes of R.

TrungDT (FUHN) MAD121 Chapter 8 37 / 1


Theorem
Let R be an equivalence relation on A. Then
The set A is partitioned into disjoint subsets, elements in each subset
are mutually related to each other (and to themself), and any two
elements of two different subsets are not related by R.
These subsets are called equivalence classes of R.
Therefore, an equivalence relation on A forms a partition of A
consisting of equivalence classes of R.

Example.

TrungDT (FUHN) MAD121 Chapter 8 37 / 1


Theorem
Let R be an equivalence relation on A. Then
The set A is partitioned into disjoint subsets, elements in each subset
are mutually related to each other (and to themself), and any two
elements of two different subsets are not related by R.
These subsets are called equivalence classes of R.
Therefore, an equivalence relation on A forms a partition of A
consisting of equivalence classes of R.

Example. Find all equivalence classes of each equivalence relation

TrungDT (FUHN) MAD121 Chapter 8 37 / 1


Theorem
Let R be an equivalence relation on A. Then
The set A is partitioned into disjoint subsets, elements in each subset
are mutually related to each other (and to themself), and any two
elements of two different subsets are not related by R.
These subsets are called equivalence classes of R.
Therefore, an equivalence relation on A forms a partition of A
consisting of equivalence classes of R.

Example. Find all equivalence classes of each equivalence relation

(a) The congruence modular m relation of the set of integers

TrungDT (FUHN) MAD121 Chapter 8 37 / 1


Theorem
Let R be an equivalence relation on A. Then
The set A is partitioned into disjoint subsets, elements in each subset
are mutually related to each other (and to themself), and any two
elements of two different subsets are not related by R.
These subsets are called equivalence classes of R.
Therefore, an equivalence relation on A forms a partition of A
consisting of equivalence classes of R.

Example. Find all equivalence classes of each equivalence relation

(a) The congruence modular m relation of the set of integers


(b) The born-in-the-same-city relation in a class

TrungDT (FUHN) MAD121 Chapter 8 37 / 1


Theorem
Let R be an equivalence relation on A. Then
The set A is partitioned into disjoint subsets, elements in each subset
are mutually related to each other (and to themself), and any two
elements of two different subsets are not related by R.
These subsets are called equivalence classes of R.
Therefore, an equivalence relation on A forms a partition of A
consisting of equivalence classes of R.

Example. Find all equivalence classes of each equivalence relation

(a) The congruence modular m relation of the set of integers


(b) The born-in-the-same-city relation in a class
 
1 1 0
(c) The relation whose representing matrix is MR = 1 1 0
0 0 1

TrungDT (FUHN) MAD121 Chapter 8 37 / 1


Theorem
Let R be an equivalence relation on A. Then
The set A is partitioned into disjoint subsets, elements in each subset
are mutually related to each other (and to themself), and any two
elements of two different subsets are not related by R.
These subsets are called equivalence classes of R.
Therefore, an equivalence relation on A forms a partition of A
consisting of equivalence classes of R.

Example. Find all equivalence classes of each equivalence relation

(a) The congruence modular m relation of the set of integers


(b) The born-in-the-same-city relation in a class
 
1 1 0
(c) The relation whose representing matrix is MR = 1 1 0
0 0 1
(d) R = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (4, 4)} on A = {1, 2, 3, 4}
TrungDT (FUHN) MAD121 Chapter 8 37 / 1
Theorem
Let R be an equivalence relation on A. Then
The set A is partitioned into disjoint subsets, elements in each subset
are mutually related to each other (and to themself), and any two
elements of two different subsets are not related by R.
These subsets are called equivalence classes of R.
Therefore, an equivalence relation on A forms a partition of A
consisting of equivalence classes of R.

Example. Find all equivalence classes of each equivalence relation

(a) The congruence modular m relation of the set of integers


(b) The born-in-the-same-city relation in a class
 
1 1 0
(c) The relation whose representing matrix is MR = 1 1 0
0 0 1
(d) R = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (4, 4)} on A = {1, 2, 3, 4}
TrungDT (FUHN) MAD121 Chapter 8 37 / 1
TrungDT (FUHN) MAD121 Chapter 8 38 / 1
TrungDT (FUHN) MAD121 Chapter 8 38 / 1
Let A1 , A2 , . . . , An be a partition of A.

TrungDT (FUHN) MAD121 Chapter 8 38 / 1


Let A1 , A2 , . . . , An be a partition of A. There exists an equivalence relation
R on A whose equivalence classes are the subsets of this partition.

TrungDT (FUHN) MAD121 Chapter 8 38 / 1


Let A1 , A2 , . . . , An be a partition of A. There exists an equivalence relation
R on A whose equivalence classes are the subsets of this partition.

Example. Define an equivalence relation whose equivalence classes are the


subsets of the following partitions:

TrungDT (FUHN) MAD121 Chapter 8 38 / 1


Let A1 , A2 , . . . , An be a partition of A. There exists an equivalence relation
R on A whose equivalence classes are the subsets of this partition.

Example. Define an equivalence relation whose equivalence classes are the


subsets of the following partitions:

Partition {1, 3, 5}, {2}, {4} of {1, 2, 3, 4, 5}

TrungDT (FUHN) MAD121 Chapter 8 38 / 1


Let A1 , A2 , . . . , An be a partition of A. There exists an equivalence relation
R on A whose equivalence classes are the subsets of this partition.

Example. Define an equivalence relation whose equivalence classes are the


subsets of the following partitions:

Partition {1, 3, 5}, {2}, {4} of {1, 2, 3, 4, 5}


Partition of the set of integers consisting of the subset of even
numbers and the subset of odd numbers

TrungDT (FUHN) MAD121 Chapter 8 38 / 1


Let A1 , A2 , . . . , An be a partition of A. There exists an equivalence relation
R on A whose equivalence classes are the subsets of this partition.

Example. Define an equivalence relation whose equivalence classes are the


subsets of the following partitions:

Partition {1, 3, 5}, {2}, {4} of {1, 2, 3, 4, 5}


Partition of the set of integers consisting of the subset of even
numbers and the subset of odd numbers

TrungDT (FUHN) MAD121 Chapter 8 38 / 1


Let A1 , A2 , . . . , An be a partition of A. There exists an equivalence relation
R on A whose equivalence classes are the subsets of this partition.

Example. Define an equivalence relation whose equivalence classes are the


subsets of the following partitions:

Partition {1, 3, 5}, {2}, {4} of {1, 2, 3, 4, 5}


Partition of the set of integers consisting of the subset of even
numbers and the subset of odd numbers

TrungDT (FUHN) MAD121 Chapter 8 38 / 1


TrungDT (FUHN) MAD121 Chapter 8 39 / 1
Question.

TrungDT (FUHN) MAD121 Chapter 8 39 / 1


Question. How many equivalence relations are there on the set
{1, 2, 3, 4}?

TrungDT (FUHN) MAD121 Chapter 8 39 / 1

You might also like