Skip to main content
Logo image

Section 2.4 Solving Recurrence Relations

Investigate!
Consider the recurrence relation
an=5an16an2.
  1. What sequence do you get if the initial conditions are a0=1, a1=2? Give a closed formula for this sequence.
  2. What sequence do you get if the initial conditions are a0=1, a1=3? Give a closed formula.
  3. What if a0=2 and a1=5? Find a closed formula.
We have seen that it is often easier to find recursive definitions than closed formulas. Lucky for us, there are a few techniques for converting recursive definitions to closed formulas. Doing so is called solving a recurrence relation. Recall that the recurrence relation is a recursive definition without the initial conditions. For example, the recurrence relation for the Fibonacci sequence is Fn=Fn1+Fn2. (This, together with the initial conditions F0=0 and F1=1 give the entire recursive definition for the sequence.)

Example 2.4.1.

Find a recurrence relation and initial conditions for 1,5,17,53,161,485.
Solution.
Finding the recurrence relation would be easier if we had some context for the problem (like the Tower of Hanoi, for example). Alas, we have only the sequence. Remember, the recurrence relation tells you how to get from previous terms to future terms. What is going on here? We could look at the differences between terms: 4,12,36,108,. Notice that these are growing by a factor of 3. Is the original sequence as well? 13=3, 53=15, 173=51 and so on. It appears that we always end up with 2 less than the next term. Aha!
So an=3an1+2 is our recurrence relation and the initial condition is a0=1.
We are going to try to solve these recurrence relations. By this we mean something very similar to solving differential equations: we want to find a function of n (a closed formula) which satisfies the recurrence relation, as well as the initial condition.
 2 
Recurrence relations are sometimes called difference equations since they can describe the difference between terms and this highlights the relation to differential equations further.
Just like for differential equations, finding a solution might be tricky, but checking that the solution is correct is easy.

Example 2.4.2.

Check that an=2n+1 is a solution to the recurrence relation an=2an11 with a1=3.
Solution.
First, it is easy to check the initial condition: a1 should be 21+1 according to our closed formula. Indeed, 21+1=3, which is what we want. To check that our proposed solution satisfies the recurrence relation, try plugging it in.
2an11=2(2n1+1)1=2n+21=2n+1=an.
That’s what our recurrence relation says! We have a solution.
Sometimes we can be clever and solve a recurrence relation by inspection. We generate the sequence using the recurrence relation and keep track of what we are doing so that we can see how to jump to finding just the an term. Here are two examples of how you might do that.
Telescoping refers to the phenomenon when many terms in a large sum cancel out—so the sum “telescopes.” For example:
(21)+(32)+(43)++(10099)+(101100)=1+101
because every third term looks like: 2+2=0, and then 3+3=0 and so on.
We can use this behavior to solve recurrence relations. Here is an example.

Example 2.4.3.

Solve the recurrence relation an=an1+n with initial term a0=4.
Solution.
To get a feel for the recurrence relation, write out the first few terms of the sequence: 4,5,7,10,14,19,. Look at the difference between terms. a1a0=1 and a2a1=2 and so on. The key thing here is that the difference between terms is n. We can write this explicitly: anan1=n. Of course, we could have arrived at this conclusion directly from the recurrence relation by subtracting an1 from both sides.
Now use this equation over and over again, changing n each time:
a1a0=1a2a1=2a3a2=3anan1=n.
Add all these equations together. On the right-hand side, we get the sum 1+2+3++n. We already know this can be simplified to n(n+1)2. What happens on the left-hand side? We get
(a1a0)+(a2a1)+(a3a2)+(an1an2)+(anan1).
This sum telescopes. We are left with only the a0 from the first equation and the an from the last equation. Putting this all together we have a0+an=n(n+1)2 or an=n(n+1)2+a0. But we know that a0=4. So the solution to the recurrence relation, subject to the initial condition is
an=n(n+1)2+4.
(Now that we know that, we should notice that the sequence is the result of adding 4 to each of the triangular numbers.)
The above example shows a way to solve recurrence relations of the form an=an1+f(n) where k=1nf(k) has a known closed formula. If you rewrite the recurrence relation as anan1=f(n), and then add up all the different equations with n ranging between 1 and n, the left-hand side will always give you ana0. The right-hand side will be k=1nf(k), which is why we need to know the closed formula for that sum.
However, telescoping will not help us with a recursion such as an=3an1+2 since the left-hand side will not telescope. You will have 3an1’s but only one an1. However, we can still be clever if we use iteration.
We have already seen an example of iteration when we found the closed formula for arithmetic and geometric sequences. The idea is, we iterate the process of finding the next term, starting with the known initial condition, up until we have an. Then we simplify. In the arithmetic sequence example, we simplified by multiplying d by the number of times we add it to a when we get to an, to get from an=a+d+d+d++d to an=a+dn.
To see how this works, let’s go through the same example we used for telescoping, but this time use iteration.

