## Front Matter

## 0Introduction and Preliminaries

## 1Counting

## 2Sequences

## 3Symbolic Logic and Proofs

## 4Graph Theory

## 5Additional Topics

## Backmatter

Authored in PreTeXt

## Section2.4Solving Recurrence Relations

¶Investigate!21

Consider the recurrence relation

egin{equation*}a_n = 5a_{n-1} – 6a_{n-2}.end{equation*}

What sequence do you get if the initial conditions are (a_0 = 1 ext{,}) (a_1 = 2 ext{?}) Give a closed formula for this sequence.

You are watching: Find the solution to each of these recurrence relations with the given initial conditions

What sequence do you get if the initial conditions are (a_0 = 1 ext{,}) (a_1 = 3 ext{?}) Give a closed formula.

What if (a_0 = 2) and (a_1 = 5 ext{?}) 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 (F_n = F_{n-1} + F_{n-2} ext{.}) (This, together with the initial conditions (F_0 = 0) and (F_1 = 1) give the entire recursive *definition* for the sequence.)

Example2.4.1

Find a recurrence relation and initial conditions for (1, 5, 17, 53, 161, 485ldots ext{.})

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, ldots ext{.}) Notice that these are growing by a factor of 3. Is the original sequence as well? (1cdot 3 = 3 ext{,}) (5 cdot 3 = 15 ext{,}) (17 cdot 3 = 51) and so on. It appears that we always end up with 2 less than the next term. Aha!

So (a_n = 3a_{n-1} + 2) is our recurrence relation and the initial condition is (a_0 = 1 ext{.})

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.

Example2.4.2

Check that (a_n = 2^n + 1) is a solution to the recurrence relation (a_n = 2a_{n-1} – 1) with (a_1 = 3 ext{.})

Solution

First, it is easy to check the initial condition: (a_1) should be (2^1 + 1) according to our closed formula. Indeed, (2^1 + 1 = 3 ext{,}) which is what we want. To check that our proposed solution satisfies the recurrence relation, try plugging it in.

egin{align*}2a_{n-1} – 1 amp = 2(2^{n-1} + 1) – 1 \amp = 2^n + 2 – 1 \amp = 2^n +1\amp = a_n.end{align*}

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 (a_n) 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:

egin{equation*}(2 – 1) + (3 – 2) + (4 – 3) + cdots + (100 – 99) + (101 – 100) = -1 + 101end{equation*}

because every third term looks like: (2 + -2 = 0 ext{,}) and then (3 + -3 = 0) and so on.

We can use this behavior to solve recurrence relations. Here is an example.

Example2.4.3

Solve the recurrence relation (a_n = a_{n-1} + n) with initial term (a_0 = 4 ext{.})

Solution

To get a feel for the recurrence relation, write out the first few terms of the sequence: (4, 5, 7, 10, 14, 19, ldots ext{.}) Look at the difference between terms. (a_1 – a_0 = 1) and (a_2 – a_1 = 2) and so on. The key thing here is that the difference between terms is (n ext{.}) We can write this explicitly: (a_n – a_{n-1} = n ext{.}) Of course, we could have arrived at this conclusion directly from the recurrence relation by subtracting (a_{n-1}) from both sides.

Now use this equation over and over again, changing (n) each time:

egin{align*}a_1 – a_0 amp = 1\a_2 – a_1 amp = 2\a_3 – a_2 amp = 3\vdots quad amp quad vdots\a_n – a_{n-1} amp = n.end{align*}

Add all these equations together. On the right-hand side, we get the sum (1 + 2 + 3 + cdots + n ext{.}) We already know this can be simplified to (frac{n(n+1)}{2} ext{.}) What happens on the left-hand side? We get

egin{equation*}(a_1 – a_0) + (a_2 – a_1) + (a_3 – a_2) + cdots (a_{n-1} – a_{n-2})+ (a_n – a_{n-1}).end{equation*}

This sum telescopes. We are left with only the (-a_0) from the first equation and the (a_n) from the last equation. Putting this all together we have (-a_0 + a_n = frac{n(n+1)}{2}) or (a_n = frac{n(n+1)}{2} + a_0 ext{.}) But we know that (a_0 = 4 ext{.}) So the solution to the recurrence relation, subject to the initial condition is

egin{equation*}a_n = frac{n(n+1)}{2} + 4.end{equation*}

