Docsity

Solving Recurrence Relations - Lecture Notes | Math 6, Study notes of Linear Algebra

Toggle sidebar
bg1
Jim Lambers
Math 6A
Spring Quarter 2003-04
Lecture 23 Notes
These notes correspond to Section 6.2 in the text.
Solving Recurrence Relations
In the previous lecture, we learned how to model a counting problem using a recurrence relation,
which is an equation that relates each term in a sequence to previous terms. In this lecture we will
learn how to solve certain types of recurrence relations in order to obtain an explicit formula for
each term that is independent of the other terms.
Solving Linear Homogeneous Recurrence Relations with Constant Coefficients
A recurrence relation is said to be linear if each term in the equation that depends on a term of
the sequence that it describes is a multiple of that term. The quantity multiplying the term is a
coefficient; in this lecture we will consider only recurrence relations with constant coefficients. If
every term in the recurrence relation is a multiple of a term, then we also say that the recurrence
relation is homogeneous.
In summary, a linear homogeneous recurrence relation with constant coefficients can be written
in the form
an=c1an−1+c2an−2+· ·· +ckan−k.
The number kis called the degree of the recurrence relation, provided that the coefficient ckis
nonzero. We will now learn how to solve recurrence relations of this form, beginning with those of
degree 2.
Theorem Let
an=c1an−1+c2an−2
be a linear homogeneous recurrence relation of degree 2 with constant coefficients. If the polynomial
r2−c1r−c2has two distinct roots r1and r2, then a sequence {an}is a solution of the recurrence
relation if and only if
an=α1rn
1+α2rn
2,
where α1and α2are constants.
Proof First, we must show that if an=α1rn
1+α2rn
2for each integer n, then the sequence {an}
satisfies the recurrence relation. We have
c1an−1+c2an−2=c1(α1rn−1
1+α2rn−1
2) + c2(α1rn−2
1+α2rn−2
2)
1
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Solving Recurrence Relations - Lecture Notes | Math 6 and more Study notes Linear Algebra in PDF only on Docsity!

Jim Lambers Math 6A Spring Quarter 2003- Lecture 23 Notes

These notes correspond to Section 6.2 in the text.

Solving Recurrence Relations

In the previous lecture, we learned how to model a counting problem using a recurrence relation, which is an equation that relates each term in a sequence to previous terms. In this lecture we will learn how to solve certain types of recurrence relations in order to obtain an explicit formula for each term that is independent of the other terms.

Solving Linear Homogeneous Recurrence Relations with Constant Coefficients

A recurrence relation is said to be linear if each term in the equation that depends on a term of the sequence that it describes is a multiple of that term. The quantity multiplying the term is a coefficient; in this lecture we will consider only recurrence relations with constant coefficients. If every term in the recurrence relation is a multiple of a term, then we also say that the recurrence relation is homogeneous. In summary, a linear homogeneous recurrence relation with constant coefficients can be written in the form an = c 1 an− 1 + c 2 an− 2 + · · · + ckan−k.

The number k is called the degree of the recurrence relation, provided that the coefficient ck is nonzero. We will now learn how to solve recurrence relations of this form, beginning with those of degree 2.

Theorem Let an = c 1 an− 1 + c 2 an− 2

be a linear homogeneous recurrence relation of degree 2 with constant coefficients. If the polynomial r^2 − c 1 r − c 2 has two distinct roots r 1 and r 2 , then a sequence {an} is a solution of the recurrence relation if and only if an = α 1 rn 1 + α 2 rn 2 ,

where α 1 and α 2 are constants.

Proof First, we must show that if an = α 1 rn 1 + α 2 r 2 n for each integer n, then the sequence {an} satisfies the recurrence relation. We have

c 1 an− 1 + c 2 an− 2 = c 1 (α 1 rn 1 −^1 + α 2 rn 2 −^1 ) + c 2 (α 1 rn 1 −^2 + α 2 r 2 n −^2 )

= α 1 r 1 n −^2 (c 1 r 1 + c 2 ) + α 2 rn 2 −^2 (c 1 r 2 + c 2 ) = α 1 r 1 n −^2 r^21 + α 2 rn 2 −^2 r^22 = α 1 r 1 n + α 2 r 2 n = an.

Now, we must show the converse: if a sequence {an} satisfies the recurrence relation, then for each nonnegative integer n, an = α 1 rn 1 + α 2 rn 2 , for some choice of the constants α 1 and α 2. We will prove this statement using mathematical induction. The basis step corresponds to n = 0 and n = 1. We will use a constructive existence proof; that is, we will find constants α 1 and α 2 such that an = α 1 rn 1 + α 2 rn 2 for these values of n. Setting n = 0 and n = 1 in this equation, we obtain the system of equations

α 1 + α 2 = a 0 α 1 r 1 + α 2 r 2 = a 1

Because r 1 6 = r 2 , this system has the unique solution

