23.11.2012 Views

Semester 2 Tutorial Solutions Week 10 2007 1. Consider the gen

Semester 2 Tutorial Solutions Week 10 2007 1. Consider the gen

Semester 2 Tutorial Solutions Week 10 2007 1. Consider the gen

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

THE UNIVERSITY OF SYDNEY<br />

Math1904 Discrete Ma<strong>the</strong>matics (Advanced)<br />

<strong>Semester</strong> 2 <strong>Tutorial</strong> <strong>Solutions</strong> <strong>Week</strong> <strong>10</strong> <strong>2007</strong><br />

<strong>1.</strong> <strong>Consider</strong> <strong>the</strong> <strong>gen</strong>erating function<br />

G(z) = a0 + a1z + a2z 2 + · · · .<br />

Verify <strong>the</strong> following table of closed forms for G corresponding to <strong>the</strong> given choices for an.<br />

Solution<br />

1<br />

an<br />

β n<br />

nβ n<br />

n 2 β n<br />

G(z)<br />

1<br />

1 − z<br />

1<br />

1 − βz<br />

βz<br />

(1 − βz) 2<br />

β2z2 + βz<br />

(1 − βz) 3<br />

We know from Example 14.5 of <strong>the</strong> textbook that<br />

1 + z + z 2 + z 3 + · · · = 1<br />

1 − z<br />

and on substituting βz for z in this equation we have<br />

1 + βz + β 2 z 2 + β 3 z 3 1<br />

+ · · · =<br />

1 − βz .<br />

Now differentiate to obtain<br />

and <strong>the</strong>n multiply by z to get<br />

Differentiate again to get<br />

β + 2β 2 z + 3β 3 z 2 + 4β 4 z 3 + · · · =<br />

βz + 2β 2 z 2 + 3β 3 z 3 + 4β 4 z 4 + · · · =<br />

β<br />

(1 − βz) 2<br />

βz<br />

(1 − βz) 2.<br />

β + 2 2 β 2 z + 3 2 β 3 z 2 + 4 2 β 4 z 3 β<br />

+ · · · =<br />

(1 − βz) 2 + 2β2z (1 − βz) 3 = β2z + β<br />

(1 − βz) 3.<br />

On multiplying by z we get <strong>the</strong> last line of <strong>the</strong> table.


2. Show that <strong>the</strong> coefficient of z n in<br />

Solution<br />

We have<br />

1<br />

1 − 7z + 12z 2 is 4n+1 − 3 n+1 .<br />

1<br />

1<br />

=<br />

1 − 7z + 12z2 (1 − 3z)(1 − 4z)<br />

= 1<br />

� �<br />

1 1<br />

−<br />

z 1 − 4z 1 − 3z<br />

= 1<br />

z<br />

∞�<br />

n=0<br />

[(4z) n − (3z) n ] .<br />

and from this we see that <strong>the</strong> coefficient of z n is 4 n+1 − 3 n+1 , as claimed.<br />

3. Determine <strong>the</strong> closed form of <strong>the</strong> <strong>gen</strong>erating function corresponding to <strong>the</strong> given sequence<br />

(i) an = n(n + 1)(n + 2).<br />

� �<br />

n + 5<br />

(ii) an = .<br />

5<br />

Solution<br />

Both parts can be done by using <strong>the</strong> formula from lectures:<br />

∞�<br />

� �<br />

n + p − 1<br />

z<br />

n<br />

n=0<br />

n 1<br />

=<br />

(1 − z) p.<br />

� �<br />

n + 3<br />

(i) Here an+1 = 6 and so<br />

n<br />

∞�<br />

an+1z n 6<br />

=<br />

(1 − z) 4.<br />

(ii)<br />

n=0<br />

Since a0 = 0, multiplying by z we get <strong>the</strong> answer<br />

1<br />

(1 − z) 6.<br />

6z<br />

(1 − z) 4.<br />

4. Solve <strong>the</strong> recurrence relations<br />

(i) an = 4an−1 − 4an−2 for n ≥ 2, a0 = 6, a1 = 8.<br />

(ii) xn+2 + 2xn+1 − 3xn = 0 for n ≥ 0, x0 = 2, x1 = −2.<br />

Solution<br />

(i) The characteristic equation is λ 2 − 4λ + 4 = 0; that is, (λ − 2) 2 = 0 and <strong>the</strong>refore<br />

<strong>the</strong> <strong>gen</strong>eral solution is an = A 2 n + Bn 2 n for some constants A and B. Using <strong>the</strong><br />

given initial conditions we have A = 6 and 2A + 2B = 8, hence B = −2. Thus <strong>the</strong><br />

solution is an = 6 · 2 n − 2n · 2 n .<br />

(ii) The characteristic equation is λ 2 +2λ−3 = 0. The roots are 1 and −3, and <strong>the</strong>refore<br />

<strong>the</strong> <strong>gen</strong>eral solution is xn = A + B (−3) n for some constants A and B. Using <strong>the</strong><br />

given initial conditions we have A + B = 2 and A − 3B = −2, hence A = B = <strong>1.</strong><br />

Thus <strong>the</strong> solution is xn = 1 + (−3) n .


5. Find <strong>the</strong> <strong>gen</strong>eral solution to <strong>the</strong> recurrence relations<br />

(i) an+3 = 3an+2 − 4an.<br />

