Discrete Mathematics: Homework 8 Due: 1. (6%)How many

Discrete Mathematics: Homework 8
Due:
1. (6%)How many elements are in the union of four sets if each of the sets has 100
elements, each pair of the sets shares 50 elements, each three of the sets share 25
elements, and there are 5 elements in all four sets?
Sol:
4 · 100 − 6 · 50 + 4 · 25 − 5 = 195.
2. (8%) Find the number of solutions of the equation x1 +x2 +x3 +x4 = 17, where xi , i =
1, 2, 3, 4, are nonnegative integers such that x1 ≤ 3, x2 ≤ 4, x3 ≤ 5, and x4 ≤ 8.
Sol:
C(4 + 17 − 1, 17) − C(4 + 13 − 1, 13) − C(4 + 12 − 1, 12) − C(4 + 11 − 1, 11) − C(4 +
8 − 1, 8) + C(4 + 8 − 1, 8) + C(4 + 7 − 1, 7) + C(4 + 4 − 1, 4) + C(4 + 6 − 1, 6) +
C(4 + 3 − 1, 3) + C(4 + 2 − 1, 2) − C(4 + 2 − 1, 2) = 20.
3. (7%) How many onto functions are there from a set with seven elements to one with
five elements?
Sol:
57 − C(5, 1)47 + C(5, 2)37 − C(5, 3)27 + C(5, 4)17 = 16800.
4. (9%) Determine whether the graph shown has directed or undirected edges, whether
it has multiple edges, and whether it has one or more loops. Use your answers to
determine the type of graph in Table 1 of Sec. 9.1 this graph is.
(a) a
Sol:
This is a multigraph; the edges are undirected, and there are no loops, but
there are parallel edges.
(b) a
Sol:
This is a multigraph; the edges are undirected, and there are no loops, but
there are parallel edges.
(c) a
Sol:
This is a directed multigraph; the edges are directed, and there are parallel
edges.
5. (5%) Draw the acquaintanceship graph that represents that Tom and Patricia, Tom
and Hope, Tom and Sandy, Tom and Amy, Tom and Marika, Jeff and Patricia, Jeff
and Mary, Patricia and Hope, Amy and Hope, and Amy and Marika known each
other, but none of the other pairs of people listed know each other.
Sol:
Each person is represneted by a vertex, with an edge between two vertices if and
only if the people are acquainted.
6. (7%) Construct a precedence graph for the following program:
aaaaaS1 : x := 0
aaaaaS2 : x := x + 1
aaaaaS3 : y := 2
aaaaaS4 : z := y
aaaaaS5 : x := x + 2
aaaaaS6 : y := x + z
aaaaaS7 : z := 4
Sol:
We draw a picture of the directed graph in question. There is an edge from u to v if
the assignment made in u can possibly influence the assignment made in v. For
example, there is an edge from S3 to S6 , since the assignment in S3 changes the
value of y, which then influences the value of z (in S4 ) and hence has a bearing
on S6 . We assume that the statements are to be executed in the given order, so, for
example, we do not draw an edge from S5 to S2 .
7. (7%) Show that the sum, over the set of people at a party, of the number of people
a person has shaken hands with, is even. Assume that no one shakes his or her own
hand.
Sol:
Model this problem by letting the vertices of a graph be the people at the party,
with an edge between two people if they shake hands. Then the degree of each
vertex is the number of people the person that vertex represents shakes hands with.
By Theorem 1 of Sec. 9.2 the sum of the degrees is even (it is 2e).
8. (6%) Determine the number of vertices and edges and find the in-degree and outdegree of each vertex for the given directed multigraph.
(a) a
Sol:
In this directed mulitigraph there are 4 vertices and 8 edges. The degrees are deg − (a) =
2, deg + (a) = 2, deg − (b) = 3, deg + (b) = 4, deg − (c) = 2, deg + (c) = 1, deg − (d) = 1,
and deg + (d) = 1.
9. (8%) Determine whether the graph is bipartite. You may find it is useful to apply
Theorem 4 of Sec. 9.2 and answer the question by determining whether it is possible
to assign either red or blue to each vertex so that no two adjacent vertices are
assigned the same color.
(a) a
Sol:
This graph is bipartite, with bipartition {a, c} and {b, d, e}. In fact this is
the complete bipartite graph K2,3 . If this graph were missing the edge between a and b, then it would still be bipartite on the same sets, but not a
complete bipartite graph.
(b) a
Sol:
This is just like Exercise 9(a), but here we have the complete bipartite graph
K2,4 . The vertices in the part of size 2 are c and f , and the vertices in the part
of size 4 are a, b, d, and e.
10. (5%) Find the union of the given pair of simple graphs. (Assume edges with same
endpoints are the same.)
(a) a
Sol:
The union is shown here. The only common vertex is a, so we have reoriented
the drawing so that the pieces will not overlap.
11. (6%) Represent the graph with an adjacency matrix.
Sol:

