0% found this document useful (0 votes)
243 views7 pages

Chap10 Recurrance Relations

The document discusses solving recurrence relations, which are equations that define a sequence based on earlier terms. It covers: 1) Solving homogeneous first order relations with constant coefficients by finding an explicit formula for the sequence. 2) Solving homogeneous second order relations by guessing a solution of the form an=crn, plugging into the relation to get the characteristic equation, and using the roots to construct the general solution. 3) Solving non-homogeneous relations by first finding the general solution to the corresponding homogeneous relation, then adding a particular solution.

Uploaded by

LesterPearson
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)
243 views7 pages

Chap10 Recurrance Relations

The document discusses solving recurrence relations, which are equations that define a sequence based on earlier terms. It covers: 1) Solving homogeneous first order relations with constant coefficients by finding an explicit formula for the sequence. 2) Solving homogeneous second order relations by guessing a solution of the form an=crn, plugging into the relation to get the characteristic equation, and using the roots to construct the general solution. 3) Solving non-homogeneous relations by first finding the general solution to the corresponding homogeneous relation, then adding a particular solution.

Uploaded by

LesterPearson
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/ 7

10

10.1

Recurrence Relations
First Order Recurrence Relations

In this chapter we look at recursively dened sequences (a0 , a1 , a2 , . . . , ) of numbers. A recurrence relation is an equation, or rule, that denes the nth number an in terms of earlier numbers. Example 10.1. The equation an = 5an1 is a recurrence relation that is satsied by many sequences of numbers: (0, 0, 0, . . . ) is one. (1, 5, 25, . . . , ) and (2, 10, 50, . . . , ) are others. Observe that upon choosing a rst term a0 , (indeed any term in the example above,) the recurrence equation dened the whole sequence. Example 10.2. Setting a0 = 3 and an = 5an1 for n 1 denes the sequence (a0 , a1 , a2 , . . . ) = (3, 15, 75, . . . ). One can show by induction that an has an explicit representation as an = 3 5n . In general, the recurrence relation a0 = A, an+1 = d an for all n 0

denes the sequence with explicit formula an = Adn for all n 0. Such an explicit formula is called the solution of a recurrence relation. Problem 10.1. You invest $1000 in the bank at .5% interest per month. How much is it worth after 2 years? Sol: The value vn in dollars after n months is determined by the initial value v0 = 1000, and the recurrence relation vn+1 = vn 1.005. So it is v24 = 1000(1.005)24 dollars. The above recurrence relations are quite simple. They are called homogeneous rst order linear recurrence relations with constanst coecients, and we have solved them all. A recurrence relation that can be written in the form c0 an = c1 an1 + c2 an2 + + ck ank + d is called a k th order linear recurrence relation. If d = 0, it is called homogeneous and if the ci are constant, it is said to have constant coecients. In later sections we solve all homogeneous second order linear recurrences with constant coecients, and then some non-homogeneous recurrences. These take more theory. To nish o this section we look as some special cases that we can do without much more theory. Problem 10.2. You invest $100 per month in a bank at an interest rate of .5% per month. How much money do you have after one year? 25

Sol: This is the recurrence an = 100 + (1.005)an1 with a0 = 100 we solve this more generally in the next example. Example 10.3. Solve the (non-homogeneous) recurrence relation dened by a0 = 0 and an+1 = dan + c. Sol: Writing out the rst couple terms we have that a1 = c, a2 = c(1+ d), a3 = c(1 + d + d2 ). We can show by induction that this pattern n 1 continues and has the solution an = c(1+d+d2 + +dn1 ) = c dd 1 . Example 10.4. Solve the (non-linear) recurrence relation dened by a0 = 5, 3 and a3 n+1 = 2an . Sol: It isnt linear in an , but making a change of variable bn = a3 n , the recurrence b0 = 5 and bn+1 = 2bn is, and has solution bn = 5 2n . So an = (5 2n )1/3 is the solution to our original relation.

10.2

Second order linear homogeneous recurrence relations with constant coecients


c0 an + c1 an1 + c2 an2 = 0.

Second order linear homogeneous recurrence relations can be written as