(ii) xn+3 + 6xn+2 + 12xn+1 + 8xn = 0.<br />

Solution<br />

(i) The characteristic equation is λ 3 − 3λ 2 + 4 = 0 and this factorizes as<br />

Thus <strong>the</strong> <strong>gen</strong>eral solution is<br />

(λ − 2) 2 (λ + 1) = 0.<br />

an = A 2 n + Bn 2 n + C (−1) n .<br />

(ii) The characteristic equation is λ 3 + 6λ 2 + 12λ + 8 = 0 which factorizes as<br />

Thus <strong>the</strong> <strong>gen</strong>eral solution is<br />

(λ + 2) 3 = 0.<br />

xn = (A + Bn + Cn 2 )(−2) n .<br />

6. For each natural number n ≥ 1, let an be <strong>the</strong> number of n digit numbers which contain no<br />

0’s and an even number of 9’s.<br />

(i) Show that a1 = 8 and that for n ≥ 2, an = 7an−1 + 9 n−1 .<br />

(ii) Solve <strong>the</strong> recurrence relation of (i) using <strong>the</strong> method of <strong>gen</strong>erating functions.<br />

Solution<br />

(i) There are 8 digits o<strong>the</strong>r than 0 and 9, hence a1 = 8. For n ≥ 2, a number of n digits<br />

of <strong>the</strong> required form can be obtained by adjoining a single digit (o<strong>the</strong>r than 0 or 9)<br />

to one of length n − 1 (this can be done in 8 ways) or by adding a 9 to <strong>the</strong> end of a<br />

number of length n −1 which has no 0’s and an odd number of 9’s (this can be done<br />

in 9 n−1 − an−1 ways. Thus an = 8an−1 + (9 n−1 − an−1) = 7an−1 + 9 n−1 .<br />

(ii) Suppose that<br />

G(z) = a0 + a1z + a2z 2 + · · ·<br />

where a1 = 8 and an = 7an−1 + 9 n−1 for n > 0. Then a0 = 1 and we have<br />

G(z) = a0 + a1z + a2z 2 + · · · + anz n + · · ·<br />

zG(z) = a0z + a1z 2 + · · · + an−1z n + · · ·<br />

G(z) − 7zG(z) = 1 + 9 0 z + 9 1 z 2 + · · · + 9 n−1 z n + · · ·<br />

hence G(z) − 7zG(z) = 1 + z/(1 − 9z) and it follows that<br />

1 − 8z<br />

G(z) =<br />

(1 − 7z)(1 − 9z)<br />

= 1<br />

� �<br />

1 1<br />

+<br />

2 1 − 7z 1 − 9z<br />

= 1<br />

∞�<br />

(7<br />

2<br />

n + 9 n )z n<br />

and <strong>the</strong>refore an = 1<br />

2 (7n + 9 n ).<br />

n=0


THE UNIVERSITY OF SYDNEY<br />

Math1904 Discrete Ma<strong>the</strong>matics (Advanced)<br />

<strong>Semester</strong> 2 Fur<strong>the</strong>r Exercises <strong>Solutions</strong> <strong>Week</strong> <strong>10</strong> <strong>2007</strong><br />

<strong>1.</strong> (i) Write down a recurrence relation for <strong>the</strong> number an of sequences of length n that<br />

can be formed from <strong>the</strong> strings 00 and <strong>1.</strong> For example, <strong>the</strong> strings of length 4 are<br />

1111, 1<strong>10</strong>0, <strong>10</strong>01, 0011 and 0000.<br />

(ii) Solve <strong>the</strong> recurrence you found in (i).<br />

Solution<br />

(i) A string of length n + 1 ei<strong>the</strong>r ends with 1 or 0. If it ends with 1, <strong>the</strong>n it can be<br />

obtained in just one way by adding a 1 to <strong>the</strong> end of a string of length n. If it<br />

ends with 0, <strong>the</strong>n it actually ends with 00 and it can be obtained by adding 00 to<br />

a uniquely determined string of length n − <strong>1.</strong> Thus an+1 = an + an−1, provided we<br />

have n ≥ 2. If n = 1, <strong>the</strong>n <strong>the</strong> recurrence holds provided we define a0 to be <strong>1.</strong><br />

(ii) The recurrence found in (i) defines <strong>the</strong> Fibonacci numbers 1, 1, 2, 3, 5, ... and <strong>the</strong><br />

solution is given on page <strong>10</strong>5 of <strong>the</strong> text book.<br />

2. (i) Show that for any numbers a and b, <strong>the</strong> sequence defined by xn = a3 n + bn3 n is a<br />

solution to <strong>the</strong> recurrence equation<br />

xn+2 = 6xn+1 − 9xn.<br />

(ii) Find <strong>the</strong> partial solution of this equation with <strong>the</strong> initial conditions x0 = 15 and<br />

x1 = 30.<br />

Solution<br />

(i) With <strong>the</strong> given value of xn we have<br />

6xn+1 − 9xn = 6(a3 n+1 + b(n + 1)3 n+1 ) − 9(a3 n + bn3 n )<br />

= 2a3 n+2 + 2b(n + 1)3 n+2 − a3 n+2 − bn3 n+2<br />

= a3 n+2 + b(n + 2)3 n+2<br />

= xn+2.<br />

(ii) We have a = 15 and 3(a + b) = 30. This gives b = −5. The partial solution is<br />

xn = (15 − 5n) 3 n .

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!