Math 6A Quiz Solutions - Recurrence Relations, Spring '03-04, Quizzes of Linear Algebra

The solutions for quiz 7 of math 6a, spring quarter 2003-04. It includes the form of the solutions for given recurrence relations and recursive definitions for specific functions.

Typology: Quizzes

Pre 2010

Uploaded on 09/17/2009

koofers-user-dw3
koofers-user-dw3 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Jim Lambers
Math 6A
Spring Quarter 2003-04
Quiz 7 Solution (Version B)
1. Write down the form of the solution of each of the following recurrence relations.
(a) an=an1+ 2an2
Solution The characteristic equation is x2+x2 = 0, which has the roots x=2 and
x= 1. Therefore the solution has the form
an=α1(2)n+α2.
(b) an= 2an1an2
Solution The characteristic equation is x22x+ 1 = 0, which has the double root
x= 1. Therefore the solution has the form
an=α1+α2n.
(c) an=an1+ 2an2+ 2n.Note: a particular solution must be completely determined.
Solution The characteristic equation is the same as in part (a), so the roots are x=2
and x= 1. Since 2 is not a root of this equation, it follows from the theorem reproduced
on the formula sheet that the recurrence relation has a particular solution of the form
a(p)
n=p02n
for some constant p0. Substituting this form into the recurrence relation, with n= 2,
we obtain
p022=p021+ 2p020+ 22
or
4p0=2p0+ 2p0+ 4
which has the solution p0= 1, and therefore a particular solution is
a(p)
n= 2n.
We conclude that every solution of the recurrence relation has the form
an=α1(2)n+α2+ 2n.
1
pf2

Partial preview of the text

Download Math 6A Quiz Solutions - Recurrence Relations, Spring '03-04 and more Quizzes Linear Algebra in PDF only on Docsity!

Jim Lambers Math 6A Spring Quarter 2003- Quiz 7 Solution (Version B)

  1. Write down the form of the solution of each of the following recurrence relations.

(a) an = −an− 1 + 2an− 2 Solution The characteristic equation is x^2 + x − 2 = 0, which has the roots x = −2 and x = 1. Therefore the solution has the form

an = α 1 (−2)n^ + α 2.

(b) an = 2an− 1 − an− 2 Solution The characteristic equation is x^2 − 2 x + 1 = 0, which has the double root x = 1. Therefore the solution has the form

an = α 1 + α 2 n.

(c) an = −an− 1 + 2an− 2 + 2n. Note: a particular solution must be completely determined. Solution The characteristic equation is the same as in part (a), so the roots are x = − 2 and x = 1. Since 2 is not a root of this equation, it follows from the theorem reproduced on the formula sheet that the recurrence relation has a particular solution of the form

a( np )= p 02 n

for some constant p 0. Substituting this form into the recurrence relation, with n = 2, we obtain p 022 = −p 021 + 2p 020 + 2^2 or 4 p 0 = − 2 p 0 + 2p 0 + 4 which has the solution p 0 = 1, and therefore a particular solution is

a( np )= 2n.

We conclude that every solution of the recurrence relation has the form

an = α 1 (−2)n^ + α 2 + 2n.

  1. Write down recursive definitions for each of the following sets or functions. Your definition must include a basis step and a recursive step.

(a) f : N → N, f (n) = 2n/ 32 n, n ≥ 0. Hint: (ax)y^ = axy^ where a > 0 and x and y are real numbers. Solution For the basis step, we simply compute f (0) = 2^0 / 30 = 1. For the recursive step, we note that f (n + 1) = 2 n+ 3 2(n+1)^

2 n^ · 2 32 n^ · 32

= f (n)

so we recursively define f (n + 1) = 2f (n)/9 for n ≥ 0. Alternatively, using the hint, f (n) can be written as f (n) = 2n/(3^2 )n^ = (2/9)n, which can make the recursive step easier to see. (b) f : S → N, where S is the set of all strings of lowercase letters, including the empty string, and for each string w ∈ S, f (w) is the number of a’s in w. Solution For the basis step, we consider the empty string ε that has no letters, and define f (ε) = 0. For the recursive step, we assume that w ∈ S is an arbitrary string of lowercase letters, and y is a single lowercase letter. We must show how f (wy) can be computed, assuming that we can compute f (w). We have

f (wy) =

f (w) + 1 if y is an a f (w) otherwise