Solving Linear Recurrence Relations
To solve a linear recurrence relation such as a_n = c_1 a_{n-1} + c_2 a_{n-2}, try a_n = r^n. This gives the characteristic equation r^2 = c_1 r + c_2. With two different roots, the solution is a_n = \alpha r_1^n + \beta r_2^n, and the initial conditions fix the constants α and β.
Before this lesson: Recurrence Relations, Quadratic Formula and Systems of Equations
The idea
Iterating a recurrence gives terms one at a time, but a closed formula gives any term at once. For the simplest case, a_n = 3a_{n-1}, every term is 3 times the last, so a_n = a_0 \cdot 3^n. The solution is a power of a number.
That suggests trying powers for longer recurrences too. Put a_n = r^n into a_n = 5a_{n-1} - 6a_{n-2}: you get r^n = 5r^{n-1} - 6r^{n-2}. Divide by r^{n-2} to get r^2 = 5r - 6, a quadratic with roots 2 and 3. So both 2^n and 3^n satisfy the recurrence, and so does any combination \alpha 2^n + \beta 3^n.
The characteristic root method
This method solves linear homogeneous recurrence relations with constant coefficients: each term is a fixed combination of earlier terms, with no extra added term. For second order,
a_n = c_1 a_{n-1} + c_2 a_{n-2} \quad \Longrightarrow \quad r^2 - c_1 r - c_2 = 0The quadratic is the characteristic equation, and its solutions are the characteristic roots.
- Two different roots r_1 \ne r_2: a_n = \alpha r_1^n + \beta r_2^n.
- One repeated root r: a_n = (\alpha + \beta n) r^n.
In both cases, substitute the two initial conditions (usually n = 0 and n = 1) to get two equations for α and β. A recurrence of order k works the same way with a characteristic equation of degree k and k constants.
Why the repeated-root case needs n. If r is a double root, \alpha r^n + \beta r^n is really one constant times r^n, which cannot match two separate initial conditions. The second solution n r^n also satisfies the recurrence when r is a double root, which supplies the missing freedom.
How to solve a linear recurrence relation
- Write the recurrence with every term on one side, then replace a_{n-j} with r^{2-j} to get the characteristic equation r^2 - c_1 r - c_2 = 0.
- Solve for the roots by factoring or with the quadratic formula.
- Write the general solution: \alpha r_1^n + \beta r_2^n for different roots, or (\alpha + \beta n) r^n for a repeated root.
- Substitute the initial conditions and solve the 2 × 2 system for α and β.
- Check the formula against a term you compute directly from the recurrence.
Solving linear recurrence relation examples
Example 1: Two different roots
Solve a_n = 5a_{n-1} - 6a_{n-2} with a_0 = 1 and a_1 = 4.
r^2 = 5r - 6
Replace an, an−1, an−2 with r2, r, 1.
r^2 - 5r + 6 = 0
Move every term to the left side.
(r - 2)(r - 3) = 0
Factor the trinomial (see factoring trinomials).
r_1 = 2,\ r_2 = 3
Set each factor equal to 0.
a_n = \alpha 2^n + \beta 3^n
Write the general solution.
\alpha + \beta = 1
Substitute n = 0: a0 = 1.
2\alpha + 3\beta = 4
Substitute n = 1: a1 = 4.
2\alpha + 2\beta = 2
Multiply the first equation by 2.
\beta = 2
Subtract it from the second equation (see elimination method).
\alpha = 1 - 2 = -1
Substitute β = 2 into α + β = 1.
a_n = 2 \cdot 3^n - 2^n
Write the closed formula.
a_2 = 5(4) - 6(1) = 14
Check with the recurrence: 20 − 6 = 14.
2 \cdot 9 - 4 = 14
The formula gives the same value.
Answer: a_n = 2 \cdot 3^n - 2^n.
Example 2: The Fibonacci numbers
Find a closed formula for F_n = F_{n-1} + F_{n-2} with F_0 = 0 and F_1 = 1.
r^2 - r - 1 = 0
Write the characteristic equation.
r = \frac{1 \pm \sqrt{5}}{2}Use the quadratic formula with a = 1, b = −1, c = −1.
\varphi = \frac{1 + \sqrt{5}}{2},\ \psi = \frac{1 - \sqrt{5}}{2}Name the two roots.
F_n = \alpha \varphi^n + \beta \psi^n
Write the general solution.
\alpha + \beta = 0
Substitute n = 0: F0 = 0.
\beta = -\alpha
Solve the first equation for β.
\alpha \varphi - \alpha \psi = 1
Substitute n = 1 and β = −α: F1 = 1.
\alpha (\varphi - \psi) = 1
Factor out α.
\varphi - \psi = \sqrt{5}Subtract the roots: the halves of √5 add.
\alpha = \frac{1}{\sqrt{5}},\ \beta = -\frac{1}{\sqrt{5}}Divide by √5.
F_n = \frac{\varphi^n - \psi^n}{\sqrt{5}}Write the closed formula.
Answer: F_n = \dfrac{1}{\sqrt{5}}\left(\left(\frac{1 + \sqrt{5}}{2}\right)^n - \left(\frac{1 - \sqrt{5}}{2}\right)^n\right), called Binet’s formula. The number φ ≈ 1.618 is the golden ratio. Because |ψ| ≈ 0.618 is less than 1, F_n is the nearest integer to \varphi^n / \sqrt{5}.
Example 3: A repeated root
Solve a_n = 6a_{n-1} - 9a_{n-2} with a_0 = 2 and a_1 = 9.
r^2 - 6r + 9 = 0
Write the characteristic equation.
(r - 3)^2 = 0
Factor the perfect square trinomial (see perfect square trinomials).
r = 3
The root 3 is repeated.
a_n = (\alpha + \beta n) 3^n
Use the repeated-root form.
\alpha = 2
Substitute n = 0: (α + 0)(1) = 2.
(2 + \beta) \cdot 3 = 9
Substitute n = 1 and α = 2.
2 + \beta = 3
Divide both sides by 3.
\beta = 1
Subtract 2 from both sides.
a_n = (n + 2) 3^n
Write the closed formula.
a_2 = 6(9) - 9(2) = 36
Check with the recurrence: 54 − 18 = 36.
(2 + 2) \cdot 9 = 36
The formula gives the same value.
Answer: a_n = (n + 2) \cdot 3^n.
Example 4: A closed formula for an earlier example
The lesson on recurrence relations found the terms 2, 1, 5, 7, 17, 31 for a_n = a_{n-1} + 2a_{n-2} with a_0 = 2 and a_1 = 1. Find a closed formula.
r^2 - r - 2 = 0
Write the characteristic equation.
(r - 2)(r + 1) = 0
Factor the trinomial.
r_1 = 2,\ r_2 = -1
Set each factor equal to 0.
a_n = \alpha 2^n + \beta (-1)^n
Write the general solution.
\alpha + \beta = 2
Substitute n = 0.
2\alpha - \beta = 1
Substitute n = 1.
3\alpha = 3
Add the two equations.
\alpha = 1,\ \beta = 1
Divide by 3, then use α + β = 2.
a_n = 2^n + (-1)^n
Write the closed formula.
Answer: a_n = 2^n + (-1)^n. Check: a_5 = 32 - 1 = 31, which matches the list.
Example 5: Tiling a strip (word problem)
A strip of n cells is covered with red 1-cell squares and with 2-cell tiles that come in two colors, blue and green. Let t_n be the number of ways to cover the strip. Find a closed formula and the number of ways for n = 10.
t_n = t_{n-1} + 2t_{n-2}Add the three cases for the last tile.
t_1 = 1,\ t_2 = 3
One cell: red. Two cells: two reds, one blue or one green.
t_n = \alpha 2^n + \beta (-1)^n
Same characteristic roots as Example 4: 2 and −1.
2\alpha - \beta = 1
Substitute n = 1.
4\alpha + \beta = 3
Substitute n = 2.
6\alpha = 4
Add the two equations.
\alpha = \frac{2}{3}Divide by 6.
\beta = 2 \cdot \frac{2}{3} - 1 = \frac{1}{3}Solve 2α − β = 1 for β.
t_n = \frac{2^{n+1} + (-1)^n}{3}Combine over the common denominator 3.
t_{10} = \frac{2^{11} + 1}{3} = \frac{2049}{3}Substitute n = 10: 2048 + 1 = 2049.
\frac{2049}{3} = 683Divide.
Answer: t_n = \dfrac{2^{n+1} + (-1)^n}{3}, and there are 683 tilings of a strip of 10 cells. Iterating gives the same list: 1, 3, 5, 11, 21, 43, 85, 171, 341, 683.
Common mistakes
| Mistake | Example of the error | Fix |
|---|---|---|
| Sign errors in the characteristic equation | a_n = 5a_{n-1} - 6a_{n-2} written as r^2 + 5r - 6 = 0 | Move every term to one side: r^2 - 5r + 6 = 0. |
| Using two separate constants for a repeated root | a_n = \alpha 3^n + \beta 3^n | That is one constant in disguise. Use (\alpha + \beta n) 3^n. |
| Matching the wrong indices | Using n = 1 and n = 2 when the conditions give a_0 and a_1 | Substitute the same n values that the initial conditions use. |
| Using the method on a recurrence with an extra term | H_n = 2H_{n-1} + 1 solved as \alpha 2^n | The + 1 needs a particular solution too (see Related methods). |
| Using it on a nonlinear recurrence | a_n = a_{n-1}^2 with roots of r^2 = r | The method needs a linear relation with constant coefficients. |
| Skipping the check | A sign slip in β goes unnoticed | Compare the formula with a term found by iterating, such as a_2. |
Related methods
First-order recurrences with a constant term
For a_n = c \cdot a_{n-1} + d with c ≠ 1, the constant sequence p = d/(1 - c) is one solution, and adding A c^n gives all of them: a_n = A c^n + \frac{d}{1 - c}. For the Tower of Hanoi, H_n = 2H_{n-1} + 1 gives p = 1/(1 − 2) = −1, so H_n = A \cdot 2^n - 1. Then H_1 = 1 gives 2A − 1 = 1, so A = 1 and H_n = 2^n - 1.
The same idea elsewhere
Linear differential equations use the same steps: second-order homogeneous linear equations try e^{rx} instead of r^n, and repeated roots bring in an extra factor of x instead of n. In linear algebra, the characteristic roots are the eigenvalues of a matrix that steps the sequence forward, found from its characteristic polynomial. The next lesson, Generating Functions, gives another way to solve recurrences.
Practice problems
- Solve a_n = 7a_{n-1} - 10a_{n-2} with a_0 = 2 and a_1 = 7.
- Solve a_n = a_{n-1} + 6a_{n-2} with a_0 = 3 and a_1 = 4.
- Solve a_n = 4a_{n-1} - 4a_{n-2} with a_0 = 1 and a_1 = 6.
- Find the characteristic equation and roots of a_n = 3a_{n-1} + 4a_{n-2}.
- Solve a_n = 2a_{n-1} with a_0 = 7.
- Solve a_n = -a_{n-1} + 12a_{n-2} with a_0 = 0 and a_1 = 7.
- Solve a_n = 10a_{n-1} - 25a_{n-2} with a_0 = 3 and a_1 = 20.
- Solve a_n = 3a_{n-1} + 2 with a_0 = 1.
- The Lucas numbers satisfy L_n = L_{n-1} + L_{n-2} with L_0 = 2 and L_1 = 1. Find a closed formula.
- Solve s_n = 4s_{n-1} - 3s_{n-2} with s_0 = 2 and s_1 = 8, and find s_{10}.
Show answers
1.
r^2 - 7r + 10 = 0
Write the characteristic equation.
(r - 2)(r - 5) = 0
Factor.
a_n = \alpha 2^n + \beta 5^n
The roots are 2 and 5.
\alpha + \beta = 2,\ 2\alpha + 5\beta = 7
Substitute n = 0 and n = 1.
3\beta = 3
Subtract 2 times the first equation from the second.
\beta = 1,\ \alpha = 1
Divide by 3, then use α + β = 2.
Answer: a_n = 2^n + 5^n
2.
r^2 - r - 6 = 0
Write the characteristic equation.
(r - 3)(r + 2) = 0
Factor.
a_n = \alpha 3^n + \beta (-2)^n
The roots are 3 and −2.
\alpha + \beta = 3,\ 3\alpha - 2\beta = 4
Substitute n = 0 and n = 1.
5\alpha = 10
Add 2 times the first equation to the second.
\alpha = 2,\ \beta = 1
Divide by 5, then use α + β = 3.
Answer: a_n = 2 \cdot 3^n + (-2)^n
3.
r^2 - 4r + 4 = 0
Write the characteristic equation.
(r - 2)^2 = 0
Factor: 2 is a repeated root.
a_n = (\alpha + \beta n) 2^n
Use the repeated-root form.
\alpha = 1
Substitute n = 0.
(1 + \beta) \cdot 2 = 6
Substitute n = 1.
\beta = 2
Divide by 2, then subtract 1.
Answer: a_n = (2n + 1) 2^n
4.
r^2 - 3r - 4 = 0
Move every term to one side.
(r - 4)(r + 1) = 0
Factor.
Answer: r^2 - 3r - 4 = 0, with roots 4 and −1
5.
r = 2
The characteristic equation is r − 2 = 0.
a_n = \alpha 2^n,\ \alpha = 7
Substitute n = 0.
Answer: a_n = 7 \cdot 2^n
6.
r^2 + r - 12 = 0
Write the characteristic equation.
(r - 3)(r + 4) = 0
Factor.
a_n = \alpha 3^n + \beta (-4)^n
The roots are 3 and −4.
\alpha + \beta = 0,\ 3\alpha - 4\beta = 7
Substitute n = 0 and n = 1.
7\alpha = 7
Add 4 times the first equation to the second.
\alpha = 1,\ \beta = -1
Divide by 7, then use α + β = 0.
Answer: a_n = 3^n - (-4)^n
7.
r^2 - 10r + 25 = 0
Write the characteristic equation.
(r - 5)^2 = 0
Factor: 5 is a repeated root.
a_n = (\alpha + \beta n) 5^n
Use the repeated-root form.
\alpha = 3
Substitute n = 0.
(3 + \beta) \cdot 5 = 20
Substitute n = 1.
\beta = 1
Divide by 5, then subtract 3.
Answer: a_n = (n + 3) 5^n
8.
p = \frac{2}{1 - 3} = -1Find the constant solution.
a_n = A \cdot 3^n - 1
Add the solution of an = 3an−1.
A - 1 = 1
Substitute n = 0.
A = 2
Add 1 to both sides.
Answer: a_n = 2 \cdot 3^n - 1 (check: 1, 5, 17, …)
9.
L_n = \alpha \varphi^n + \beta \psi^n
Same characteristic roots as the Fibonacci numbers.
\alpha + \beta = 2
Substitute n = 0.
\alpha \varphi + \beta \psi = 1
Substitute n = 1.
\varphi + \psi = 1
Add the roots: the √5 terms cancel.
\alpha = \beta = 1
These values satisfy both equations.
Answer: L_n = \varphi^n + \psi^n
10.
r^2 - 4r + 3 = 0
Write the characteristic equation.
(r - 1)(r - 3) = 0
Factor.
s_n = \alpha + \beta 3^n
The roots are 1 and 3, and 1n = 1.
\alpha + \beta = 2,\ \alpha + 3\beta = 8
Substitute n = 0 and n = 1.
2\beta = 6
Subtract the first equation from the second.
\beta = 3,\ \alpha = -1
Divide by 2, then use α + β = 2.
s_n = 3^{n+1} - 1Combine 3 · 3n = 3n+1.
s_{10} = 3^{11} - 1 = 177{,}146Substitute n = 10: 177,147 − 1.
Answer: s_n = 3^{n+1} - 1 and s_{10} = 177{,}146
Solving linear recurrence relations FAQ
What is the characteristic equation of a recurrence relation?
For a_n = c_1 a_{n-1} + c_2 a_{n-2}, it is r^2 - c_1 r - c_2 = 0. You get it by trying a_n = r^n and dividing by r^{n-2}.
How do you solve a recurrence relation with a repeated root?
If r is a double root, the general solution is a_n = (\alpha + \beta n) r^n. Use the two initial conditions to find α and β.
What is the closed formula for the Fibonacci numbers?
Binet’s formula: F_n = (\varphi^n - \psi^n)/\sqrt{5}, where \varphi = (1 + \sqrt{5})/2 and \psi = (1 - \sqrt{5})/2.
Does this method work for every recurrence relation?
No. It works for linear recurrences with constant coefficients. A constant added term needs a particular solution as well, and nonlinear recurrences such as a_n = a_{n-1}^2 need other methods.
Summary
- Try a_n = r^n to turn a linear recurrence with constant coefficients into a characteristic equation.
- Different roots: a_n = \alpha r_1^n + \beta r_2^n. A repeated root: a_n = (\alpha + \beta n) r^n.
- The initial conditions give a 2 × 2 system for α and β.
- Check the closed formula against a term found by iterating.
- For a_n = c \cdot a_{n-1} + d, add the constant solution d/(1 − c) to A c^n.
Previous lesson: Recurrence Relations
Next lesson: Generating Functions
Back to the Discrete Math Index