To solve this, we will guess a solution of the form an = crn for non-zero c and r, and plug it in to the recurrence relation. Now c0 (crn ) + c1 (crn1 ) + c2 (crn2 ) = 0 if and only if c0 r2 + c1 r1 + c2 = 0. This is only true if r is a root of the characteristic equation c0 x2 + c1 x + c0 = 0. Lets see how this plays out in an example. Example 10.5. (Distinct Real Roots) Solve the recurrence relation an = 5an1 6an2 , n 2, a0 = 1, a1 = 5. Sol: 1) Rewriting the recurrence relation as an 5an1 + 6 = 0, the characteristic equation is x2 5x + 6 = 0. 2) The characteristic equation has characteristic roots r = 2, 3. 3) Each of these is a solution to the recurrence relation. As it is linear, any linear combination A(2n ) + B (3n ) is also a solution, so we have the general solution an = A(2n ) + B (3n ) 26

(for constants A and B ) to the recurrence an = 5an1 6an2 . 4) Using a0 = 1 and a1 = 5, we get a specic solution. From the rst initial condition we get, 1 = a0 = A(20 ) + B (30 ) = A + B . From the second, we get 5 = a1 = A(2) + B (3) = 2A + 3B . Solving these, we get B = 3 and A = 2. So the specic solution to our recurrence relation is an = (2)2n + (3)3n = 3n+1 2n+1 . Remark 10.6. It can be shown, using linear algebra, that the the general solution given in part 3) describes all possible solutions of the recurrence relation an = 5an1 6an2 . Indeed, the recurrence can be rewritten an 5an1 6an2 = 0. As a system of equations in the variables an , an1 , and an2 the solution space has dimension 2. We wont prove this, we will just believe it. This lays out a general process for solving linear homogeneous recurrence relations with constant coecients. 1. Find the characteristic equation. 2. Find the characteristic roots. 3. Find the general solution. 4. Use the initial conditions to nd the specic solution. Try this process to solve the following. Problem 10.3. Solve the following (shifted bonacci) recurrence relation: fn = fn1 + fn2 , f0 = 0, and f 10.10 of the text book. You 1 = 1. (See Example 1+ 1 5 5 1 1 n n should get that fn = 5 ( 2 ) 5 ( 2 ) ). This process works for higher order relations than 2nd order, however we may have trouble nding the characteristic roots for higher order equations. We will mostly only consider 2nd order equations. The previous example was the easiest case. In general, our characteristic roots may not real. This is not a dicult complication. The more dicult complication is when they are real, but not distinct. ( If they arent real, the will be distinct.) Example 10.7. (Complex Roots - Necessarily Distinct) Solve the recurrence relation an = 2an1 2an2 with initial conditions a0 = a1 = 1. Sol: There characteristic equation is x2 2x + 2 = 0, which has roots x = 1 1 = 1 i. So our general solution is an = A(1 + i)n + B (1 i)n .

27

We now nd the specic solution. For one, we have 1 = a0 = A + B , so B = 1 A. From the second initial condition, we have 1 = a1 = A(1 + i) + B (1 i) = A(1 + i) + (1 A)(1 i) = 2Ai + 1 i. Solving give A = B = 1/2, so we get the specic solution an = 1/2(1 + i)n + 1/2(1 i)n . Example 10.8. (Repeated real roots) Solve an = 6an1 9an2 , where a0 = 3 and a1 = 10. Sol: The characteristic equation x2 6x + 9 = (a 3)2 = 0 has double root 3. In this case, we have a solution an = A3n , for all A, but this is not all of the solutions. Observe that n3n is also a solution: n3n = 6(n 1)3n1 9(n 2)3n2 . Again linearity gives that an = A3n + Bn3n is a solution for all A and B . This is our general soluton. Using the initial conditions, we can sovle to get the specic solution an = 3n+1 + n3n1 . Problem 10.4. Solve an = 2an1 an2 where a0 = 2 and a1 = 5. Sol: You should nd that the characteristic equation has a double root 1, and get a specic solution (2 7n)(1)n . As long as we can nd the characteristic roots, we should be able to solve higher order homogeneous linear equations with constant co-ecients. Example 10.9. (Third Order) Solve 2an+3 = an+2 + 2an+1 an , where a0 = 0, a1 = 1, and a2 = 2. Sol: The characteristic equation 2x3 x2 2x + 1 = 0 has roots x = 1, 1/2. So the general solution is an = A(1)n + B (1)n + C (1/2)n . Now we nd the particular solution. From the rst initial condition, 0 = a0 = A + B + C , from the second 1 = a0 = A B + C/2, from the third we have 2 = a2 = A + B + C/4. This is three equations in three unknowns, so we can solve it to get A = 5/2, B = 1/6, and 1 n 8 1 n 5 + ( 8/3. So an = 2 6 ) 3(2) . 28