(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 (a_n = a_{n-1} + f(n)) where (sum_{k = 1}^n f(k)) has a known closed formula. If you rewrite the recurrence relation as (a_n – a_{n-1} = f(n) ext{,}) and then add up all the different equations with (n) ranging between 1 and (n ext{,}) the left-hand side will always give you (a_n – a_0 ext{.}) The right-hand side will be (sum_{k = 1}^n f(k) ext{,}) which is why we need to know the closed formula for that sum.

However, telescoping will not help us with a recursion such as (a_n = 3a_{n-1} + 2) since the left-hand side will not telescope. You will have (-3a_{n-1})”s but only one (a_{n-1} ext{.}) 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 (a_n ext{.}) 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 (a_n ext{,}) to get from (a_n = a + d + d + d + cdots + d) to (a_n = a + dn ext{.})

To see how this works, let”s go through the same example we used for telescoping, but this time use iteration.

Example2.4.4

Use iteration to solve the recurrence relation (a_n = a_{n-1} + n) with (a_0 = 4 ext{.})

Solution

Again, start by writing down the recurrence relation when (n = 1 ext{.}) This time, don”t subtract the (a_{n-1}) terms to the other side:

egin{equation*}a_1 = a_0 + 1.end{equation*}

Now (a_2 = a_1 + 2 ext{,}) but we know what (a_1) is. By substitution, we get

egin{equation*}a_2 = (a_0 + 1) + 2.end{equation*}

Now go to (a_3 = a_2 + 3 ext{,}) using our known value of (a_2 ext{:})

egin{equation*}a_3 = ((a_0 + 1) + 2) + 3.end{equation*}

We notice a pattern. Each time, we take the previous term and add the current index. So

egin{equation*}a_n = ((((a_0 + 1) +2)+3)+cdots + n-1) + n.end{equation*}

Regrouping terms, we notice that (a_n) is just (a_0) plus the sum of the integers from (1) to (n ext{.}) So, since (a_0 = 4 ext{,})

egin{equation*}a_n = 4 + frac{n(n+1)}{2}.end{equation*}

Of course in this case we still needed to know formula for the sum of (1,ldots,n ext{.}) Let”s try iteration with a sequence for which telescoping doesn”t work.

Example2.4.5

Solve the recurrence relation (a_n = 3a_{n-1} + 2) subject to (a_0 = 1 ext{.})

Solution

Again, we iterate the recurrence relation, building up to the index (n ext{.})

egin{align*}a_1 amp = 3a_0 + 2\a_2 amp = 3(a_1) + 2 = 3(3a_0 + 2) + 2\a_3 amp = 3

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.

egin{align*}a_1 amp = 3a_0 + 2\a_2 amp = 3(a_1) + 2 = 3(3a_0 + 2) + 2 = 3^2a_0 + 2cdot 3 + 2\a_3 amp = 3

Now we simplify. (a_0 = 1 ext{,}) so we have (3^n + langle ext{stuff}

angle ext{.}) 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 ext{.}) We have seen how to simplify (2 + 2cdot 3 + 2 cdot 3^2 + cdots + 2cdot 3^{n-1} ext{.}) We get (frac{2-2cdot 3^n}{-2}) which simplifies to (3^n – 1 ext{.}) Putting this together with the first (3^n) term gives our closed formula:

egin{equation*}a_n = 2cdot 3^n – 1.end{equation*}

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 (a_n = 2 a_{n-1} + 3 a_{n-2}) 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.

### SubsectionThe Characteristic Root Technique

¶

Suppose we want to solve a recurrence relation expressed as a combination of the two previous terms, such as (a_n = a_{n-1} + 6a_{n-2} ext{.}) In other words, we want to find a function of (n) which satisfies (a_n – a_{n-1} – 6a_{n-2} = 0 ext{.}) 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 (r^n) for some constant (r ext{.})

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 (r^n) into the recursion above? We get

egin{equation*}r^n – r^{n-1} – 6r^{n-2} = 0.end{equation*}

Now solve for (r ext{:})

egin{equation*}r^{n-2}(r^2 – r – 6) = 0,end{equation*}