α 1 = r 2 a 0 − a 1 r 2 − r 1 , α 2 = a 1 − r 1 a 0 r 2 − r 1

as can be determined by substituting a 0 − α 1 for α 2 in the second equation. For the inductive step, we assume that

an = α 1 rn 1 + α 2 r 2 n , an− 1 = α 1 rn 1 −^1 + α 2 r 2 n −^1 ,

where n ≥ 2, and show that an+1 = α 1 r 1 n +1+ α 2 rn 2 +1.

Since {an} satisfies the recurrence relation, we have

an+1 = c 1 an + c 2 an− 1 = c 1 [α 1 rn 1 + α 2 rn 2 ] + c 2 [α 1 r 1 n −^1 + α 2 rn 2 −^1 ] = α 1 [c 1 rn 1 + c 2 rn 1 −^1 ] + α 2 [c 1 rn 2 + c 2 r 2 n −^1 ] = α 1 r 1 n −^1 [c 1 r 1 + c 2 ] + α 2 rn 2 −^1 [c 1 r 2 + c 2 ] = α 1 r 1 n −^1 r^21 + α 2 rn 2 −^1 r^22 = α 1 r 1 n +1+ α 2 rn 2 +

and the proof is complete. 2

Example Consider the recurrence relation satisfied by the Fibonacci numbers,

an = an− 1 + an− 2 ,

where α 1 and α 2 are constants.

Proof First, we must show that if an = α 1 r 1 n + α 2 nrn 1 for each integer n, then the sequence {an} satisfies the recurrence relation. Because r 1 is a double root, the polynomial r^2 − c 1 r − c 2 has the factorization (r − r 1 )^2. It follows that

r^2 − c 1 r − c 2 = r^2 − 2 r 1 r + r^21

which yields c 1 = 2r 1 , c 2 = −r^21.

It follows that

c 1 an− 1 + c 2 an− 2 = c 1 (α 1 r 1 n −^1 + α 2 (n − 1)rn 1 −^1 ) + c 2 (α 1 rn 1 −^2 + α 2 (n − 2)rn 1 −^2 ) = α 1 rn 1 −^2 (c 1 r 1 + c 2 ) + α 2 rn 1 −^2 [c 1 (n − 1)r 1 + c 2 (n − 2)] = α 1 rn 1 −^2 r 12 + α 2 r 1 n −^2 [n(c 1 r 1 + c 2 ) − c 1 r 1 − 2 c 2 ] = α 1 rn 1 + α 2 rn 1 −^2 [nr^21 − c 1 r 1 − 2 c 2 ] = α 1 rn 1 + α 2 nrn 1 − α 2 rn 1 −^2 (c 1 r 1 + 2c 2 ) = α 1 rn 1 + α 2 nrn 1 − α 2 rn 1 −^2 [(2r 1 )r 1 + 2(−r 12 )] = α 1 rn 1 + α 2 nrn 1 − α 2 rn 1 −^2 [2r^21 − 2 r^21 ] = α 1 rn 1 + α 2 nrn 1 = an.

Now, we must show the converse: if a sequence {an} satisfies the recurrence relation, then for each nonnegative integer n, an = α 1 r 1 n + α 2 nrn 1 , for some choice of the constants α 1 and α 2. We will prove this statement using mathematical induction. The basis step corresponds to n = 0 and n = 1. We will use a constructive existence proof; that is, we will find constants α 1 and α 2 such that an = α 1 rn 1 + α 2 nr 1 n for these values of n. Setting n = 0 and n = 1 in this equation, we obtain the system of equations

α 1 = a 0 α 1 r 1 + α 2 r 1 = a 1

This system has the unique solution

α 1 = a 0 , α 2 = a 1 − r 1 a 0 r 1

as can be determined by substituting α 1 = a 0 in the second equation. For the inductive step, we assume that

an = α 1 r 1 n + α 2 nrn 1 , an− 1 = α 1 rn 1 −^1 + α 2 (n − 1)r 1 n −^1 ,

where n ≥ 2, and show that an+1 = α 1 rn 1 +1+ α 2 (n + 1)rn 1 +1.

Since {an} satisfies the recurrence relation, we have

an+1 = c 1 an + c 2 an− 1 = c 1 [α 1 rn 1 + α 2 nr 1 n ] + c 2 [α 1 rn 1 −^1 + α 2 (n − 1)rn 1 −^1 ] = α 1 [c 1 rn 1 + c 2 r 1 n −^1 ] + α 2 [c 1 nr 1 n + c 2 (n − 1)rn 1 −^1 ] = α 1 r 1 n −^1 [c 1 r 1 + c 2 ] + α 2 rn 1 −^1 [n(c 1 r 2 + c 2 ) − c 2 ] = α 1 r 1 n −^1 r^21 + α 2 rn 1 −^1 [nr 12 + r^21 ] = α 1 r 1 n −^1 r^21 + α 2 rn 1 −^1 (n + 1)r 12 = α 1 r 1 n −^1 r^21 + α 2 (n + 1)rn 1 + = α 1 r 1 n +1+ α 2 (n + 1)rn 1 +

