

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
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
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Jim Lambers Math 6A Spring Quarter 2003- Quiz 7 Solution (Version B)
(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.
(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