Skip to content

Solving linear recurrence relations

6 min read

Short answer

For an=c1an−1+c2an−2a_n=c_1a_{n-1}+c_2a_{n-2}, try an=λna_n=\lambda^n. This gives the characteristic equation λ2=c1λ+c2\lambda^2=c_1\lambda+c_2. With distinct roots λ1,λ2\lambda_1,\lambda_2, an=Aλ1n+Bλ2na_n=A\lambda_1^n+B\lambda_2^n, and the starting values fix AA and BB.

Steps1Write the characteristic equation2Solve for its roots3Write a_n = Aλ₁ⁿ + Bλ₂ⁿ (use (A +Bn)λⁿ for a repeated root)4Use a₀ and a₁ to solve for A and BAlways verify the formula against the first few terms.
The method mirrors second-order differential equations.

Repeated roots

If λ1=λ2=λ\lambda_1=\lambda_2=\lambda, the general solution is an=(A+Bn)λna_n=(A+Bn)\lambda^n. This is the discrete twin of the xx and xeλxxe^{\lambda x} solutions of differential equations.

Fibonacci

For Fn=Fn−1+Fn−2F_n=F_{n-1}+F_{n-2} the roots are 1±52\tfrac{1\pm\sqrt5}2, which gives Binet's formula and shows that FnF_n grows like the golden ratio to the power nn.

Worked example

Solve an=3an−1−2an−2a_n=3a_{n-1}-2a_{n-2} with a0=1a_0=1, a1=3a_1=3.

λ2−3λ+2=0\lambda^2-3\lambda+2=0 gives λ=1,2\lambda=1,2, so an=A+B⋅2na_n=A+B\cdot2^n. From A+B=1A+B=1 and A+2B=3A+2B=3: B=2B=2, A=−1A=-1. Hence an=2n+1−1a_n=2^{n+1}-1. Check: a2=3⋅3−2⋅1=7=23−1a_2=3\cdot3-2\cdot1=7=2^3-1. ✓

Try it yourself

What is the characteristic equation for an=5an−1−6an−2a_n=5a_{n-1}-6a_{n-2} and its roots?

Show the answer

λ2−5λ+6=0\lambda^2-5\lambda+6=0 factors as (λ−2)(λ−3)=0(\lambda-2)(\lambda-3)=0, so the roots are 22 and 33.

Keep going with practice

Vidi's differential equations lessons use the same characteristic-equation method in continuous time.