Math 471 - Full

advertisement
Math 471
MIDTERM II INFORMATION
SOLUTIONS TO PRACTICE PROBLEMS
Fall 2014
1. Let fn denote the nth Fibonacci number (recall: f0 = 0 and f1 = 1). Show that for every
positive integer n, we have
fn+1 fn-1 – fn2 = (-1)n.
SOLUTION: We prove this by induction on n.
BASE CASE (n=1): We have f2f0 – f12 = (1)(0) – (1)2 = -1 = (-1)1.
STEP. Assume that fnfn-2 – fn-12 = (-1)n-1. (This is the n-1 version of the formula.) Now
we want to prove the “n” version of the formula. We have
fn+1 fn-1 – fn2 = (fn + fn-1) fn-1 – fn2 = fn fn-1 + fn-12 – fn2 = fn (fn-1 – fn) + fn-12 =
= -fnfn-2 + fn-12 = -[fnfn-2 – fn-12] = - (-1)n-1 = (-1)n.
2. For each n ≥ 1, let f(n) be the number of subsets of {1,2,3,…,n} which contain no two
consecutive integers.
(a) Find f(1), f(2), and f(3).
SOLUTION: f(1) is the number of subsets of {1} that contain no 2 consecutive integers.
Both the empty set and {1} do not contain 2 consecutive integers, so there are 2 such
subsets. Hence, f(1) =2.
f(2) contains all subsets of {1,2} except {1,2} itself. Thus, we have 3 other subsets.
Hence, f(2) = 3.
F(3) contains all subsets of {1,2,3} except {1,2}, {2,3}, and {1,2,3}. Thus, we have
8-3 = 5 such subsets, so f(3) = 5.
(b) Find a recurrence relation for f(n) and use it to find f(8).
SOLUTION: f(n) counts all subsets of {1,2,3,…,n} that do not contain 2 consecutive
integers. We break these subsets into 2 groups: those that do not contain {n} and those
that do. For the former case, note obviously that any subset of {1,2,3,…n-1} that does
not contain 2 consecutive integers will be counted in f(n). There are f(n-1) such subsets.
In the second case, there are the subsets of {1,2,3,…,n} that specifically DO contain {n},
which means they do not contain {n-1}. Hence, for each of the f(n-2) subsets of
{1,2,3…,n-2}, we can adjoin {n} to get a subset that contains {n} (and thus was not
counted by the first group). So we get f(n-2) subsets in this case.
Hence, the recurrence relation is f(n) = f(n-1) + f(n-2), which happens to be the Fibonacci
relation. Thus, f(4) = 8, f(5) = 13, f(6) = 21, f(7) = 34, and f(8) = 55.
6. Find a recurrence relation for the number of ways to cover a 1 X n board with
monominoes (1 X 1), dominos (1 X 2), and triominos (1 X 3).
SOLUTION: Let an be the number of ways to cover the 1 X n board. There are three
types of coverings of the 1 X n board: (a) those that start with a monomino, (b) those that
start with a domino, and (c) those that start with a domino. To each covering that starts
with a monomino (type (a)), we have an-1 ways to finish the covering. To each covering
that starts with a domino (type (b)), we have an-2 ways to finish the covering. And to each
covering that starts with a trinomino (type (c)), we have an-3 ways to finish the covering.
Since each covering of the board falls into exactly one of these three types, we can
simply add up the number of coverings in each type to obtain the recurrence relation:
an = an-1 + an-2 + an-3.
7. What are the initial conditions for the recurrence relation you found in Problem 6?
Use the relation to find the number of ways to cover a 1 X 9 board in Problem 6.
SOLUTION: The recurrence relation had order 3, so we need to find 3 initial values: a1
= 1, a2 = 2, a3 = 4. Then a4 = 7, a5 = 13, a6 = 24, a7 = 44, a8 = 81, and a9 =149.
8. Solve each recurrence relation below:
(a): an = an-1 + 2an-2, with a0 = 2 and a1 = 7.
SOLUTION: The characteristic equation is q2 = q + 2, so we get q2 – q - 2 = 0, which
factors as (q-2)(q+1) = 0. The roots are q=2 and q=-1, so the general solution to the
recurrence relation takes the form an = c1 2n + c2 (-1)n. Now 2 = a0 = c1 + c2, and 7 = a1 =
= 2c1 – c2. We quickly solve to find that c1 = 3 and c2 = -1. So the solution to the
recurrence relation is an = 3*2n – (-1)n.
(b): an = -3an-1 – 3an-2 – an-3, with a0 = 1, a1 = -2, and a2 = -1.
SOLUTION: The characteristic equation is q3 = -3q2 – 3q – 1, or q3 + 3q2 + 3q + 1 = 0,
or (q+1)3 = 0. So the general solution is an = c1(-1)n + c2 n(-1)n + c3 n2(-1)n. Now we
must solve for the coefficients. We have 1 = a0 = c1. Next,
-2 = a1 = -c1 – c2 –c3 = -1 – c2 – c3. Thus, c2 + c3 = 1. Finally,
-1 = a2 = c1 + 2c2 + 4c3 = 1 + 2c2 + 4c3. So 2c2 + 4c3 = -2. Solving, we quickly find that
c2 = 3 and c3 = -2. So the specific solution here is
an = (-1)n + 3n(-1)n – 2n2(-1)n.
(c): an = 5an-1 – 6an-2 + 7n, with no initial values given.
SOLUTION: We first must solve the corresponding homogeneous recurrence relation,
whose characteristic equation is q2 = 5q – 6 or q2 – 5q + 6 = 0 or (q-2)(q-3)=0, whose
roots are q=2 and q=3. So the general solution to the homogeneous recurrence relation is
an = c1(2)n + c2(3)n. Next, we try a particular solution of the form an(p) = p*7n. Plugging
this into both sides, we obtain p = 49/20. So an(p)= 49/20 (7)n. So the final general
solution takes the form an = c1(2)n + c2(3)n + 49/20(7)n.
9. For n ≥ 1, let Qn be the graph whose vertices are labeled with bit strings of length n.
Two vertices are connected if and only if their bit string labels differ in exactly one place.
(a) Draw Q1, Q2, Q3, and Q4.
SOLUTION:
Above we see the graphs of Q1, Q2, and Q3. Q4 is simply two copies of Q3 with
corresponding vertices of the two copies connected by an edge.
(b) How many vertices are there in Qn?
SOLUTION: From the pattern above, we see that it is 2n. This is also because there are
exactly 2n bit strings of length n, and each such string is represented with a vertex.
(c) How many edges are there in Qn?
SOLUTION: Each vertex in Qn has degree n, so the total degree of the whole graph is
n2n. This is equal to 2|E|, so |E| = n2n-1.
(d) For which values of n is Qn bipartite?
SOLUTION: Qn is bipartite for all values of n. The bipartition of vertices can be
achieved by letting X consist of all vertices whose bit string label contains an even
number of 0’s and by letting Y consist of all vertices whose bit string label contains an
odd number of 0’s. Since bit strings are connected only if they differ in one bit, only
vertices of X and Y can be directly connected by an edge. Thus, the graph is bipartite.
(e) For which values of n does Qn have a closed Eulerian trail?
SOLUTION: The degree of each vertex of the graph is n, so a closed Eulerian trail
exists precisely when n is even.
(f) For which values of n does Qn have a Hamilton cycle?
SOLUTION: The graph will have a Hamilton cycle for all values of n. The way to
understand this is to note that Qn can be viewed as two copies of Qn-1 in which
corresponding vertices in the two copies have been connected. We can trace a Hamilton
path in one copy of Qn-1, then move along an edge to the other copy, trace a Hamilton
path in the second copy that ends with the vertex corresponding to the starting position,
then move along an edge back to the starting position, thus closing the cycle.
(g) Determine the values of n such that Qn is planar.
SOLUTION: The graph will be planar for n = 1,2,3 only. The reason is that, since the
graph contains no cycles of length 3, a planar graph would have to satisfy e ≤ 2v-4, where
e is the number of edges and v is the number of vertices. But e = n2n-1 and v = 2n.
However, for n = 4,5,6,…., n2n-1 is more than 2*2n-4.
(h) Determine the chromatic number of Qn.
SOLUTION: Since the graph is always bipartite, its chromatic number is 2.
10. Decide whether each graph below has an open Eulerian trail, closed Eulerian trail,
Hamilton cycle, and/or Hamilton path. Exhibit any of them that do exist, and prove why
the others cannot exist:
(a):
B
A
D
F
C
I
J
K
L
M
N
O
P
Q
G
E
H
SOLUTION: Since there are 4 vertices of odd degree (B,D,G,E), this graph has no
Eulerian trail (open or closed). Since vertices A,C,F,and H all have degree 2, a Hamilton
cycle would have to make use of all edges on the outside square, thus forming a
premature subcycle. Hence, no Hamilton cycle is possible. A Hamilton path is also
impossible. This is because there are 8 vertices of degree 2, so at least 6 of these must
occur on the interior of the Hamilton path. But if A,C,F, and H are all on the interior of
the path, we have a premature cycle, and if I,K,O, and Q are all on the interior of the
path, we have a premature cycle. Thus, one of the corner vertices of the outer square
must be at the end of the path, and one of the corner vertices of the inner square must be
at the other end of the path. Without loss of generality, assume that A is the starting point
of the path and that edge {A,B} is not used. Then the remaining edges on the outer
square must be used. Thus, edges {N,E}, {P,G}, and {D,L} will not be used by the path.
Say it is {B,J}. Then edges {I,L}, {L,O},{O,P},{P,Q},{Q,N},{N,K} will all be used.
Hence, {L,M}, {M,P}, and {M,N} cannot be used, so that it is impossible to enter and
leave vertex M. Thus, such a path is impossible.
(b):
S
R
X
W
V
U
T
SOLUTION: There are exactly two vertices of odd degree (V and X). Thus, an open
Eulerian trail is possible, but a closed one is not. Such a trail would be
V  R  S  V  W  S  T  W  X  T  U  X. A Hamilton cycle (and
path) are obviously possible here:
R  S  T  U  X  W  V  R (where the last edge is omitted for a path).
(c):
A
F
E
J
G
I
D
B
H
C
SOLUTION: Every vertex has odd degree, so no Eulerian trails (open or closed) are
possible. A Hamilton path is possible, such as
A  E  D  C  B  G I F  H  J.
However, no Hamilton cycle is possible. To see this, observe that one of the edges on the
outer pentagon cannot be used by the cycle (or it will be premature). Let us assume
without loss of generality that {A,B} is not used. Then {A,E}, {A,F}, {G,B} and {B,C}
are all used. If the edge {E,J} is not used, then we would be forced to have the premature
cycle J  G  B  C  H  J. Thus, we must use the edge {E,J}. This means we
cannot use the edge {E,D}, which in turn forces us to use the edges {I,D} and {D,C}.
This, in turn, means we cannot use edge {H,C}, which in turn forces us to use edges
{F,H} and {H,J}, creating the premature cycle A  F  H  J  E  A. Thus, no
Hamilton cycle is possible here.
11. Decide whether the pairs of graphs shown below are isomorphic or not. For those
that are, exhibit a valid isomorphism. For those that are not, find a structural difference
between the graphs:
(a):
A
B
E
1
H
2
5
F
6
8
G
D
C
7
4
3
SOLUTION: These graphs are not isomorphic. In the graph on the left, the two vertices
of degree 3 are not connected by an edge, but in the graph on the right, they are not.
(b):
1
A
B
2
5
3
D
E
C
4
SOLUTION: These graphs are isomorphic. One isomorphism would be the
correspondence C  2, B  5, D  3, A  1, and E  4, although there
are others.
(c):
1
A
B
F
E
4
C
D
3
6
5
2
SOLUTION: These graphs are isomorphic. One isomorphism would be the
correspondence F  4, C  1, B  3, D  2, A  6, E  5, although
there are others.
12. Draw all isomorphism types of trees of order 6.
SOLUTION: These are shown in Figure 11.26 in the textbook.
13. Find, with proof, the crossing numbers of the graphs in Figures 1-4 below:
FIGURE 1:
A
B
D
E
G
F
C
SOLUTION: The crossing number of Figure 1 is zero. This is seen by moving A near
the segment DG, B near the segment EG, and C near the segment FG, all inside triangle
DEF. Then we have a planar representation of the graph, and hence, it has crossing
number = 0.
FIGURE 2:
I
H
J
M
N
K
L
SOLUTION: The graph in Figure 2 contains 18 edges and 7 vertices. Since 18 > 3*7-6
= 15, this graph is not planar. In fact, if 2 edges are removed from the graph, it still is not
planar (since 16 > 15). So the crossing number of the graph must be at least 3. By
pulling edges HJ,JL, and LH outside of the hexagon, and leaving all other vertices as they
appear in the figure, we see that the resulting representation of the graph has exactly 3
crossing edges. Therefore, the crossing number of this graph is 3.
FIGURE 3:
O
P
Q
V
U
R
T
S
SOLUTION: The graph in Figure 3 contains 14 edges and 8 vertices, but no 3-cycles.
So a planar graph would need to satisfy 14 ≤ 2*8 – 4 = 12. Therefore, the crossing
number of this graph must be at least 2. To show a representation with exactly 2 crosses,
draw square OPST and place square VQRU inside of it. Then make the appropriate
connections from the inner square to the outer square. This can be done with no crossing
edges. The crossing edges then come from UP and TQ, each of which requires one cross
in the graph. Thus, the crossing number is 2.
FIGURE 4:
Yj
W
S
V
Z
T
U
X
SOLUTION: The crossing number is 1. (As it is drawn, there is only 1 cross, so the
crossing number is obviously at most 1.) It cannot be planar, however, because we have
a subgraph isomorphic to K3,3, and this graph, K3,3, we know is not planar. The two
camps of K3,3 present in the figure are {V,T,Y} and {W,S,U} (and we can ignore Z and X
for this observation).
14. Find the chromatic number of each graph in Figures 1-4 above.
SOLUTION
Figure 1: X(G) = 4. The subgraph induced by the
vertices D, E, F, and G is a complete graph on 4 vertices.
Hence, this graph will require at least 4 colors. In fact, 4
colors suffices (we can use Color 1 for G, Color 2 for A,E,C,
Color 3 for B,D and Color 4 for F.
Figure 2: X(G) = 4. Vertex N can use Color 1,
vertices H and K can use Color 2, vertices M and J can use
Color 3, and vertices L and I can use Color 4. We cannot get
by with fewer than 4 colors however, since this graph contains a
subgraph isomorphic to a complete graph on 4 vertices.
Figure 3: X(G) = 2. This graph is bipartite, hence its
chromatic number is 2.
Figure 4: X(G) = 3. Since this graph contains
3-cycles, its chromatic number must be at least 3. But if we
color vertices W, S, and U with Color 1, vertices V, T,
and Y with Color 2, and vertices X and Z with Color 3, we
obtain a valid 3-coloring.
15. Determine whether each graph in Figures 1-4 above has (a) a closed Eulerian trail,
(b) an open Eulerian trail, (c) a Hamilton path, and (d) a Hamilton cycle.
SOLUTION:
Figure 1: Since every vertex has even degree, this Figure
contains a closed Eulerian trail. For example, A  G B  E  G  C F  G 
D  F E  D  A. This graph contains
a Hamilton path; for example, A  D  F C  G  E  B.
However, it cannot contain a Hamilton cycle, because such a cycle
would have to contain all of the edges {A,G}, {B,G}, and
{C,G} (since vertices A, B, and C all have degree 2),
but this means that G would be visited by the cycle more than
once, a contradiction.
Figure 2: This graph has 6 vertices of odd degree, so no
Eulerian trails (open or closed) are possible. However, we
clearly have the Hamilton path H  N  M L  K  J  I, which
can be made into a cycle as well (by adding the edge I H to the end of the path above.
Figure 3: This graph has 4 vertices of odd degree, so no
Eulerian trails (open or closed) are possible. However, we
clearly have the Hamilton path P  O  V  U  T  S  R Q which can be made
into a cycle as well (by adding the edge Q  P to the end of the path above.
Figure 4: This graph has 4 vertices of odd degree, so no
Eulerian trails (open or closed) are possible. However, we
clearly have the Hamilton path W  Z  X  Y  S  V  U T, which can be
made into a cycle as well (by adding the edge T  W to the end of the path above.
16. Suppose that a valid codeword is an n-digit number in decimal notation containing an
even number of 0’s. Let an denote the number of valid codewords of length n.
(a) Show that the sequence {an} satisfies the recurrence relation an = 8an-1 + 10n-1, with
initial condition a1 = 9.
(b) Use generating functions to find an explicit formula for an.
SOLUTION:
(a) A valid codeword of length n either starts with a 0 or does not start with a 0. We
consider both cases:
Case 1: If the codeword starts with a 0, then the remaining n-1 digits must have an odd
number of zeros. The total number of codewords of length n-1 is 10n-1, and from this, we
subtract the number of valid codewords of length n-1 to get 10n-1 – an-1 valid codewords
that start with 0.
Case 2: If the codeword doesn’t start with 0, then there are 9 other digits that codeword
can start with, followed by an-1 valid ways to complete the last n-1 digits. Thus, we have
9an-1 valid codewords in this case.
Summing the results in these two cases, we find that an = 8an-1 + 10n-1, as required.
( b) Let g(x) = a0 + a1x + a2x2 + a3x3 + … be the generating function for the sequence an.
Note from the recurrence relation that a1 = 8a0 + 1. Since a1 = 9, we conclude that we
must set a0 = 1. Therefore, we have
g(x) – 1 = a1x + a2x2 + a3x3 + … = (8a0 + 100)x + (8a1 + 101)x2 + (8a2 + 102)x3 + …
= 8x(a0 + a1x + a2x2 + …) + x(100 + 101x + 102x2 + …)
= 8xg(x) + x/(1 – 10x).
Thus, g(x)(1 – 8x) = 1 + x/(1 – 10x), from which an algebraic manipulation shows that
g(x) = (1 – 9x)/(1 – 8x)(1 – 10x). Expanding the right side by using partial fractions, we
find that
g(x) = 0.5/(1 – 8x) + 0.5(1 – 10x). Now using the power series expansions of 1/(1 – 8x)
and 1/(1 – 10x), we quickly find that the coefficient of xn is 0.5(8n + 10n).
Download