0 1 0 1 0

 1 0 1


 0 1 1

 1 0 0

0 0 1


1 1 


0 0 

0 1 

0 1
12. (6%) Draw an undirected graph represented by the given adjacency matrix.


1 3 2


 3 0 4 


2 4 0
Sol:
13. (6%) Draw the graph represented by the

0 2

 1 2

 2 1

1 0
given adjacency matrix.

3 0

2 1 

1 0 

0 2
Sol:
14. (7%) Determine whether the given pair of graphs is isomorphic. Exhibit an isomorphism or provide a rigorous argument that none exists.
Sol:
These two graphs are isomorphic. Each consists of a K4 with a fifth vertex adjacent
to two of the vertices in the K4 . Many isomorphisms are possible. One is f (u1 ) =
v1 , f (u2 ) = v3 , f (u3 ) = v2 f (u4 ) = v5 , and f (u5 ) = v4
15. (7%) Determine whether the given pair of graphs is isomorphic. Exhibit an isomorphism or provide a rigorous argument that none exists.
Sol:
These graphs are not isomorphic. The degrees of the vertices are not the same (the
graph on the right has a vertex of degree 4, which the graph on the left lacks).
Extra Exercises:
1. Find the number of paths of length n between two different vertices in K4 if n is
(a) 2. (b) 3. (c) 4. (d) 5.
Sol:
One approach here is simply to invoke Theorem 2 and take successive powers of the
adjacency matrix

0 1 1 1

 1 0 1 1

 1 1 0 1

1 1 1 0






The answers are the off-diagonal elements of these powers. An alternative approach
is to argue combinatorially as follows. Without loss of generality, we assume that the
vertices are called 1,2,3,4, and the path is to run from 1 to 2. A path of length n is
determined by choosing the n − 1 intermediate vertices. Each vertex in the path
must differ from the one immediately preceding it.
(a.) A path of length 2 requires the choice of 1 intermediate vertex, which must
be different from both of the ends. Vertices 3 and 4 are the only ones available.
Therefore the answer is 2.
(b.) Let the path be denoted 1,x, y, 2. If x = 2, then there are 3 choices for y.
If x = 3, then there are 2 choices for y; similarly if x = 4. Therefore there are 3 +
2 + 2 = 7 possibilities in all.
(c.) Let the path be denoted 1, x, y, z, 2. If x = 3, then by part (b) there are 7 choices
for y and z. Similarly if x = 4. If x = 2, then y and z can be any two distinct
members of {1, 3, 4}, and there are P(3, 2) = 6 ways to choose them. Therefore
there are 7 + 7 + 6 = 20 possibilities in all.
(d.) Let the path be denoted 1, ω, x, y, z, 2. If ω = 3, then by part (c) there are 20
choices for x, y, and z. Similarly if ω = 4. If ω = 2, then x must be different from
2, and there are 3 choices for x. For each of these there are by part (b) 7 choices
for y and z. This gives a total of 21 possibilities in this case. Therefore the answer
is 20 + 20 + 21 = 61.
2. Find all the cut vertices of the given graph.
Sol:
Vertices c and d are the cut vertices. The removal of either one creates a graph with
two components. The removal of any other vertex does not disconnect the graph.
3. Find all the cut edges in the graphs in Extra Exercises 2.
Sol:
The {c, d} is the only cut edge.