312708010 科管碩二 周亨昆
Discrete Mathematics
Presentation
CONTENT
01
02
Relations Revisited -
Properties of Relations
Computer Recognition -
Zero-One Matrices and Directed Graphs
Relations Revisited -
Properties of Relations
2021
For sets A, B, any subset of A × B is called a (binary) relation from A to B.
Any subset of A × A is called a (binary) relation on A.
Definition 7.1
2021
1. Define the relation R on the set Z by a R b, if a ≤ b. This subset of Z × Z is the ordinary “less than or equal to” relation on the set Z.
2. Let n ∈ Z+. For x, y ∈ Z, the modulo n relation R is defined by x R y if x − y is a multiple of n.
e.g., with n = 7, 9 R 2, −3 R 11
Example
3. Consider a finite state machine (FSM) M = (S, φ, O, ν, ω)
(S : 有限狀態集, φ : 輸入字母, O : 輸出字母, ν : 狀態轉移函數, ω : 輸出函式)
First level of reachability: S1 R S2 if ν(S1, x) = S2
Second level: S1 R S2 if ν(S1, x1x2) = S2, x1x2 ∈ φ2
A relation R on set A is called reflexive if for all X ∈ A, (X, X) ∈ R.
Definition 7.2
For A = {1, 2, 3, 4}, a relation R ⊆ A × A will be reflexive if and only if R ⊇ {(1, 1), (2, 2), (3, 3), (4, 4)}.
- Are the following relations reflexive?
R1 = {(1, 1), (2, 2), (3, 3)}
R2 = {(x, y) | x, y ∈ A, x ≤ y}
Example
For A = {1, 2, 3, 4}, a relation R ⊆ A × A will be reflexive if and only if R ⊇ {(1, 1), (2, 2), (3, 3), (4, 4)}.
- Are the following relations reflexive?
R1 = {(1, 1), (2, 2), (3, 3)} ×
R2 = {(x, y) | x, y ∈ A, x ≤ y} ✓
Example
A relation R on set A is called symmetric if
(x, y) ∈ R ⇒ (y, x) ∈ R,
for all x, y ∈ A.
Definition 7.3
With A = {1, 2, 3}, we have:
(a) R1 = {(1, 2), (2, 1), (1, 3), (3, 1)} symmetric, but not reflexive
(b) R2 = {(1, 1), (2, 2), (3, 3), (2, 3)} reflexive, but not symmetric
(c) R3 = {(1, 1), (2, 2), (3, 3)} both symmetric and reflexive
(d) R4 = {(1, 1), (2, 2), (3, 3), (2, 3), (3, 2)} both symmetric and reflexive
Example
A relation R on set A is called antisymmetric if for all a, b ∈ A, (a R b and
b R a) ⇒ a = b.
Definition 7.5
Consider A = {1, 2, 3, 4},
are the following relations antisymmetric?
R1 = {(1, 1), (1, 2), (2, 3), (3, 1)}
R2 = {(1, 2), (2, 1), (2, 3), (3, 1)}
Example
Consider A = {1, 2, 3, 4},
are the following relations antisymmetric?
R1 = {(1, 1), (1, 2), (2, 3), (3, 1)} ✓
R2 = {(1, 2), (2, 1), (2, 3), (3, 1)} ×
Example
A relation R on set A is called transitive if for all x, y, z ∈ A,
(x, y), (y, z) ∈ R ⇒ (x, z) ∈ R.
Definition 7.4
Consider A = {1, 2, 3, 4},
are the following relations transitive?
R1 = {(1, 1), (2, 3), (3, 4), (2, 4)}
R2 = {(1, 3), (3, 2)}
Example
Consider A = {1, 2, 3, 4},
are the following relations transitive?
R1 = {(1, 1), (2, 3), (3, 4), (2, 4)} ✓
R2 = {(1, 3), (3, 2)} ×
example:
Define the relation R on the set Z+, by a R b if a (exactly) divides b, that
is b = ca for some c ∈ Z+.
Now if x R y and y R z, do we have x R z?
Example
Define the relation R on the set Z+, by a R b if a (exactly) divides b, that
is b = ca for some c ∈ Z+.
Now if x R y and y R z, do we have x R z?
x R y ⇒ y = sx, for somes ∈ Z+,
y R z ⇒ z = ty, for some t ∈ Z+.
z = ty = t(sx) = (ts)x, for ts ∈ Z+.
So x R z and R is transitive.
In addition, R is reflexive, but not symmetric.
e.g., 2 R 6 but 6 /ℛ 2
Example
A relation R on set A is called partial order if R is reflexive, antisymmetric,
and transitive
Definition 7.6
Partial Order !
With the set A = {1, 2, 3, 4, 6, 12} and define the relation R on A by x R y
if x (exactly) divides y.
(R is reflexive and transitive)
If x, y ∈ A and we have both x R y and y R x, then
x R y ⇒ y = ax, for some a ∈ Z+,
y R x ⇒ x = by, for some b ∈ Z+.
y = ax = a(by) = (ab)y, and since y̸ = 0, we have ab = 1 ⇒ a = b = 1, so y = x and R is antisymmetric
R = {(1, 1), (1, 2), (1, 3), (1, 4), (1, 6), (1, 12), (2, 2), (2, 4), (2, 6), (2, 12), (3, 3), (3, 6), (3, 12), (4, 4), (4, 12), (6, 6), (6, 12), (12, 12) }
Example
A relation R on set A is called equivalence relation if R is reflexive, sym-metric, and transitive.
Definition 7.7
if A = {1, 2, 3}, then
R1 = {(1, 1), (2, 2), (3, 3)},
R2 = {(1, 1), (2, 2), (2, 3), (3, 2), (3, 3)},
R3 = {(1, 1), (1, 3), (2, 2), (3, 1), (3, 3)}, and
R4 = {(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3)} = A × A
are all equivalence relations on A.
Computer Recognition -
Zero-One Matrices and Directed Graphs
If R1 ⊆ A × B and R2 ⊆ B × C, then the composite relation R1 ◦ R2 is a
relation from A to C defined by
R1◦R2 = {(x, z) | x ∈ A, z ∈ C, and there exists y ∈ B with (x, y) ∈ R1, (y, z) ∈ R2}.
Definition 7.8
Let A = {1, 2, 3, 4}, B = {w, x, y, z}, and C = {5, 6, 7}.
Consider R1 = {(1, x), (2, x), (3, y), (3, z)}, a relation from A to B, and
R2 = {(w, 5), (x, 6)}, a relation from B to C.
Then R1 ◦ R2 = {(1, 6), (2, 6)} is a relation from A to C.
If R3 = {(w, 5), (w, 6)} is another relation from B to C, then R1 ◦ R3 = ∅.
Example
Theorem 7.1
Let A, B, C and D be sets with R1 ⊆ A × B, R2 ⊆ B × C, and R3 ⊆ C × D.
Then
R1 ◦ (R2 ◦ R3) = (R1 ◦ R2) ◦ R3.
Definition 7.9
Powers of R on A recursively defined by
(a) R1 = R and
(b) Rn+1 = R ◦ Rn, where n ∈ Z+.
Let A = {1, 2, 3, 4}, and R = {(1, 2), (1, 3), (2, 4), (3, 2)}, then
R2 = {(1, 4), (1, 2), (3, 4)}, R3 = {(1, 4)}, and for n ≥ 4, Rn = ∅.
Example
An m × n zero matrix (Eij )m×n is a rectangular array of numbers
arranged in m rows and n columns, where each eij for 1 ≤ i ≤ m and 1 ≤ j ≤ n,
denotes the entry in the ith row and jth column of E, and each such entry is 0 or 1. [We can also write (0, 1)-matrix for this type of matrix.]
Definition 7.10
The matrix
is a 3 × 4 (0, 1)-matrix where, for example,
e11 = 1, e23 = 0, e31 = 1.
Let A = {1, 2, 3, 4}, B = {w, x, y, z}, and C = {5, 6, 7}.
R1 = {(1, x), (2, x), (3, y), (3, z)}, a relation from A to B, and
R2 = {(w, 5), (x, 6)}, a relation from B to C.
Define the relation matrices for R1, R2 as follows:
Example
Example
The product of the relation matrices for R1, R2 equals the relation matrix
of the composite relation R1 ◦ R2.
Let A be a set with |A| = n and R a relation on A. If M (R) is the relation
matrix for R, then
(a) M (R) = 0 (the matrix of all 0’s) if and only if R = ∅
(b) M (R) = 1 (the matrix of all 1’s) if and only if R = A × A
(c) M (Rm) = [M(R)]m for m ∈ Z+
Properties
Let E = (eij )m×n and F = (fij )m×n be two m × n (0, 1)-matrices.
We say that E precedes, or is less than, F , and we write E ≤ F , if eij ≤ fij , for all 1 ≤ i ≤ m, 1 ≤ j ≤ n.
Definition 7.11
example
• For V = {1, 2, 3, 4, 5}, the diagram in Fig. 7.1 is a directed graph G on V
with edge set {(1, 1), (1, 2), (1, 4), (3, 2)}.
• Undirected graph {a, b} = {b, a}.
Example
Precedence Graph
• Dependency among statements (computer programs)
(s1) b := 3
(s2) c := b + 2
(s3) a := 1
(s4) d := a ∗ b + 5
(s5) e := d − 1
(s6) f := 7
(s7) e := c + d
(s8) g := b ∗ f
If the directions in Fig. 7.4(a) are ignored, we get the associated undirected
graph shown in Fig. 7.4(b).
• path (no vertex may be repeated)
• closed path → cycle (length at least 3)
A directed graph G on V is called strongly connected if for all x, y ∈ V , where
x̸ = y, there is a path (in G) of directed edges from x to y – that is, ei-
ther the directed edge (x, y) is in G or, for some n ∈ Z+ and distinct vertices
v1, v2, . . . , vn ∈ V , the directed edges (x, v1), (v1, v2), . . . , (vn, y) are in G.
Definition 7.15
Example
• In Fig. 7.5 the directed graph on V = {1, 2, 3, 4} is strongly connected
and loop-free.
This is also true of the directed graph in Fig. 7.4(d)
• both R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (3, 4), (4, 3), (4, 4)} and R2 =
{(2, 4), (2, 3), (3, 2), (3, 3), (3, 4)} are disconnected
• two components in each graph
Example
The graphs in Fig. 7.7 are examples of undirected graphs that are loop-
free and have an edge for every pair of distinct vertices. These graphs
illustrate the complete graphs on n vertices, which are denoted by Kn.
A digraph G on a vertex set V gives rise to a relation R on V where xRy
if (x, y) is an edge in G.
• Both (0, 1)-matrix and digraph can describe relations
– The matrix is called the adjacency matrix for G
– Relation matrix for R
If A = {1, 2, 3} and R = {(1, 1), (1, 2), (2, 2), (3, 3), (3, 1)}, then R is a reflex-
ive antisymmetric relation on A, but it is neither symmetric nor transitive. The
directed graph associated with I consists of five edges. Three of these edges are
loops that result from the reflexive property of R. (See Fig. 7.8.) In general, if
R is a relation on a finite set A, then R is reflexive if and only if its directed
graph contains a loop at each vertex (element of A)
The relation R = {(1, 1), (1, 2), (2, 1), (2, 3), (3, 2)} is symmetric on A =
{1, 2, 3}, but it is not reflexive, antisymmetric, or transitive. The directed graph
for R is found in Fig. 7.9. In general, a relation R on a finite set A is symmetric
if and only if its directed graph may be drawn so that it contains only loops and
undirected edges
• For A = {1, 2, 3}, consider R = {(1, 1), (1, 2), (2, 3), (1, 3)}. Here R is
transitive and antisymmetric but not reflexive or symmetric. The directed
graph indicates that a relation on a set A is transitive if and only if it
satisfies the following: For all x, y ∈ A, if there is a (directed) path from
x to y in the associated graph, then there is an edge (x, y) also.
• To use the directed graph of Fig. 7.10 to characterize antisymmetry, we
observe that for any two vertices x, y, with x̸ = y, the graph contains at
most one of the edges (x, y) or (y, x). Hence there are no undirected edges
aside from loops
For A = {1, 2, 3, 4, 5}, the following are equivalence relations on A:
R1 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (3, 4), (4, 3), (4, 4), (5, 5)},
R2 = {(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3), (4, 4), (4, 5), (5, 4), (5, 5)}.
• In general, a relation on a finite set A is an equivalence relation if and only
if its associated graph is one complete graph augmented by loops at every
vertex or consists of the disjoint union of complete graphs augmented by
loops at every vertex.
FOR YOUR ATTENTION
THANK YOU