Example 2.4.4.

Use iteration to solve the recurrence relation an=an1+n with a0=4.
Solution.
Again, start by writing down the recurrence relation when n=1. This time, don’t subtract the an1 terms to the other side:
a1=a0+1.
Now a2=a1+2, but we know what a1 is. By substitution, we get
a2=(a0+1)+2.
Now go to a3=a2+3, using our known value of a2:
a3=((a0+1)+2)+3.
We notice a pattern. Each time, we take the previous term and add the current index. So
an=((((a0+1)+2)+3)++n1)+n.
Regrouping terms, we notice that an is just a0 plus the sum of the integers from 1 to n. So, since a0=4,
an=4+n(n+1)2.
Of course in this case we still needed to know formula for the sum of 1,,n. Let’s try iteration with a sequence for which telescoping doesn’t work.

Example 2.4.5.

Solve the recurrence relation an=3an1+2 subject to a0=1.
Solution.
Again, we iterate the recurrence relation, building up to the index n.
a1=3a0+2a2=3(a1)+2=3(3a0+2)+2a3=3[a2]+2=3[3(3a0+2)+2]+2an=3(an1)+2=3(3(3(3(3a0+2)+2)+2)+2)+2.
It is difficult to see what is happening here because we have to distribute all those 3’s. Let’s try again, this time simplifying a bit as we go.
a1=3a0+2a2=3(a1)+2=3(3a0+2)+2=32a0+23+2a3=3[a2]+2=3[32a0+23+2]+2=33a0+232+23+2an=3(an1)+2=3(3n1a0+23n2++2)+2=3na0+23n1+23n2++23+2.
Now we simplify. a0=1, so we have 3n+stuff. Note that all the other terms have a 2 in them. In fact, we have a geometric sum with first term 2 and common ratio 3. We have seen how to simplify 2+23+232++23n1. We get 223n2 which simplifies to 3n1. Putting this together with the first 3n term gives our closed formula:
an=23n1.
Iteration can be messy, but when the recurrence relation only refers to one previous term (and maybe some function of n) it can work well. However, trying to iterate a recurrence relation such as an=2an1+3an2 will be way too complicated. We would need to keep track of two sets of previous terms, each of which were expressed by two previous terms, and so on. The length of the formula would grow exponentially (double each time, in fact). Luckily there happens to be a method for solving recurrence relations which works very well on relations like this.

Subsection The Characteristic Root Technique