Now lets see a bit how we can use these recurrence relations. Problem 10.5. How many binary strings (strings of 0s and 1s) of n bits have no two consecutive zeros? Sol: Let an be the number of such strings. Clearly a0 = 0, a1 = 2, and a2 = 3. An n bit string begins (1, and ends with any n 1 bit string, or begins with (0, 1, and ends with any n 2 bit string. So an = an1 + an2 . We can solve this. This is almost the same problem. Problem 10.6. I have buttons of four dierent colours. How many ways can we arrange n of them so that there are no two consecutive blue ones. Sol: You should get a recurrence relation an = 3an1 + 3an2 . Problem 10.7. How many compositions of the integer n use only the digits 1 and 2? Sol: We add a 1 to the end of any composition of n 1 and a 2 to the end of any composition of n 2. So this is described by the recurrence relation an = an1 + an2 . The initial conditions are a1 = 1 and a2 = 1. Fibonacci fabulous!. Problem 10.8. How many ways can you tile a 2 n checkerboard with the

tiles of the type seen here. Sol: This is Example 10.19 from the text.

10.3

The Nonhomogeneous Recurrence Relation


an + c1 an1 + c2 an2 + + cd and = f (n) 29

A linear recurrence relation, written as

is called nonhomogeneous if f (n) is not identically 0. We will look at the rst and second order cases. Again, one can show by linear algebra that to nd the general solution to such a relation, one only needs (h ) to nd the general solution an to a corresponding homogeneous recurrence (p) relation, and then shift it by one particular solution an . We start with an example. Example 10.10. Solve an = 2an1 + 7 5n for n 1 and a0 = 4. Sol: First we nd the general solution to the corresponding homogeneous recurrence an 2an1 = 0. This has characteristic equation x 2 = 0 (h ) which has root x = 2 so we have the general soluton an = A 2n . Now we want a particular solution to an 2an1 = 7 5n . Lets guess that there is one of the form c 5n . (We talk about why after this example.) Plugging into the recurrence relation, we get c 5n 2c 5n1 = 7 5n , which is true if and only if c 5 2c = 35, or c = 35/3. So (p) an = (35/3) 5n is a solution to the recurrence. The general solution to the recurrence is thus
h) (p) n n an = a( n + an = A 2 + (35/3) 5 .

Using the initial conditions we now nd the specic solution. We have 4 = a0 = A(20 )+ (35/3)50 = A + 35/3, which gives A = 23/3. The specic solution is thus an = (35/3)5n (23/3)2n = (1/3)(35 5n 23 2n ). For f (n) = 7 5n we guessed a solution of the form c 5n . The solution that we guess is suggested by the form of f (n): When f (n) is c cn cn2 crn cn2 rn an is of the form A An + B An2 + Bn + C Arn rn (An2 + Bn + C )
(p)

From the above, you can interpolate appropriate guesses for various other special cases of f (n). You will be responsible only for solving nonhomogeneous equations with f (n) from the above table. 30

Problem 10.9. Solve an = 6an1 9an2 + (3)n for n 2, where a0 = 2 and a1 = 3. Example 10.11. (The Towers of Hanoi) In the game of the Towers of Hanoi one has three pegs. A stack of disks of dierent radii are stacked on one peg with no disk on top of a larger disk. The game is to move the stack of disks to another peg. In a move, one can move one disk, placing it on an empty peg, or on a peg of smaller radius. How many moves can this be done in when there are n disks. Sol: Let an be the minimum number of moves one can complete the game in when there are n disks. Clearly a1 = 1. To move n disks one must move the largest disk. When this is done, it must be moved from peg 1 to peg 3, so at this time all other disks must be stacked on peg 2. Up until this move, there must be at least an1 moves, and after the biggest disk is moved, we must move these other disks on top of it. This takes an1 moves. So an = 2an1 + 1. We have a recurrence relation which we can solve. The corresponding homogeneous equation has characteristic polyno(h ) mial x 2 = 0 so general solution an = A 2n . The nonhomogeneous portion of the recurrence relation is 1 which suggests a particular solution of the form B . Plugging in, we get B = 2B + 1 which we solve (p) for the particular solution an = 1. So the nonhomogeneous re(h ) currence has general solution an = A 2n 1. Using the initial condition that 1 = a1 = A 2 1, we get A = 1, so the specic solution is thus an = 2n 1. The best one can do for the n disk game is 2n 1 moves.

31

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy