Discrete Mathematics

Discrete Mathematics
W EN -C HING L IEN
Department of Mathematics
National Cheng Kung University
2008
W EN -C HING L IEN
Discrete Mathematics
7.2: Zero-One Matrices and Directed Graphs
Definition (7.8)
If A, B, and C are sets with 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 }
Example (7.17)
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 ◦ R2 = ∅
W EN -C HING L IEN
Discrete Mathematics
7.2: Zero-One Matrices and Directed Graphs
Definition (7.8)
If A, B, and C are sets with 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 }
Example (7.17)
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 ◦ R2 = ∅
W EN -C HING L IEN
Discrete Mathematics
7.2: Zero-One Matrices and Directed Graphs
Definition (7.8)
If A, B, and C are sets with 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 }
Example (7.17)
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 ◦ R2 = ∅
W EN -C HING L IEN
Discrete Mathematics
7.2: Zero-One Matrices and Directed Graphs
Definition (7.8)
If A, B, and C are sets with 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 }
Example (7.17)
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 ◦ R2 = ∅
W EN -C HING L IEN
Discrete Mathematics
7.2: Zero-One Matrices and Directed Graphs
Definition (7.8)
If A, B, and C are sets with 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 }
Example (7.17)
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 ◦ R2 = ∅
W EN -C HING L IEN
Discrete Mathematics
Theorem (7.1)
Let A, B, C and D be sets with R1 ⊆ A × B , R2 ⊆ B × C,
R3 ⊆ C × D. Then R1 ◦ (R2 ◦ R3 ) = (R1 ◦ R2 ) ◦ R3 .
W EN -C HING L IEN
Discrete Mathematics
Definition (7.9)
Given a set A and a relation R on A, we define the powers of R
recursively by
(a) R 1 = R; and
(b) for n ∈ Z + , R n+1 = R ◦ R n .
Definition (7.10)
An m × n zero-one matrix E = (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 such entry is 0 or 1.
W EN -C HING L IEN
Discrete Mathematics
Definition (7.9)
Given a set A and a relation R on A, we define the powers of R
recursively by
(a) R 1 = R; and
(b) for n ∈ Z + , R n+1 = R ◦ R n .
Definition (7.10)
An m × n zero-one matrix E = (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 such entry is 0 or 1.
W EN -C HING L IEN
Discrete Mathematics
Example (7.21)
Consider the sets A, B, and C and the relations R1 , R2 of
Example 7,17. With the orders of the elements in A, B, and C
fixed as in that example, we define the relation matrices for
R1 , R2 as follows:




0 1 0 0
1 0 0
 0 1 0 0 
 0 1 0 



M(R1 ) = 
 0 0 1 0  M(R2 ) =  0 0 0 
0 0 0 0
0 0 0



0 1 0 0
1 0 0
 0 1 0 0  0 1 0 


M(R1 ) · M(R2 ) = 
 0 0 1 0  0 0 0  =
0 0 0 0
0 0 0


0 1 0
 0 1 0 


 0 0 0  = M(R1 ◦ R2 ).
0 0 0
W EN -C HING L IEN
Discrete Mathematics
Example (7.21)
Consider the sets A, B, and C and the relations R1 , R2 of
Example 7,17. With the orders of the elements in A, B, and C
fixed as in that example, we define the relation matrices for
R1 , R2 as follows:




0 1 0 0
1 0 0
 0 1 0 0 
 0 1 0 



M(R1 ) = 
 0 0 1 0  M(R2 ) =  0 0 0 
0 0 0 0
0 0 0



0 1 0 0
1 0 0
 0 1 0 0  0 1 0 


M(R1 ) · M(R2 ) = 
 0 0 1 0  0 0 0  =
0 0 0 0
0 0 0


0 1 0
 0 1 0 


 0 0 0  = M(R1 ◦ R2 ).
0 0 0
W EN -C HING L IEN
Discrete Mathematics
Example (7.21)
Consider the sets A, B, and C and the relations R1 , R2 of
Example 7,17. With the orders of the elements in A, B, and C
fixed as in that example, we define the relation matrices for
R1 , R2 as follows:




0 1 0 0
1 0 0
 0 1 0 0 
 0 1 0 



M(R1 ) = 
 0 0 1 0  M(R2 ) =  0 0 0 
0 0 0 0
0 0 0



0 1 0 0
1 0 0
 0 1 0 0  0 1 0 


M(R1 ) · M(R2 ) = 
 0 0 1 0  0 0 0  =
0 0 0 0
0 0 0


0 1 0
 0 1 0 


 0 0 0  = M(R1 ◦ R2 ).
0 0 0
W EN -C HING L IEN
Discrete Mathematics
Example (7.21)
Consider the sets A, B, and C and the relations R1 , R2 of
Example 7,17. With the orders of the elements in A, B, and C
fixed as in that example, we define the relation matrices for
R1 , R2 as follows:




0 1 0 0
1 0 0
 0 1 0 0 
 0 1 0 



M(R1 ) = 
 0 0 1 0  M(R2 ) =  0 0 0 
0 0 0 0
0 0 0



0 1 0 0
1 0 0
 0 1 0 0  0 1 0 


M(R1 ) · M(R2 ) = 
 0 0 1 0  0 0 0  =
0 0 0 0
0 0 0


0 1 0
 0 1 0 


 0 0 0  = M(R1 ◦ R2 ).
0 0 0
W EN -C HING L IEN
Discrete Mathematics
Example (7.22)
Let A = {1, 2, 3, 4} and R = {(1, 2), (1, 3), (2, 4), (3, 2)}.
Keeping the order of the elements in A fixed, we define the
relation matrix for R as follows:
M(R) is the 4 × 4 (0, 1)− matrix whose entries mij , for
1 ≤ i, j ≤ 4, are given by
1, if (i, j) ∈ R;
mij =
0, otherwise.




0 1 0 1
0 1 1 0
 0 0 0 0 
 0 0 0 1 
2



M(R) = 
 0 1 0 0  (M(R)) =  0 0 0 1 
0 0 0 0
0 0 0 0
...continued
W EN -C HING L IEN
Discrete Mathematics
Example (7.22)
Let A = {1, 2, 3, 4} and R = {(1, 2), (1, 3), (2, 4), (3, 2)}.
Keeping the order of the elements in A fixed, we define the
relation matrix for R as follows:
M(R) is the 4 × 4 (0, 1)− matrix whose entries mij , for
1 ≤ i, j ≤ 4, are given by
1, if (i, j) ∈ R;
mij =
0, otherwise.




0 1 0 1
0 1 1 0
 0 0 0 0 
 0 0 0 1 
2



M(R) = 
 0 1 0 0  (M(R)) =  0 0 0 1 
0 0 0 0
0 0 0 0
...continued
W EN -C HING L IEN
Discrete Mathematics
Example (7.22)
Let A = {1, 2, 3, 4} and R = {(1, 2), (1, 3), (2, 4), (3, 2)}.
Keeping the order of the elements in A fixed, we define the
relation matrix for R as follows:
M(R) is the 4 × 4 (0, 1)− matrix whose entries mij , for
1 ≤ i, j ≤ 4, are given by
1, if (i, j) ∈ R;
mij =
0, otherwise.




0 1 1 0
0 1 0 1
 0 0 0 1 
 0 0 0 0 
2



M(R) = 
 0 1 0 0  (M(R)) =  0 0 0 1 
0 0 0 0
0 0 0 0
...continued
W EN -C HING L IEN
Discrete Mathematics
Example (7.22)
Let A = {1, 2, 3, 4} and R = {(1, 2), (1, 3), (2, 4), (3, 2)}.
Keeping the order of the elements in A fixed, we define the
relation matrix for R as follows:
M(R) is the 4 × 4 (0, 1)− matrix whose entries mij , for
1 ≤ i, j ≤ 4, are given by
1, if (i, j) ∈ R;
mij =
0, otherwise.




0 1 0 1
0 1 1 0
 0 0 0 0 
 0 0 0 1 
2



M(R) = 
 0 1 0 0  (M(R)) =  0 0 0 1 
0 0 0 0
0 0 0 0
...continued
W EN -C HING L IEN
Discrete Mathematics
Example (7.22 continued)


0 0 0 0
 0 0 0 0 

(M(R))4 = 
 0 0 0 0 
0 0 0 0
W EN -C HING L IEN
Discrete Mathematics
Rules:
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(R)]m , for m ∈ Z +
W EN -C HING L IEN
Discrete Mathematics
Rules:
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(R)]m , for m ∈ Z +
W EN -C HING L IEN
Discrete Mathematics
Rules:
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(R)]m , for m ∈ Z +
W EN -C HING L IEN
Discrete Mathematics
Rules:
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(R)]m , for m ∈ Z +
W EN -C HING L IEN
Discrete Mathematics
Definition (7.11)
Let E = (eij )m×n , 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.12)
For n ∈ Z + , In = (δij )n×n is the n × n (0, 1)− matrix where
1, if i = j;
δij =
0, if i 6= j.
W EN -C HING L IEN
Discrete Mathematics
Definition (7.11)
Let E = (eij )m×n , 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.12)
For n ∈ Z + , In = (δij )n×n is the n × n (0, 1)− matrix where
1, if i = j;
δij =
0, if i 6= j.
W EN -C HING L IEN
Discrete Mathematics
Definition (7.11)
Let E = (eij )m×n , 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.12)
For n ∈ Z + , In = (δij )n×n is the n × n (0, 1)− matrix where
1, if i = j;
δij =
0, if i 6= j.
W EN -C HING L IEN
Discrete Mathematics
Definition (7.13)
Let A = (aij )m×n be a (0, 1)− matrix.
The transpose of A, written Atr , is the matrix (a∗ ji )n×m where
a∗ ji = aij , for all 1 ≤ i ≤ m, 1 ≤ j ≤ n.
W EN -C HING L IEN
Discrete Mathematics
Definition (7.13)
Let A = (aij )m×n be a (0, 1)− matrix.
The transpose of A, written Atr , is the matrix (a∗ ji )n×m where
a∗ ji = aij , for all 1 ≤ i ≤ m, 1 ≤ j ≤ n.
W EN -C HING L IEN
Discrete Mathematics
Definition (7.14)
Let V be a finite nonempty set. A directed graph (or digraph) G
on V is made up of the elements of V, called the vertices or
nodes of G, and a subset E, of V × V , that contains the
(directed) edges, or arcs, of G.The set V is called the vertex set
of G, and the set E is called the edge set.
We then write G = (V , E ) to denote the graph.
If a, b ∈ V and (a, b) ∈ E , then there is an edge from a to
b.Vertex a is called the origin or source of the edge, with b the
terminus, or terminating vertex, and we say that b is adjacent
from a and that a is adjacent to b.In addition, if a 6= b, then
(a, b) 6= (b, a). An edge of the form (a, a) is called a loop (at a).
W EN -C HING L IEN
Discrete Mathematics
Definition (7.14)
Let V be a finite nonempty set. A directed graph (or digraph) G
on V is made up of the elements of V, called the vertices or
nodes of G, and a subset E, of V × V , that contains the
(directed) edges, or arcs, of G.The set V is called the vertex set
of G, and the set E is called the edge set.
We then write G = (V , E ) to denote the graph.
If a, b ∈ V and (a, b) ∈ E , then there is an edge from a to
b.Vertex a is called the origin or source of the edge, with b the
terminus, or terminating vertex, and we say that b is adjacent
from a and that a is adjacent to b.In addition, if a 6= b, then
(a, b) 6= (b, a). An edge of the form (a, a) is called a loop (at a).
W EN -C HING L IEN
Discrete Mathematics
Definition (7.14)
Let V be a finite nonempty set. A directed graph (or digraph) G
on V is made up of the elements of V, called the vertices or
nodes of G, and a subset E, of V × V , that contains the
(directed) edges, or arcs, of G.The set V is called the vertex set
of G, and the set E is called the edge set.
We then write G = (V , E ) to denote the graph.
If a, b ∈ V and (a, b) ∈ E , then there is an edge from a to
b.Vertex a is called the origin or source of the edge, with b the
terminus, or terminating vertex, and we say that b is adjacent
from a and that a is adjacent to b.In addition, if a 6= b, then
(a, b) 6= (b, a). An edge of the form (a, a) is called a loop (at a).
W EN -C HING L IEN
Discrete Mathematics
Definition (7.14)
Let V be a finite nonempty set. A directed graph (or digraph) G
on V is made up of the elements of V, called the vertices or
nodes of G, and a subset E, of V × V , that contains the
(directed) edges, or arcs, of G.The set V is called the vertex set
of G, and the set E is called the edge set.
We then write G = (V , E ) to denote the graph.
If a, b ∈ V and (a, b) ∈ E , then there is an edge from a to
b.Vertex a is called the origin or source of the edge, with b the
terminus, or terminating vertex, and we say that b is adjacent
from a and that a is adjacent to b.In addition, if a 6= b, then
(a, b) 6= (b, a). An edge of the form (a, a) is called a loop (at a).
W EN -C HING L IEN
Discrete Mathematics
Definition (7.14)
Let V be a finite nonempty set. A directed graph (or digraph) G
on V is made up of the elements of V, called the vertices or
nodes of G, and a subset E, of V × V , that contains the
(directed) edges, or arcs, of G.The set V is called the vertex set
of G, and the set E is called the edge set.
We then write G = (V , E ) to denote the graph.
If a, b ∈ V and (a, b) ∈ E , then there is an edge from a to
b.Vertex a is called the origin or source of the edge, with b the
terminus, or terminating vertex, and we say that b is adjacent
from a and that a is adjacent to b.In addition, if a 6= b, then
(a, b) 6= (b, a). An edge of the form (a, a) is called a loop (at a).
W EN -C HING L IEN
Discrete Mathematics
Definition (7.14)
Let V be a finite nonempty set. A directed graph (or digraph) G
on V is made up of the elements of V, called the vertices or
nodes of G, and a subset E, of V × V , that contains the
(directed) edges, or arcs, of G.The set V is called the vertex set
of G, and the set E is called the edge set.
We then write G = (V , E ) to denote the graph.
If a, b ∈ V and (a, b) ∈ E , then there is an edge from a to
b.Vertex a is called the origin or source of the edge, with b the
terminus, or terminating vertex, and we say that b is adjacent
from a and that a is adjacent to b.In addition, if a 6= b, then
(a, b) 6= (b, a). An edge of the form (a, a) is called a loop (at a).
W EN -C HING L IEN
Discrete Mathematics
Definition (7.14)
Let V be a finite nonempty set. A directed graph (or digraph) G
on V is made up of the elements of V, called the vertices or
nodes of G, and a subset E, of V × V , that contains the
(directed) edges, or arcs, of G.The set V is called the vertex set
of G, and the set E is called the edge set.
We then write G = (V , E ) to denote the graph.
If a, b ∈ V and (a, b) ∈ E , then there is an edge from a to
b.Vertex a is called the origin or source of the edge, with b the
terminus, or terminating vertex, and we say that b is adjacent
from a and that a is adjacent to b.In addition, if a 6= b, then
(a, b) 6= (b, a). An edge of the form (a, a) is called a loop (at a).
W EN -C HING L IEN
Discrete Mathematics
Example (7.25)
For V = {1, 2, 3, 4, 5}, the diagram in Fig. 7.1 is a digraph G on
V with edge set {(1, 1), (1, 2), (1, 4), (3, 2)}.
Vertex 5 is a part of this graph even though it’s not the origin or
terminus of and edge.
It is referred to as an isolated vertex.
As we see here, edges need not be straight line segments, and
there is no concern about the length of an edge.
W EN -C HING L IEN
Discrete Mathematics
Example (7.25)
For V = {1, 2, 3, 4, 5}, the diagram in Fig. 7.1 is a digraph G on
V with edge set {(1, 1), (1, 2), (1, 4), (3, 2)}.
Vertex 5 is a part of this graph even though it’s not the origin or
terminus of and edge.
It is referred to as an isolated vertex.
As we see here, edges need not be straight line segments, and
there is no concern about the length of an edge.
W EN -C HING L IEN
Discrete Mathematics
Example (7.25)
For V = {1, 2, 3, 4, 5}, the diagram in Fig. 7.1 is a digraph G on
V with edge set {(1, 1), (1, 2), (1, 4), (3, 2)}.
Vertex 5 is a part of this graph even though it’s not the origin or
terminus of and edge.
It is referred to as an isolated vertex.
As we see here, edges need not be straight line segments, and
there is no concern about the length of an edge.
W EN -C HING L IEN
Discrete Mathematics
Example (7.25)
For V = {1, 2, 3, 4, 5}, the diagram in Fig. 7.1 is a digraph G on
V with edge set {(1, 1), (1, 2), (1, 4), (3, 2)}.
Vertex 5 is a part of this graph even though it’s not the origin or
terminus of and edge.
It is referred to as an isolated vertex.
As we see here, edges need not be straight line segments, and
there is no concern about the length of an edge.
W EN -C HING L IEN
Discrete Mathematics
Thank you.
W EN -C HING L IEN
Discrete Mathematics