so by factoring, (r = -2) or (r = 3) (or (r = 0 ext{,}) although this does not help us). This tells us that (a_n = (-2)^n) is a solution to the recurrence relation, as is (a_n = 3^n ext{.}) Which one is correct? They both are, unless we specify initial conditions. Notice we could also have (a_n = (-2)^n + 3^n ext{.}) Or (a_n = 7(-2)^n + 4cdot 3^n ext{.}) In fact, for any (a) and (b ext{,}) (a_n = a(-2)^n + b 3^n) is a solution (try plugging this into the recurrence relation). To find the values of (a) and (b ext{,}) use the initial conditions.

See more: Pro Mag Industries Ruger Lcp 2 Extended Magazine 15 Round, Promag Ruger Lcp 15 Round 380 Magazine

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 (r^{n-2}) 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 (a_n + alpha a_{n-1} + eta a_{n-2} = 0 ext{,}) the characteristic polynomial is

egin{equation*}x^2 + alpha x + etaend{equation*}

giving the characteristic equation:

egin{equation*}x^2 + alpha x + eta = 0.end{equation*}

If (r_1) and (r_2) are two distinct roots of the characteristic polynomial (i.e, solutions to the characteristic equation), then the solution to the recurrence relation is

egin{equation*}a_n = ar_1^n + br_2^n,end{equation*}

where (a) and (b) are constants determined by the initial conditions.

Example2.4.6

Solve the recurrence relation (a_n = 7a_{n-1} – 10 a_{n-2}) with (a_0 = 2) and (a_1 = 3 ext{.})

Rewrite the recurrence relation (a_n – 7a_{n-1} + 10a_{n-2} = 0 ext{.}) Now form the characteristic equation:

egin{equation*}x^2 – 7x + 10 = 0end{equation*}

and solve for (x ext{:})

egin{equation*}(x – 2) (x – 5) = 0end{equation*}

so (x = 2) and (x = 5) are the characteristic roots. We therefore know that the solution to the recurrence relation will have the form

egin{equation*}a_n = a 2^n + b 5^n.end{equation*}

To find (a) and (b ext{,}) plug in (n =0) and (n = 1) to get a system of two equations with two unknowns:

egin{align*}2 amp = a 2^0 + b 5^0 = a + b\3 amp = a 2^1 + b 5^1 = 2a + 5bend{align*}

Solving this system gives (a = frac{7}{3}) and (b = -frac{1}{3}) so the solution to the recurrence relation is

egin{equation*}a_n = frac{7}{3}2^n – frac{1}{3} 3^n.end{equation*}

Perhaps the most famous recurrence relation is (F_n = F_{n-1} + F_{n-2} ext{,}) which together with the initial conditions (F_0 = 0) and (F_1= 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, (varphi ext{,}) 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 only have one root. This can happen if the characteristic polynomial factors as ((x – r)^2 ext{.}) It is still the case that (r^n) 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 (a_n = ar_1^n + br_2^n ext{,}) since we can”t distinguish between (r_1^n) and (r_2^n ext{.}) We are in luck though:

Characteristic Root Technique for Repeated Roots

Suppose the recurrence relation (a_n = alpha a_{n-1} + eta a_{n-2}) has a characteristic polynomial with only one root (r ext{.}) Then the solution to the recurrence relation is

egin{equation*}a_n = ar^n + bnr^nend{equation*}

where (a) and (b) are constants determined by the initial conditions.

Notice the extra (n) in (bnr^n ext{.}) This allows us to solve for the constants (a) and (b) from the initial conditions.

Example2.4.7

Solve the recurrence relation (a_n = 6a_{n-1} – 9a_{n-2}) with initial conditions (a_0 = 1) and (a_1 = 4 ext{.})

The characteristic polynomial is (x^2 – 6x + 9 ext{.}) We solve the characteristic equation

egin{equation*}x^2 – 6x + 9 = 0end{equation*}

by factoring:

egin{equation*}(x – 3)^2 = 0end{equation*}

so (x =3) is the only characteristic root. Therefore we know that the solution to the recurrence relation has the form

egin{equation*}a_n = a 3^n + bn3^nend{equation*}

for some constants (a) and (b ext{.}) Now use the initial conditions:

egin{align*}a_0 = 1 amp = a 3^0 + bcdot 0 cdot 3^0 = a\a_1 = 4 amp = acdot 3 + bcdot 1 cdot3 = 3a + 3b.end{align*}

Since (a = 1 ext{,}) we find that (b = frac{1}{3} ext{.}) Therefore the solution to the recurrence relation is

egin{equation*}a_n = 3^n + frac{1}{3}n3^n.end{equation*}

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, (a_n = 2a_{n-1} + a_{n-2} – 3a_{n-3}) has characteristic polynomial (x^3 – 2 x^2 – x + 3 ext{.}) 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 (a_n = ar_1^n + br_2^n + cr_3^n) if there were 3 distinct roots). It is also possible to solve recurrence relations of the form (a_n = alpha a_{n-1} + eta a_{n-2} + C) for some constant (C ext{.}) It is also possible (and acceptable) for the characteristic roots to be complex numbers.

### SubsectionExercises

¶1

Find the next two terms in ((a_n)_{nge 0}) beginning (3, 5, 11, 21, 43, 85ldots. ext{.}) Then give a recursive definition for the sequence. Finally, use the characteristic root technique to find a closed formula for the sequence.

171 and 341. (a_n = a_{n-1} + 2a_{n-2}) with (a_0 = 3) and (a_1 = 5 ext{.}) Closed formula: (a_n = frac{8}{3}2^n + frac{1}{3}(-1)^n ext{.}) To find this solve the characteristic polynomial, (x^2 – x – 2 ext{,}) to get characteristic roots (x = 2) and (x=-1 ext{.}) Then solve the system

egin{align*}3 amp = a + b\5 amp = 2a – bend{align*}

(a_n = 3 + 2^{n+1} ext{.}) We should use telescoping or iteration here. For example, telescoping gives

egin{align*}a_1 – a_0 amp = 2^1\a_2 – a_1 amp = 2^2\a_3 – a_2 amp = 2^3\vdotsamp vdots \a_n – a_{n-1} amp = 2^nend{align*}

which sums to (a_n – a_0 = 2^{n+1} – 2) (using the multiply-shift-subtract technique from Section 2.2 for the right-hand side). Substituting (a_0 = 5) and solving for (a_n) completes the solution.

We claim (a_n = 4^n) works. Plug it in: (4^n = 3(4^{n-1}) + 4(4^{n-2}) ext{.}) This works – just simplify the right-hand side.

4

Find the solution to the recurrence relation (a_n = 3a_{n-1} + 4a_{n-2}) with initial terms (a_0 = 2) and (a_1 = 3 ext{.})

5

Find the solution to the recurrence relation (a_n = 3a_{n-1} + 4a_{n-2}) with initial terms (a_0 = 5) and (a_1 = 8 ext{.})

6

Solve the recurrence relation (a_n = 2a_{n-1} – a_{n-2} ext{.})

What is the solution if the initial terms are (a_0 = 1) and (a_1 = 2 ext{?})

What do the initial terms need to be in order for (a_9 = 30 ext{?})

For which (x) are there initial terms which make (a_9 = x ext{?})

7

Solve the recurrence relation (a_n = 3a_{n-1} + 10a_{n-2}) with initial terms (a_0 = 4) and (a_1 = 1 ext{.})

8

Suppose that (r^n) and (q^n) are both solutions to a recurrence relation of the form (a_n = alpha a_{n-1} + eta a_{n-2} ext{.}) Prove that (ccdot r^n + d cdot q^n) is also a solution to the recurrence relation, for any constants (c, d ext{.})

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.

Find both a recursive and closed formula for how many Skittles the *n*th customer gets.

Check your solution for the closed formula by solving the recurrence relation using the Characteristic Root technique.

10

You have access to (1 imes 1) tiles which come in 2 different colors and (1 imes 2) tiles which come in 3 different colors. We want to figure out how many different (1 imes n) path designs we can make out of these tiles.

Find a recursive definition for the sequence (a_n) of paths of length (n ext{.})

Solve the recurrence relation using the Characteristic Root technique.

11

Let (a_n) be the number of (1 imes n) tile designs you can make using (1 imes 1) squares available in 4 colors and (1 imes 2) dominoes available in 5 colors.

First, find a recurrence relation to describe the problem. Explain why the recurrence relation is correct (in the context of the problem).

See more: Wrecking Ball Lip Sync – Anne Hathaway'S Wrecking Ball Vs

Write out the first 6 terms of the sequence (a_1, a_2, ldots ext{.})

Solve the recurrence relation. That is, find a closed formula for (a_n ext{.})

12

Consider the recurrence relation (a_n = 4a_{n-1} – 4a_{n-2} ext{.})

Find the general solution to the recurrence relation (beware the repeated root).