Suppose we want to solve a recurrence relation expressed as a combination of the two previous terms, such as an=an1+6an2. In other words, we want to find a function of n which satisfies anan16an2=0. Now iteration is too complicated, but think just for a second what would happen if we did iterate. In each step, we would, among other things, multiply a previous iteration by 6. So our closed formula would include 6 multiplied some number of times. Thus it is reasonable to guess the solution will contain parts that look geometric. Perhaps the solution will take the form rn for some constant r.
The nice thing is, we know how to check whether a formula is actually a solution to a recurrence relation: plug it in. What happens if we plug in rn into the recursion above? We get
rnrn16rn2=0.
Now solve for r:
rn2(r2r6)=0,
so by factoring, r=2 or r=3 (or r=0, although this does not help us). This tells us that an=(2)n is a solution to the recurrence relation, as is an=3n. Which one is correct? They both are, unless we specify initial conditions. Notice we could also have an=(2)n+3n. Or an=7(2)n+43n. In fact, for any a and b, an=a(2)n+b3n is a solution (try plugging this into the recurrence relation). To find the values of a and b, use the initial conditions.
This points us in the direction of a more general technique for solving recurrence relations. Notice we will always be able to factor out the rn2 as we did above. So we really only care about the other part. We call this other part the characteristic equation for the recurrence relation. We are interested in finding the roots of the characteristic equation, which are called (surprise) the characteristic roots.

Characteristic Roots.

Given a recurrence relation an+αan1+βan2=0, the characteristic polynomial is
x2+αx+β
giving the characteristic equation:
x2+αx+β=0.
If r1 and r2 are two distinct roots of the characteristic polynomial (i.e., solutions to the characteristic equation), then the solution to the recurrence relation is
an=ar1n+br2n,
where a and b are constants determined by the initial conditions.

Example 2.4.6.

Solve the recurrence relation an=7an110an2 with a0=2 and a1=3.
Solution.
Rewrite the recurrence relation an7an1+10an2=0. Now form the characteristic equation:
x27x+10=0
and solve for x:
(x2)(x5)=0
so x=2 and x=5 are the characteristic roots. We therefore know that the solution to the recurrence relation will have the form
an=a2n+b5n.
To find a and b, plug in n=0 and n=1 to get a system of two equations with two unknowns:
2=a20+b50=a+b3=a21+b51=2a+5b
Solving this system gives a=73 and b=13 so the solution to the recurrence relation is
an=732n135n.
Perhaps the most famous recurrence relation is Fn=Fn1+Fn2, which together with the initial conditions F0=0 and F1=1 defines the Fibonacci sequence. But notice that this is precisely the type of recurrence relation on which we can use the characteristic root technique. When you do, the only thing that changes is that the characteristic equation does not factor, so you need to use the quadratic formula to find the characteristic roots. In fact, doing so gives the third most famous irrational number, φ, the golden ratio.
Before leaving the characteristic root technique, we should think about what might happen when you solve the characteristic equation. We have an example above in which the characteristic polynomial has two distinct roots. These roots can be integers, or perhaps irrational numbers (requiring the quadratic formula to find them). In these cases, we know what the solution to the recurrence relation looks like.
However, it is possible for the characteristic polynomial to have only one root. This can happen if the characteristic polynomial factors as (xr)2. It is still the case that rn would be a solution to the recurrence relation, but we won’t be able to find solutions for all initial conditions using the general form an=ar1n+br2n, since we can’t distinguish between r1n and r2n. We are in luck though:

Characteristic Root Technique for Repeated Roots.

Suppose the recurrence relation an=αan1+βan2 has a characteristic polynomial with only one root r. Then the solution to the recurrence relation is
an=arn+bnrn
where a and b are constants determined by the initial conditions.
Notice the extra n in bnrn. This allows us to solve for the constants a and b from the initial conditions.

Example 2.4.7.

