0% found this document useful (0 votes)
15 views10 pages

Ch19 Student

Uploaded by

kicagah155
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views10 pages

Ch19 Student

Uploaded by

kicagah155
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Solutions to Chapter 19 Exercises

in Discrete Mathematics by Norman L. Biggs;


2nd Edition 2002

19.1 Generalities about recursion

19.1.1
Show that the formula for dn can be written as follows:

dn = 3 × 4 × · · · × (n − 1) × n
− 4 × · · · × (n − 1) × n + . . .
+ (−1)n−1 n + (−1)n .

Show that the number of multiplications required to compute dn by this formula


is O(n2 ). What is the number of multiplications required if the recursion is used?

Solution The formula, as given on p.240, is


n! n! n! n! n!
dn = n! − + − + . . . + (−1)n−1 + (−1)n .
1! 2! 3! (n − 1)! n!
The first two terms cancel, and since
n!
= (r + 1) × (r + 2) × · · · × n!
r!
the formula as given above is proved.

The number of multiplications required is


1
(n − 3) + (n − 4) + · · · + 1 = (n − 3)(n − 2),
2
which is O(n2 )). If the recursion is used directly, there is only one multiplication
at each step, so the total number is O(n).
Solutions to Chapter 19 Exercises
in Discrete Mathematics by Norman L. Biggs;
2nd Edition 2002

19.1.3
Show that the derangement numbers dn also satisfy the recursion

d1 = 0, dn = ndn−1 + (−1)n (n ≥ 2) .
Is there any advantage in using this recursion (rather than the usual one) for
the calculation of dn ?

Solution

dn = (n − 1)(dn−1 + dn−2 )
= ndn−1 + en−1

where

en−1 = (n − 1)dn−2 − dn−1


= (n − 1)dn−2 − (n − 2)(dn−2 + dn−3 )

= − (n − 2)dn−3 − dn−2
= −en−2 .

Thus en−1 = (−1)n−3 e2 , where e2 = 2d1 − d2 = −1, and the result follows.
With this recursion the number of multiplications is the same, but less space
is needed to store the data, since only one ‘previous value’ is used.
Solutions to Chapter 19 Exercises
in Discrete Mathematics by Norman L. Biggs;
2nd Edition 2002

19.2 Linear recursion

19.2.1
Find an explicit formula for un when
(i) u0 = 1, u1 = 1, un+2 − 3un+1 − 4un = 0 (n ≥ 0);
(ii) u0 = −2, u1 = 1, un+2 − 2un+1 + un = 0 (n ≥ 0).

Solution
(i) The auxiliary equation is t2 − 3t − 4 = 0, with roots 4 and −1, so the
solution is of the form un = A4n + B(−1)n , for some constants A, B. Substi-
tuting the given values of u0 and u1 , we find that A = 45 and B = − 15 , so the
solution is
1 n
un = (4 − 4(−1)n ) .
5

(ii) Here the auxiliary equation is t2 − 2t + 1 = 0, with the double root 1.


In this case, according to Theorem 19.2, the solution is of the form (Cn + D)1n ,
that is, Cn + D. Substituting the given values, we find that C = 3, D = −2, so
the solution is

un = 3n − 2.
Solutions to Chapter 19 Exercises
in Discrete Mathematics by Norman L. Biggs;
2nd Edition 2002

19.2.2
The Fibonacci numbers fn are defined by the recursion

f1 = 1, f2 = 1, fn+1 = fn + fn−1 (n ≥ 2) .
Show that
" √ !n √ !n #
1 1+ 5 1− 5
fn = √ − .
5 2 2

Solution The auxiliary equation is t2 − t − 1 = 0, which has roots


√ √
1+ 5 1− 5
α= , β= .
2 2
Hence fn = Aαn + Bβ n , and substituting the the given values leads to the
required formula. [Note that, despite the awkward formula,
√ the answers must
all be integers – in other words, the terms involving 5 all cancel.]
Solutions to Chapter 19 Exercises
in Discrete Mathematics by Norman L. Biggs;
2nd Edition 2002

19.2.3
Let qn denote the number of words of length n in the alphabet {0, 1} which
have the property that no two consecutive terms are 0. Show that

q1 = 2, q2 = 3, qn+2 = qn+1 + qn (n ≥ 0) .

Solution Listing the possibilities for n = 1, 2 explicitly, we find

(n = 1) : 0, 1 q1 = 2; (n = 2) : 01, 10, 11 q2 = 3.
To obtain the recursion, split the relevant words of length n + 2 into two
sets, those that begin with 1 and those that begin with 0. In the first set, the
remaining n + 1 terms can be either 0 or 1, subject to the given constraint, so
the number is qn+1 . In the second set, the second term can only be 1, and the
remaining n terms can be either 0 or 1, subject to the given constraint, so the
number is qn .
Solutions to Chapter 19 Exercises
in Discrete Mathematics by Norman L. Biggs;
2nd Edition 2002

19.3 Recursive bisection

19.3.1
Prove that if

u2 = 5, u2r = 2ur + 3 (r = 2k , k ≥ 1)
then un = 4n − 3 whenever n is a power of 2.

Solution The result is true when n = 21 , since

u2 = 5 and 4 × 2 − 3 = 5.

Suppose the result is true when n = 2k . Then


 
u2k+1 = 2u2k + 3 = 2 (4 × 2k ) − 3 + 3
= 4 × 2k+1 − 3.
Thus the formula is true for all n = 2k , k ≥ 1.
Solutions to Chapter 19 Exercises
in Discrete Mathematics by Norman L. Biggs;
2nd Edition 2002

19.3.2
Prove that if

u2 = 5, ur+s = ur + us + 3 (r ≥ s ≥ 2)
then un = 4n − 3 whenever n is even. [Hint: write n as a sum of powers of 2
and use Ex. 19.3.1.]

Solution The result is true when n = 2. In general, we can write

n = 2a + 2b + · · · + 2f ,

where a > b > · · · > f . With this notation, let

r = 2a , s = 2b + · · · + 2f ,
so that n = r + s. If s = 0 then n = 2a and the result holds, by Ex. 19.3.1.
If s 6= 0 then r and s are positive even numbers less than n, and we can use
the strong principle of induction. Assuming that the formula is true for all even
numbers less than n, we have

un = ur + us + 3
= (4r − 3) + (4s − 3) + 3
= 4(r + s) + −3
= 4n − 3.

So the result holds for all even numbers n.


Solutions to Chapter 19 Exercises
in Discrete Mathematics by Norman L. Biggs;
2nd Edition 2002

19.4 Recursive optimization

19.4.1
Suppose a manager has six units to invest in four companies C1 , C2 , C3 , C4 ,
but companies C1 and C2 allow investment only in multiples of two units. If
the estimated returns are as given in the table, find the best total return. Is the
best policy unique?
Company
Investment C1 C2 C3 C4
0 0 0 0 0
1 — — 0 2
2 0 3 1 3
3 — — 3 4
4 4 6 5 4
5 — — 7 4
6 8 9 9 4

Solution Using the method given in the text, the best total return is 9, and
there are four optimal policies:

x1 x2 x3 x4
0 6 0 0
0 0 5 1
0 4 0 2
0 0 6 0.
Solutions to Chapter 19 Exercises
in Discrete Mathematics by Norman L. Biggs;
2nd Edition 2002

19.5 The framework of dynamic programming

19.5.1
An investment problem is defined to be a DP problem of the standard form
which can be decomposed into stages in the following manner: the stage return
ri depends only on xi , where xi is the decision variable and represents an amount
‘invested’ at Stage i; and the state variable yi represents the total amount
invested up to and including Stage i.
Write down the stage transformations for an investment problem and show
that if y0 = 0 the recursion can be written in the form

f1 (y1 ) = r1 (y1 ) ,
fi (yi ) = max {fi−1 (yi−1 ) + ri (yi − yi−1 )} .
yi−1

Solution The stage transformation is

yi = yi−1 + xi (i ≥ 1),
where y0 = 0. Thus xi = yi − yi−1 (i ≥ 1), and in particular x1 = y1 . Therefore

f1 (y1 ) = max r1 (x1 ) = r1 (y1 )


(x1 ,y0 )

fi (yi ) = max {fi−1 (yi−1 ) + ri (xi , yi−1 )}


(x1 ,yi−1 )

= max {fi−1 (yi−1 ) + ri (yi − yi−1 )} .


yi−1
Solutions to Chapter 18 Exercises
in Discrete Mathematics by Norman L. Biggs;

2nd Edition 2002

19.6 Examples of the dynamic programming method


19.6.1 Find the length of a shortest directed path from s to t in the network
illustrated in Fig. 19.3. How many shortest paths are there?
4 7 2
2 3 5
5 6
2 4 7
1 4
8 5 5
s 4 2 t
2 6 3
7 8 5
6 2
1 3 9
Fig. 19.3 Find the shortest directed path from s to t.

Solution
Stage 1 y1 a b c d
f1( y1 ) 5 1 4 6

Stage 2 y2 e f g h
f2( y2 ) 9 3 6 7

Stage 3 y3 i j k l
f3( y3 ) 6 7 9 10

Stage 4 y4 m n o p
f4( y4 ) 8 14 12 19

Stage 5 y5 t
f5( y5 ) 14

Min = 14
Two solutions s; b; f; i; m; t or s; d; h; k; o; t

201

You might also like