and the proof is complete. 2

Example Consider the recurrence relation

an = 2an− 1 − an− 2 ,

with initial conditions a 0 = 3 and a 1 = −1. We will solve this relation by computing the roots of the equation r^2 = 2r − 1.

Since the polynomial r^2 − 2 r + 1 can be factored into (r − 1)^2 , it follows that the equation has a double root of 1. Therefore, by the preceding theorem, the recurrence relation has a solution of the form an = α 11 n^ + α 2 n 1 n^ = α 1 + α 2 n,

where α 1 and α 2 are constants. From the proof of the preceding theorem, we obtain

α 1 = a 0 = 3, α 2 = a 1 − 1 · a 0 1

We conclude that the solution of the recurrence relation is

an = 3 − 4 n.

2

The equation r^2 = c 1 r + r 2 is called the characteristic equation of the recurrence relation an = c 1 an− 1 + c 2 an− 2. In general, the characteristic equation of the recurrence relation

an =

∑^ k

j=

ckan−j

∑^ k

i=

αirni −krki

∑^ k

i=

αirni

= an.

Now, we must show the converse: if a sequence {an} satisfies the recurrence relation, then for each nonnegative integer n, an =

∑k j=1 αj^ r n j ,^ for some choice of the constants^ α^1 , α^2 ,... , αk. We will prove this statement using mathematical induction. The basis step corresponds to n = 0, 1 ,... , k − 1. We will use a constructive existence proof; that is, we will find constants α 1 , α 2 ,... , αk such that an =

∑k j=1 αj^ r n j for these values of^ n. Setting n = 0, 1 ,... , k = 1 in this equation, we obtain a system of k equations for the k unknowns α 1 , α 2 ,... , αk. Because the roots r 1 , r 2 ,... , rk are all distinct, it is known from linear algebra that this system has a unique solution that can be obtained using Gaussian elimination. For the inductive step, we assume that

an−i =

∑^ k

j=

αj rnj −i, i = 0, 1 ,... , k − 1 ,

where n ≥ k, and show that

an+1 =

∑^ k

j=

αj r jn +1.

Since {an} satisfies the recurrence relation, we have

an+1 =

∑^ k

j=

cj an+1−j

∑^ k

j=

cj

∑k

i=

αirni+1−j

∑^ k

i=

αi

∑k

j=

cj rni+1−j

∑^ k

i=

αirn i−k+

∑k

j=

cj rik−j

∑^ k

i=

αirn i −k+1rki

∑^ k

i=

αirn i+

and the proof is complete. 2

Finally, we consider the case where the characteristic equation for a recurrence relation of degree k has multiple roots.

Theorem Let

an =

∑^ k

j=

cj an−j

be a linear homogeneous recurrence relation of degree k with constant coefficients. If the polynomial

rk^ −

∑^ k

j=

cj rk−j

has t distinct roots r 1 , r 2 ,... , rt, with multiplicities m 1 , m 2 ,... , mt, then a sequence {an} is a solution of the recurrence relation if and only if

an =

∑^ t

j=

m ∑j − 1

i=

αj,ini

 (^) rnj ,

where αj,i is a constant for j = 1, 2 ,... , k and i = 0, 1 ,... , mj − 1.

Linear Nonhomogeneous Recurrence Relations with Constant Coefficients

We now consider the solution of linear recurrence relations with constant coefficients that are nonhomogeneous. These recurrence relations include terms that do not depend on the terms in the sequence that they describe. As such, they have the form

an =

∑^ k

j=

cj an−j + F (n),

where F (n) is an arbitrary function of n. We will see that recurrence relations of this form can be solved in a fairly straightforward manner for certain choices of the function F (n). First, however, it should be noted that the solution to a nonhomogeneous recurrence relation is not unique. There are actually infinitely many solutions, but all of them can be described in terms of the solutions of the recurrence relation that is obtained by removing the term F (n). The resulting homogeneous recurrence relation

an =

∑^ k

j=

cj an−j

Theorem Let

an =

∑^ k

j=

cj an−j + F (n)

be a linear nonhomogeneous recurrence relation of degree k with constant coefficients. If F (n) is of the form

F (n) = sn

∑t

j=

bj nj^ ,

where s is not a root of the characteristic equation of the associated homogeneous recurrence relation, then the nonhomogeneous recurrence relation has a particular solution of the form

a( np )= sn

∑t

j=

pj nj^.

If s is a root of the characteristic equation of multiplicity m, then the nonhomogeneous recurrence relation has a particular solution of the form

a( np )= nmsn

∑t

j=

pj nj^.