Solve the recurrence relation an=6an19an2 with initial conditions a0=1 and a1=4.
Solution.
The characteristic polynomial is x26x+9. We solve the characteristic equation
x26x+9=0
by factoring:
(x3)2=0
so x=3 is the only characteristic root. Therefore we know that the solution to the recurrence relation has the form
an=a3n+bn3n
for some constants a and b. Now use the initial conditions:
a0=1=a30+b030=aa1=4=a3+b13=3a+3b.
Since a=1, we find that b=13. Therefore the solution to the recurrence relation is
an=3n+13n3n.
Although we will not consider examples more complicated than these, this characteristic root technique can be applied to much more complicated recurrence relations. For example, an=2an1+an23an3 has characteristic polynomial x32x2x+3. Assuming you see how to factor such a degree 3 (or more) polynomial you can easily find the characteristic roots and as such solve the recurrence relation (the solution would look like an=ar1n+br2n+cr3n if there were 3 distinct roots). It is also possible that the characteristics roots are complex numbers.
However, the characteristic root technique is only useful for solving recurrence relations in a particular form: an is given as a linear combination of some number of previous terms. These recurrence relations are called linear homogeneous recurrence relations with constant coefficients. The “homogeneous” refers to the fact that there is no additional term in the recurrence relation other than a multiple of aj terms. For example, an=2an1+1 is non-homogeneous because of the additional constant 1. There are general methods of solving such things, but we will not consider them here, other than through the use of telescoping or iteration described above.

Exercises Exercises

1.

Find the next two terms in (an)n0 beginning 3,5,11,21,43,85. Then give a recursive definition for the sequence. Finally, use the characteristic root technique to find a closed formula for the sequence.

2.

Consider the sequences 2,5,12,29,70,169,408, (with a0=2).
  1. Describe the rate of growth of this sequence.
  2. Find a recursive definition for the sequence.
  3. Find a closed formula for the sequence.
  4. If you look at the sequence of differences between terms, and then the sequence of second differences, the sequence of third differences, and so on, will you ever get a constant sequence? Explain how you know.

3.

Solve the recurrence relation an=an1+2n with a0=2.
an=

4.

Show that 4n is a solution to the recurrence relation an=3an1+4an2.

5.

Find the solution to the recurrence relation an=an1+6an2 with initial terms a0=2 and a1=1.
an=

6.

Find the solution to the recurrence relation an=5an1+14an2 with initial terms a0=2 and a1=5.
an=
Find the solution to the recurrence relation bn=5bn1+14bn2 with initial terms b0=2 and b1=11.
bn=

7.

Find the solution to the recurrence relation an=5an1+6an2 with initial terms a0=3 and a1=13.
an=

8.

Suppose that rn and qn are both solutions to a recurrence relation of the form an=αan1+βan2. Prove that crn+dqn is also a solution to the recurrence relation, for any constants c,d.

9.

Think back to the magical candy machine at your neighborhood grocery store. Suppose that the first time a quarter is put into the machine 1 Skittle comes out. The second time, 4 Skittles, the third time 16 Skittles, the fourth time 64 Skittles, etc.
  1. Find both a recursive and closed formula for how many Skittles the nth customer gets.
  2. Check your solution for the closed formula by solving the recurrence relation using the Characteristic Root technique.

10.

Let an be the number of 1×n tile designs you can make using 1×1 squares available in 4 colors and 1×2 dominoes available in 5 colors.
  1. First, find a recurrence relation to describe the problem. Explain why the recurrence relation is correct (in the context of the problem).
  2. Write out the first 6 terms of the sequence a1,a2,.
  3. Solve the recurrence relation. That is, find a closed formula for an.

11.

You have access to 1×1 tiles which come in 2 different colors and 1×2 tiles which come in 3 different colors. We want to figure out how many different 1×n path designs we can make out of these tiles.
  1. Find a recursive definition for the sequence an of paths of length n.
  2. Solve the recurrence relation using the Characteristic Root technique.

12.

Solve the recurrence relation an=2an1an2.
  1. What is the solution if the initial terms are a0=1 and a1=2?
  2. What do the initial terms need to be in order for a9=30?
  3. For which x are there initial terms which make a9=x?

13.

Consider the recurrence relation an=4an14an2.
  1. Find the general solution to the recurrence relation (beware the repeated root).
  2. Find the solution when a0=1 and a1=2.
  3. Find the solution when a0=1 and a1=8.
You have attempted 1 of 5 activities on this page.