Linear Recurrences
Characteristic Equations
Learn to solve recurrence relations by converting them into polynomial equations and finding closed-form solutions.
What Is a Recurrence Relation?
A recurrence relation defines each term of a sequence using previous terms. Instead of a direct formula, it gives a recursive rule:
Our goal: find a closed-form formula \( a_n = f(n) \) that gives any term directly without computing all previous terms.
Linear Homogeneous Recurrences
We focus on linear homogeneous recurrences with constant coefficients. The general form of order \( k \) is:
Why Does This Matter?
Recurrences appear everywhere in computer science and mathematics. Solving them lets us analyze algorithm runtime, count combinatorial objects, and model growth processes.
The Key Insight: Try \( a_n = r^n \)
The magic trick: guess that the solution has the form \( a_n = r^n \) for some constant \( r \). Substituting into the recurrence turns it into a polynomial equation.
The Characteristic Equation
More generally, for an order-\( k \) recurrence \( a_n = c_1 a_{n-1} + \cdots + c_k a_{n-k} \), the characteristic equation is:
Distinct vs Repeated Roots
For a second-order recurrence, the characteristic equation is quadratic with two roots. The solution form depends on whether those roots are distinct or repeated:
How to Solve: Step by Step
Example 1: Distinct Roots
Example 1: Finding \( A \) and \( B \)
We have \( a_n = A \cdot 2^n + B \cdot 3^n \). Now apply the initial conditions:
Example 2: Repeated Root
Example 3: The Fibonacci Sequence
Visualizing the Solution
The closed-form solution is a combination of exponential functions. For \( a_n = -2^n + 2 \cdot 3^n \) from Example 1:
Homogeneous vs Non-Homogeneous
| Homogeneous | Non-Homogeneous | |
|---|---|---|
| Form | \( a_n = c_1 a_{n-1} + c_2 a_{n-2} \) | \( a_n = c_1 a_{n-1} + c_2 a_{n-2} + f(n) \) |
| Extra term | None | \( f(n) \) (e.g., \( 3^n \), \( n^2 \), constant) |
| Method | Characteristic equation alone | Characteristic eq. + particular solution |
| This lesson | ✓ Covered | Not yet |
Common Mistakes
Summary Reference
| Scenario | Roots | General Solution |
|---|---|---|
| Two distinct real roots | \( r_1 \neq r_2 \) | \( A r_1^n + B r_2^n \) |
| One repeated real root | \( r_1 = r_2 = r_0 \) | \( (A + Bn) r_0^n \) |
| Complex conjugate roots | \( r = \alpha \pm \beta i \) | \( \rho^n(A\cos n\theta + B\sin n\theta) \) |
Question 1 of 5
What is the characteristic equation for the recurrence \( a_n = 7a_{n-1} - 10a_{n-2} \)?
Question 2 of 5
The characteristic equation \( r^2 - 5r + 6 = 0 \) factors as \( (r-2)(r-3) = 0 \). What is the general solution?
Question 3 of 5
For the recurrence \( a_n = 4a_{n-1} - 4a_{n-2} \), the characteristic equation is \( r^2 - 4r + 4 = 0 \). What form does the general solution take?
Question 4 of 5
Given \( a_n = A \cdot 2^n + B \cdot 5^n \) with \( a_0 = 3 \) and \( a_1 = 8 \), what system of equations do you solve for \( A \) and \( B \)?
Question 5 of 5
The Fibonacci recurrence \( F_n = F_{n-1} + F_{n-2} \) has characteristic roots \( \varphi = \frac{1+\sqrt{5}}{2} \) and \( \hat\varphi = \frac{1-\sqrt{5}}{2} \). As \( n \to \infty \), which term dominates?