Quant Memo
Core

Solving Linear Recurrences With Characteristic Roots

A technique for turning a recursive definition — where each term depends on the ones before it — into a closed-form formula you can evaluate directly, without stepping through every prior term.

Prerequisites: Mathematical Induction, Sequences and Series Convergence

An interviewer gives you a recurrence like an=5an16an2a_n = 5a_{n-1} - 6a_{n-2} with a0=1a_0 = 1, a1=4a_1 = 4, and asks for a20a_{20}. You could compute nineteen steps by hand, but there's a faster route: find a formula for ana_n directly, plug in n=20n=20, and you're done. That formula-finding trick is the characteristic-root method, and it turns almost any interview recurrence into a two-line algebra problem.

The idea: guess a geometric form

A linear recurrence says each term is a fixed linear combination of the previous few terms, like an=c1an1+c2an2a_n = c_1 a_{n-1} + c_2 a_{n-2}. The trick is to guess that the solution looks like a geometric sequence, an=rna_n = r^n for some constant rr, and see what rr has to satisfy. Substituting an=rna_n = r^n into an=c1an1+c2an2a_n = c_1 a_{n-1} + c_2 a_{n-2} and dividing through by rn2r^{n-2} gives the characteristic equation:

r2c1rc2=0.r^2 - c_1 r - c_2 = 0 .

In plain English: this is an ordinary quadratic whose roots are exactly the values of rr for which rnr^n satisfies the recurrence on its own. If the quadratic has two distinct roots r1r_1 and r2r_2, the general solution is a mix of both geometric sequences, an=Ar1n+Br2na_n = A \, r_1^n + B \, r_2^n, and the two unknown weights AA and BB are pinned down by the two starting values you were given.

Worked example: the recurrence above

For an=5an16an2a_n = 5a_{n-1} - 6a_{n-2}, the characteristic equation is r25r+6=0r^2 - 5r + 6 = 0, which factors as (r2)(r3)=0(r-2)(r-3) = 0, giving roots r1=2r_1 = 2, r2=3r_2 = 3. So the general solution is

an=A2n+B3n.a_n = A \cdot 2^n + B \cdot 3^n .

Use the starting values to solve for AA and BB. At n=0n=0: A+B=1A + B = 1. At n=1n=1: 2A+3B=42A + 3B = 4. Substituting A=1BA = 1 - B into the second equation gives 2(1B)+3B=42(1-B) + 3B = 4, so 2+B=42 + B = 4, meaning B=2B = 2 and A=1A = -1. The closed form is an=2n+23na_n = -2^n + 2 \cdot 3^n. Check it: a0=1+2=1a_0 = -1 + 2 = 1 ✓, a1=2+6=4a_1 = -2 + 6 = 4 ✓. Now a20=220+2320a_{20} = -2^{20} + 2 \cdot 3^{20} is a one-line calculation instead of twenty steps of substitution.

Repeated roots

If the quadratic has a repeated root rr (discriminant zero), the second independent solution isn't rnr^n again — it's nrnn \cdot r^n. The general solution becomes an=(A+Bn)rna_n = (A + Bn) r^n. This matters because a naive guess of an=Arn+Brna_n = A r^n + B r^n collapses to a single unknown and can't match two independent starting values.

0 n a_n = -2^n + 2·3^n dominated by 3^n term
The larger root, 3, eventually dominates the sequence's growth — the -2^n term becomes negligible for large n, so a_n ≈ 2·3^n.

What this means in practice

Beyond puzzle recurrences, this is the exact machinery behind analyzing algorithm running times (a recurrence like T(n)=T(n1)+T(n2)T(n) = T(n-1) + T(n-2) describes naive Fibonacci recursion) and behind discrete-time models of compounding processes with memory, like a portfolio rule that blends this period's and last period's signal. Whenever you see "each term depends linearly on the last one or two terms," reach for the characteristic equation instead of grinding through the recursion by hand.

For a linear recurrence an=c1an1+c2an2a_n = c_1 a_{n-1} + c_2 a_{n-2}, form the characteristic equation r2c1rc2=0r^2 - c_1 r - c_2 = 0. Distinct roots r1,r2r_1, r_2 give a closed form an=Ar1n+Br2na_n = A r_1^n + B r_2^n; fit AA and BB using the given starting values.

The largest-magnitude root eventually dominates the sequence's growth rate — a fast way to sanity-check whether a sequence grows, shrinks, or oscillates without computing a single term.

Related concepts

Practice in interviews

Further reading

  • Graham, Knuth, Patashnik, Concrete Mathematics, ch. 7
ShareTwitterLinkedIn