More Related Content
Similar to Relations digraphs
Similar to Relations digraphs (20)
Relations digraphs
- 2. Product Sets
Definition: An ordered pair ππ, ππ is a listing of the
objects/items ππ and ππ in a prescribed order: ππ is the first
and ππ is the second. (a sequence of length 2)
Definition: The ordered pairs ππ1, ππ1 and ππ2, ππ2 are
equal iff ππ1 = ππ2 and ππ1 = ππ2.
Definition: If π΄π΄ and π΅π΅ are two nonempty sets, we define
the product set or Cartesian product π΄π΄ Γ π΅π΅ as the set of
all ordered pairs ππ, ππ with ππ β π΄π΄ and ππ β π΅π΅:
π΄π΄ Γ π΅π΅ = ππ, ππ ππ β π΄π΄ and ππ β π΅π΅}
Β© S. Turaev, CSC 1700 Discrete Mathematics 2
- 3. Product Sets
Example: Let π΄π΄ = 1,2,3 and π΅π΅ = ππ, π π , then
π΄π΄ Γ π΅π΅ =
π΅π΅ Γ π΄π΄ =
Β© S. Turaev, CSC 1700 Discrete Mathematics 3
- 4. Product Sets
Theorem: For any two finite sets π΄π΄ and π΅π΅,
π΄π΄ Γ π΅π΅ = π΄π΄ β
π΅π΅ .
Proof: Use multiplication principle!
Β© S. Turaev, CSC 1700 Discrete Mathematics 4
- 5. Definitions:
ο§ Let π΄π΄ and π΅π΅ be nonempty sets. A relation π
π
from π΄π΄
to π΅π΅ is a subset of π΄π΄ Γ π΅π΅.
ο§ If π
π
β π΄π΄ Γ π΅π΅ and ππ, ππ β π
π
, we say that ππ is related
to ππ by π
π
, and we write ππ π
π
ππ.
ο§ If ππ is not related to ππ by π
π
, we write ππ π
π
ππ.
ο§ If π
π
β π΄π΄ Γ π΄π΄, we say π
π
is a relation on π΄π΄.
Relations & Digraphs
Β© S. Turaev, CSC 1700 Discrete Mathematics 5
- 6. Example 1: Let π΄π΄ = 1,2,3 and π΅π΅ = ππ, π π . Then
π
π
= 1, ππ , 2, π π , 3, ππ β π΄π΄ Γ π΅π΅
is a relation from π΄π΄ to π΅π΅.
Example 2: Let π΄π΄ and π΅π΅ are sets of positive integer
numbers. We define the relation π
π
β π΄π΄ Γ π΅π΅ by
ππ π
π
ππ β ππ = ππ
Relations & Digraphs
Β© S. Turaev, CSC 1700 Discrete Mathematics 6
- 7. Example 3: Let π΄π΄ = 1,2,3,4,5 . The relation π
π
β π΄π΄ Γ π΄π΄ is
defined by
ππ π
π
ππ β ππ < ππ
Then π
π
=
Example 4: Let π΄π΄ = 1,2,3,4,5,6,7,8,9,10 . The relation
π
π
β π΄π΄ Γ π΄π΄ is defined by
ππ π
π
ππ β ππ|ππ
Then π
π
=
Relations & Digraphs
Β© S. Turaev, CSC 1700 Discrete Mathematics 7
- 8. Definition: Let π
π
β π΄π΄ Γ π΅π΅ be a relation from π΄π΄ to π΅π΅.
ο§ The domain of π
π
, denoted by Dom π
π
, is the set of
elements in π΄π΄ that are related to some element in
π΅π΅.
ο§ The range of π
π
, denoted by Ran π
π
, is the set of
elements in π΅π΅ that are second elements of pairs in
π
π
.
Relations & Digraphs
Β© S. Turaev, CSC 1700 Discrete Mathematics 8
- 9. Relations & Digraphs
Example 5: Let π΄π΄ = 1,2,3 and π΅π΅ = ππ, π π .
π
π
= 1, ππ , 2, π π , 3, ππ
Dom R =
Ran R =
Example 6: Let π΄π΄ = 1,2,3,4,5 . The relation π
π
β π΄π΄ Γ π΄π΄ is
defined by ππ π
π
ππ β ππ < ππ
Dom R =
Ran R =
Β© S. Turaev, CSC 1700 Discrete Mathematics 9
- 10. The Matrix of a Relation
Definition: Let π΄π΄ = ππ1, ππ2, β¦ , ππ ππ , π΅π΅ = ππ1, ππ2, β¦ , ππππ
and π
π
β π΄π΄ Γ π΅π΅ be a relation. We represent π
π
by the ππ Γ
ππ matrix πππ
π
= [ππππππ], which is defined by
ππππππ = οΏ½
1, ππππ, ππππ β π
π
0, ππππ, ππππ β π
π
The matrix πππ
π
is called the matrix of π
π
.
Example: Let π΄π΄ = 1,2,3 and π΅π΅ = ππ, π π .
π
π
= 1, ππ , 2, π π , 3, ππ πππ
π
=
Β© S. Turaev, CSC 1700 Discrete Mathematics 10
- 11. The Digraph of a Relation
Definition: If π΄π΄ is finite and π
π
β π΄π΄ Γ π΄π΄ is a relation. We
represent π
π
pictorially as follows:
ο§ Draw a small circle, called a vertex/node, for each
element of π΄π΄ and label the circle with the
corresponding element of π΄π΄.
ο§ Draw an arrow, called an edge, from vertex ππππ to
vertex ππππ iff ππππ π
π
ππππ.
The resulting pictorial representation of π
π
is called a
directed graph or digraph of π
π
.
Β© S. Turaev, CSC 1700 Discrete Mathematics 11
- 12. The Digraph of a Relation
Example: Let π΄π΄ = 1, 2, 3, 4 and
π
π
= 1,1 , 1,2 , 2,1 , 2,2 , 2,3 , 2,4 , 3,4 , 4,1
The digraph of π
π
:
Example: Let π΄π΄ = 1, 2, 3, 4 and
Find the relation π
π
:
Β© S. Turaev, CSC 1700 Discrete Mathematics
1
2
3
4
12
- 13. The Digraph of a Relation
Definition: If π
π
is a relation on a set π΄π΄ and ππ β π΄π΄, then
ο§ the in-degree of ππ is the number of ππ β π΄π΄ such that
ππ, ππ β π
π
;
ο§ the out-degree of ππ is the number of ππ β π΄π΄ such
that ππ, ππ β π
π
.
Example: Consider the digraph:
List in-degrees and out-degrees of all vertices.
Β© S. Turaev, CSC 1700 Discrete Mathematics
1
2
3
4
13
- 14. The Digraph of a Relation
Example: Let π΄π΄ = ππ, ππ, ππ, ππ and let π
π
be the relation on
π΄π΄ that has the matrix
πππ
π
=
1 0
0 1
0 0
0 0
1 1
0 1
1 0
0 1
Construct the digraph of π
π
and list in-degrees and out-
degrees of all vertices.
Β© S. Turaev, CSC 1700 Discrete Mathematics 14
- 15. The Digraph of a Relation
Example: Let π΄π΄ = 1,4,5 and let π
π
be given the digraph
Find πππ
π
and π
π
.
Β© S. Turaev, CSC 1700 Discrete Mathematics
1 4
5
15
- 16. Paths in Relations & Digraphs
Definition: Suppose that π
π
is a relation on a set π΄π΄.
A path of length ππ in π
π
from ππ to ππ is a finite sequence
ππ βΆ ππ, π₯π₯1, π₯π₯2, β¦ , π₯π₯ππβ1, ππ
beginning with ππ and ending with ππ, such that
ππ π
π
π₯π₯1, π₯π₯1 π
π
π₯π₯2, β¦ , π₯π₯ππβ1 π
π
ππ.
Definition: A path that begins and ends at the same
vertex is called a cycle:
ππ βΆ ππ, π₯π₯1, π₯π₯2, β¦ , π₯π₯ππβ1, ππ
Β© S. Turaev, CSC 1700 Discrete Mathematics 16
- 17. Paths in Relations & Digraphs
Example: Give the examples for paths of length 1,2,3,4
and 5.
Β© S. Turaev, CSC 1700 Discrete Mathematics
1 2
43
5
17
- 18. Paths in Relations & Digraphs
Definition: If ππ is a fixed number, we define a relation π
π
ππ
as follows: π₯π₯ π
π
ππ
π¦π¦ means that there is a path of length ππ
from π₯π₯ to π¦π¦.
Definition: We define a relation π
π
β
(connectivity relation
for π
π
) on π΄π΄ by letting π₯π₯ π
π
β
π¦π¦ mean that there is some
path from π₯π₯ to π¦π¦.
Example: Let π΄π΄ = ππ, ππ, ππ, ππ, ππ and
π
π
= ππ, ππ , ππ, ππ , ππ, ππ , ππ, ππ , ππ, ππ , ππ, ππ .
Compute (a) π
π
2
; (b) π
π
3
; (c) π
π
β
.
Β© S. Turaev, CSC 1700 Discrete Mathematics 18
- 19. Paths in Relations & Digraphs
Let π
π
be a relation on a finite set π΄π΄ = ππ1, ππ2, β¦ , ππππ , and
let πππ
π
be the ππ Γ ππ matrix representing π
π
.
Theorem 1: If π
π
is a relation on π΄π΄ = ππ1, ππ2, β¦ , ππππ , then
πππ
π
2 = πππ
π
β πππ
π
.
Example: Let π΄π΄ = ππ, ππ, ππ, ππ, ππ and
π
π
= ππ, ππ , ππ, ππ , ππ, ππ , ππ, ππ , ππ, ππ , ππ, ππ .
Β© S. Turaev, CSC 1700 Discrete Mathematics 19
- 20. Paths in Relations & Digraphs
Example: Let π΄π΄ = ππ, ππ, ππ, ππ, ππ and
π
π
= ππ, ππ , ππ, ππ , ππ, ππ , ππ, ππ , ππ, ππ , ππ, ππ .
πππ
π
=
1 1
0 0
0 0
1 0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
0
Compute πππ
π
2.
Β© S. Turaev, CSC 1700 Discrete Mathematics 20
- 21. Reflexive & Irreflexive Relations
Definition:
ο§ A relation π
π
on a set π΄π΄ is reflexive if ππ, ππ β π
π
for
all ππ β π΄π΄, i.e., if ππ π
π
ππ for all ππ β π΄π΄.
ο§ A relation π
π
on a set π΄π΄ is irreflexive if ππ π
π
ππ for all
ππ β π΄π΄.
Example:
ο§ Ξ = ππ, ππ | ππ β π΄π΄ , the relation of equality on the
set π΄π΄.
ο§ π
π
= ππ, ππ β π΄π΄ Γ π΄π΄| ππ β ππ , the relation of
inequality on the set π΄π΄.
Β© S. Turaev, CSC 1700 Discrete Mathematics 21
- 22. Reflexive & Irreflexive Relations
Exercise: Let π΄π΄ = 1, 2, 3 , and let π
π
= 1,1 , 1,2 .
Is π
π
reflexive or irreflexive?
Exercise: How is a reflexive or irreflexive relation
identified by its matrix?
Exercise: How is a reflexive or irreflexive relation
characterized by the digraph?
Β© S. Turaev, CSC 1700 Discrete Mathematics 22
- 23. (A-, Anti-) Symmetric Relations
Definition:
ο§ A relation π
π
on a set π΄π΄ is symmetric if whenever
ππ π
π
ππ, then ππ π
π
ππ.
ο§ A relation π
π
on a set π΄π΄ is asymmetric if whenever
ππ π
π
ππ, then ππ π
π
ππ.
ο§ A relation π
π
on a set π΄π΄ is antisymmetric if whenever
ππ π
π
ππ and ππ π
π
ππ, then ππ = ππ.
Β© S. Turaev, CSC 1700 Discrete Mathematics 23
- 24. (A-, Anti-) Symmetric Relations
Example: Let π΄π΄ = 1, 2, 3, 4, 5, 6 and let
π
π
= ππ, ππ β π΄π΄ Γ π΄π΄ | ππ < ππ
Is π
π
symmetric, asymmetric or antisymmetric?
ο§ Symmetry:
ο§ Asymmetry:
ο§ Antisymmetry:
Β© S. Turaev, CSC 1700 Discrete Mathematics 24
- 25. (A-, Anti-) Symmetric Relations
Example: Let π΄π΄ = 1, 2, 3, 4 and let
π
π
= 1,2 , 2,2 , 3,4 , 4,1
Is π
π
symmetric, asymmetric or antisymmetric?
Example: Let π΄π΄ = β€+
and let
π
π
= ππ, ππ β π΄π΄ Γ π΄π΄ | ππ divides ππ
Is π
π
symmetric, asymmetric or antisymmetric?
Β© S. Turaev, CSC 1700 Discrete Mathematics 25
- 26. (A-, Anti-) Symmetric Relations
Exercise: How is a symmetric, asymmetric or
antisymmetric relation identified by its matrix?
Exercise: How is a symmetric, asymmetric or
antisymmetric relation characterized by the digraph?
Β© S. Turaev, CSC 1700 Discrete Mathematics 26
- 27. Transitive Relations
Definition: A relation π
π
on a set π΄π΄ is transitive if
whenever ππ π
π
ππ and ππ π
π
ππ then ππ π
π
ππ.
Example: Let π΄π΄ = 1, 2, 3, 4 and let
π
π
= 1,2 , 1,3 , 4,2
Is π
π
transitive?
Example: Let π΄π΄ = β€+
and let
π
π
= ππ, ππ β π΄π΄ Γ π΄π΄ | ππ divides ππ
Is π
π
transitive?
Β© S. Turaev, CSC 1700 Discrete Mathematics 27
- 28. Transitive Relations
Exercise: Let π΄π΄ = 1,2,3 and π
π
be the relation on π΄π΄
whose matrix is
πππ
π
=
1 1 1
0 0 1
0 0 1
Show that π
π
is transitive. (Hint: Check if πππ
π
β
2
= πππ
π
)
Exercise: How is a transitive relation identified by its
matrix?
Exercise: How is a transitive relation characterized by the
digraph?
Β© S. Turaev, CSC 1700 Discrete Mathematics 28
- 29. Equivalence Relations
Definition: A relation π
π
on a set π΄π΄ is called an equi-
valence relation if it is reflexive, symmetric and transitive.
Example: Let π΄π΄ = 1, 2, 3, 4 and let
π
π
= 1,1 , 1,2 , 2,1 , 2,2 , 3,4 , 4,3 , 3,3 , 4,4 .
Then π
π
is an equivalence relation.
Example: Let π΄π΄ = β€ and let
π
π
= ππ, ππ β π΄π΄ Γ π΄π΄ βΆ ππ β‘ ππ mod 2 .
Show that π
π
is an equivalence relation.
Β© S. Turaev, CSC 1700 Discrete Mathematics 29