Professional Documents
Culture Documents
8.1: 4: Let pn be the number of ways. The last coin used to pay is either a 1 coin,
2 coin, 5 coin, 10 coin, 5 bill, 10 bill, 20 bill, 50 bill, or 100 bill. If the last coin was
a 1, there are pn−1 ways, if it was a 2, there are pn−2 ways, etc. Thus we get pn =
pn−1 + pn−2 + 2pn−5 + 2pn−10 + pn−20 + pn−50 + pn−100 , with p0 = 1 and pn = 0 for n < 0.
8.1: 8:
(a) Let an be the number of such strings of length n and consider the placement of the
first 1. If the first 1 is in position 1, there are an−1 such bitstrings with 3 consecutive
0s. If the first 1 is in position 2, there are an−2 , and if it’s in position 3, there are an−3
such bitstrings. If the first 1 is in position 4 or later (or doesn’t occur at all), then
the first 3 digits are all 0, and the remaining digits can be anything they like, so 2n−3
possibilities. Thus
8.1: 10:
(a) Let an be this number and again consider the placement of the first 1. If the first 1 is
in position 1, there are an−1 such bitstrings containing a 01. If the first 1 is in position
2 or later there are 2n−1 − 1, since just before the 1 there’s a 0, as long as the first 1
exists (not the all 0 string). Thus
8.1: 12:
1
(a) If an is the number of ways, we have
an = an−1 + an−2 + an−3 for n ≥ 3
(b) a0 = 1, a1 = 1, a2 = 2.
(c) Working upwards, we get a3 = 4, a4 = 7, a5 = 13, a6 = 24, a7 = 44, a8 = 81. Hence
there are 81 ways.
8.1: 14:
(a) Let an be the number of such strings of length n and consider the placement of the first
non-zero. If the first non-zero is in positions 1 or 2, then there are 2an−1 and 2an−2
such strings respectively (multiplying by 2 since the first non-zero could be either a
1 or a 2). If the first non-zero is in position 3 or greater (or doesn’t occur at all),
we already have 2 consecutive 0s, so there are 3n−2 such ways (the number of ternary
strings of length n beginning with 2 0s). Thus
an = 2an−1 + 2an−2 + 3n−2 for n ≥ 2
8.1: 20:
(a) Let an be the number of ways he can pay an n-cent toll. After he pays 1 coin, he must
pay a toll of n minus the amount of that coin. Thus
an = an−5 + an−10 for n ≥ 10
with a0 = 1, a5 = 1, and all other an = 0 for n < 5.
(b) Working upwards, we get a10 = 2, a15 = 3, a20 = 5, a25 = 8, a30 = 13, a35 = 21,
a40 = 34, a45 = 55. Thus there are 55 ways to pay the toll. Note that these are the
reindexed Fibonacci numbers. Also, an = 0 for every n that isn’t a multiple of 5.
8.1: 24: Let an be the number of such bitstrings of length n. Consider the location of
the 2nd 0. If the 2nd 0 in the string occurs in position k, there are an−k ways to pick
what comes after that 0 (since we require an even number of 0s, as we’ve already placed
an even number). There are k − 1 ways to pick where the first 0 goes, so we get a total
of (k − 1)an−k such bitstring with the 2nd zero at position k. If we add this up over all
2 ≤ k ≤ n and add 1 (for the all 1’s string, which has no second 0), we must get an :
n
X
an = 1 + (k − 1)an−k
k=2
2
Surprisingly, the solution to this recurrence turns out to be an = 2n−1 (which you don’t
need to know how to do, at least for now).
8.1: 28: Let’s repeatedly use the fact that fn = fn−1 + fn−2 :
fn = fn−1 +fn−2 = (fn−2 +fn−3 )+fn−2 = 2(fn−3 +fn−4 )+fn−3 = 3(fn−4 +fn−5 )+2fn−4 = 5fn−4 +3fn−5 .
(If you know that fn counts the number of ways to fill a strip of length n − 1 with squares
and dominoes, you can also prove this result combinatorially.)
Let’s prove this by weak induction. Note that f0 is divisible by 5 (as is f5 = 2 + 3 = 5),
our base case. Suppose that f5n is divisible by 5. Then f5(n+1) = f5n+5 = 5f5n+1 + 3f5n ,
which is divisible by 5 because f5n is, by the induction hypothesis. Thus f5(n+1) is divisible
by 5, and so f5n is for all n by induction.
8.2: 4(a,e,f ):
(a) The characteristic equation is r2 − r − 6 = 0, which factors as (r − 3)(r + 2) = 0, and
so has roots r = 3 and r = −2. Thus an = α1 3n + α2 (−2)n for some α1 , α2 .
Plugging in the base cases, we get 3 = a0 = α1 + α2 and 6 = a1 = 3α1 − 2α2 .
3 12
Then α1 = 6 − α2 , so 6 = 3(3 − α2 ) − 2α2 = 9 − 5α2 , so α2 = 5
and α1 = 5
.
Thus
12 n 3
an = · 3 + · (−2)n
5 5
Let’s check this: we have a2 = 6 + 18 = 24 by the recurrence, and our formula gives
a2 = 12
5
· 9 + 35 · 4 = 24, which matches.
(e) The characteristic equation is simply r2 − 1 = 0, which factors as (r − 1)(r + 1) = 0,
and so has roots r = 1 and r = −1. Thus an = α1 · 1n + α2 · (−1)n .
Plugging in the base cases, we get 5 = a0 = α1 + α2 and −1 = a1 = α1 − α2 . From this
we see α1 = 2 and α2 = 3, so
an = 2 + 3 · (−1)n
This should make sense; an = 5 whenever n is even and an = −1 whenever n is odd.
(f) The characteristic equation is r2 + 6r + 9 = 0, which factors as (r + 3)2 = 0, and so
has root r = −3 with multiplicity 2. Then (by Theorem 2 in your book) we have
an = α1 (−3)n + α2 n(−3)n .
Plugging in the base cases, we get 3 = a0 = α1 and −3 = a1 = −3α1 − 3α2 , so α1 = 3
and α2 = −2. Thus
3
Let’s check this: we have a2 = −6 · (−3) − 9 · 3 = −9 from the recurrence, while
our formula gives a2 = (−1) ∗ 9 = −9, which matches.
8.2: 8:
8.2: 11:
Ln+1 = Ln +Ln−1 = (fn−1 + fn+1 )+(fn−2 + fn ) = (fn−1 + fn−2 )+(fn + fn+1 ) = fn +fn+2
√ !n−1 √ !2 √ !n−1 √ !2
1 1+ 5 1+ 5 1 1− 5 1− 5
=√ · 1 + +√ · 1 +
5 2 2 5 2 2
√ !n √ !n
1+ 5 1− 5
= +
2 2
√ √
1+ 5 1− 5
The last step follows from a bit of algebra, squaring 2
and 2
and simplifying.
4
that it must take the form (r − 1)(r − a)(r − b) for some other roots a and b. Doing
this polynomial division (if you don’t know how to do it, look it up; it’s a good math
skill to have) we get r2 − r − 2, so r3 − 2r2 − r + 2 = (r − 1)(r2 − r − 2) = 0. This fac-
tors further as (r −1)(r −2)(r +1) = 0, and so the roots are r = 1, r = 2, and r = −1. Thus
an = α1 1n + α2 2n + α3 (−1)n
Plugging in the base cases, we get
3 = a0 = α1 + α2 + α3
6 = a1 = α1 + 2α2 − α3
0 = a2 = α1 + 4α2 + α3 .
Adding the 2nd equation to the others yields
9 = 2α1 + 3α2 and 6 = 2α1 + 6α2 . Subtracting these gives 3 = −3α2 , so α2 = −1, and
α1 = 6. Then α3 = −2. Thus
an = 6 − 2n − 2 · (−1)n
8.2: 14: The characteristic equation is r4 −5r2 −4 = 0, which factors as (r2 −4)(r2 −1) = 0,
and further as (r − 1)(r + 1)(r − 2)(r + 2) = 0. Thus the roots are r = 1, r = −1, r = 2,
and r = −2. Then
an = α1 1n + α2 (−1)n + α3 2n + α4 (−2)n
5
n−1 n−2 n−2 n−3 n−3
= + + + + + ...
0 0 1 1 2
n n−1 n−2
= + + + ...
0 1 2
= an
Since an satisfies the same base case
and the same recursion as fn , we thus have
n n−1 n−k
fn = an = 0 + 1 + ... + k .
8.2: 24:
(a) Let’s check: is n2n equal to 2(n − 1)2n−1 + 2n = n2n − 2n + 2n = n2n ? Yes, it is, so
an = n2n is a solution to this recurrence.
(b) We must find a solution to the homogeneous recurrence an = 2an−1 (if you’ve taken a
course in differential equations, or even math 1b, this should look pretty familiar):
(h)
The characteristic equation is r−2 = 0 which has only the one root r = 2, so an = α2n
is the general solution to the homogeneous part of the recurrence. Thus the general
solution to this recurrence is
an = a(h) (p) n
n + an = α2 + n2
n
8.2: 25:
A = 2A + 1
B = 2B − 2A + 5
From the first equation we get A = −1, and then from the second that B = −7.
an = an(h) + a(p) n
n = α2 − n − 7
(c) Plugging in the base case, we get 4 = a0 = α−0−7, so α = 11. Thus an = 11·2n −n−7.
6
8.2: 26(e,f ): Let’s first consider the roots of the characteristic equation so that we can
apply Theorem 6. The characteristic equation for the associated homogeneous recurrence
an = 6an−1 − 12an−2 + 8an−3 is r3 − 6r2 − 12r + 8 = 0. It looks like a pain to find these
roots, but to answer (e) and (f) we only need to know whether 2 and -2 are roots, and
if so with what multiplicities. Plugging in r = 2 does not give 0, so 2 is not a root.
Plugging in -2 does give 0, so r = −2 is a root. If we do polynomial division, we find that
r3 − 6r2 − 12r + 8 = (r + 2)(r2 − 8r + 4). We see r = −2 is not a root of this second term,
so r = −2 has multiplicity only 1.
(e) 2 is not a root of the characteristic equation, so the general form of the particular
solution is (p2 n2 + p1 n + p0 )2n .
(f) -2 is a root of the characteristic equation of multiplicity m = 1, so we must multiply
by nm = n1 : the particular solution is n(p3 n3 + p2 n2 + p1 n + p0 )(−2)n .
8.2: 28:
1. The characteristic equation is r−2 = 0, which has only the root 2, so the homogeneous
(h)
solution is an = α2n . By Theorem 6, the general form of the particular solution is
(p)
an = (p0 n2 + p1 n + p0 )1n = p0 n2 + p1 n + p0 , since 1 is not a root of the characteristic
equation. Plugging this in, we get
p2 n2 + p1 n + p0 = 2(p2 (n − 1)2 + p1 (n − 1) + p0 ) + 2n2
Equating the coefficients of powers of n, we get the system of equations
p2 = 2p2 + 2
p1 = −4p2 + 2p1
p0 = 2p2 − 2p1 + 2p0
The first equation gives p2 = −2, the second gives p1 = −8, and the third gives
(p)
p0 = −12. Thus the particular solutions is an = −2n2 − 8n − 12, and so the general
solution is an = α2n − 2n2 − 8n − 12.
2. Plugging in, we get 4 = a1 = 2α − 2 − 8 − 12 = 2α − 22, so α = 13. Then
an = 13 · 2n − 2n2 − 8n − 12.
8.2: 31: The characteristic equation for the homogeneous part is r2 − 5r + 6 = 0, which
factors as (r − 3)(r − 2) = 0, and so has roots r = 2 and r = 3. Thus the homogeneous
solution is α1 2n + α2 3n .
Because 2 is a root of the characteristic equation with multiplicity 1, we need a term of the
form An2n to give the 2n non-homogeneous part, and we need a term of the form Bn + C
(p)
to give the 3n part. So our particular solution should have form an = An2n + Bn + C;
plugging it in we see
An2n +Bn+C = 5 A(n − 1)2n−1 + B(n − 1) + C −6 A(n − 2)2n−2 + B(n − 2) + C +2n +3n
7
which gives equations
5 6
A= A− A for the coefficient of n2n
2 4
5 12
0=− A+ A+1 for the coefficient of 2n
2 4
B = 5B − 6B + 3 for the coefficient of n
C = −5B + 5C + 12B − 6C for the constant term
The first equation is always true, as it should be. If we got an equation like it that
was always false (or a system of equations that was unsatisfiable), that would mean our
particular solution wasn’t general enough. The second equation gives A = −2, the third
gives B = 23 , and the last gives C = 21
4
Thus the general solution is
3 21
an = a(h) (p) n n n
n + an = α1 2 + α2 3 − 2 · n2 + n +
2 4
8.2: 32: The characteristic equation is r − 2 = 0, which has only the root 2, and so
(h)
the homogeneous solution is an = α2n . The particular solution should have the form
(p)
an = An2n because 2 is a root of the characteristic equation with multiplicity 1. Plugging
this in, we get
An2n = 2A(n − 1)2n−1 + 3 · 2n
which gives equations
2
A= A for the coefficient of n2n
2
2
0=− A+3 for the coefficient of 2n
2
The first equation is always true, giving us no information, and the second yields A = 3.
(p)
Thus the particular solutions is an = 3n · 2n , and so the general solution is
an = a(h) (p) n
n + an = α2 + 3n · 2
n
8.2: 38:
√
2± 4−8
1. The characteristic equation is r2 − 2r + 2 = 0, which has roots r = = 1 ± i,
√ 2
where i = −1 and i2 = −1.
2. Using the same technique we’ve been using all along, we have
an = α1 (1 + i)n + α2 (1 − i)n
8
From the first equation we have α1 = 1 − α2 , so
2 = (1 − α2 )(1 + i) + α2 (1 − i) = 1 + i − α2 − iα2 + α2 − iα2 = 1 + i − 2iα2 . Then
α2 = −1+i
2i
· ii = −i−1
−2
= 1+i
2
.
1−i
Then α1 = 1 − α2 = 2 . Therefore the solution is
1−i 1+i
an = · (1 + i)n + · (1 − i)n
2 2
Let’s check that this matches what we expect, and also that it seems to give real
numbers (and in fact integers): plugging in n = 0 we get a0 = 1−i
2
+ 1+i
2
= 1 and
(1−i)(1+i) (1+i)(1−i) 1+1 1+1
plugging in n = 1 we get a1 = 2
+ 2
= 2 + 2 = 2, which are the
correct base cases.