Recurrences & Characteristic Equations

Study Sheet

Recurrences & Characteristic Equations

Closed forms for linear recursions

The Characteristic Equation Method

Tip
Distinct roots

For an+2=p an+1+q ana_{n+2}=p\,a_{n+1}+q\,a_n, solve x2=px+qx^2=px+q. With distinct roots r,sr,s: an=Arn+Bsna_n = A r^n + B s^n, where A,BA,B come from the first two terms.

In plain terms. Guess an=xna_n = x^n, and the recurrence becomes a quadratic in xx. Every solution is a mix of the two root-powers; the starting values fix the mix.

Example. an+2=an+1+2ana_{n+2}=a_{n+1}+2a_n has roots 2,−12,-1; with a1=1,a2=2a_1=1,a_2=2 the mix is an=2n−1a_n=2^{n-1} exactly.

Why it works. Try an=xna_n = x^n: the recurrence an+2=pan+1+qana_{n+2} = pa_{n+1} + qa_n becomes xn+2=pxn+1+qxnx^{n+2} = px^{n+1} + qx^n, i.e. x2=px+qx^2 = px + q. So each root gives a solution, and because the recurrence is linear, any combination Arn+BsnAr^n + Bs^n is a solution too. Two free constants match any two starting values, and a sequence is fixed by its first two terms, so these are all the solutions.

Tip
Repeated roots

If the characteristic equation has a double root rr, the general solution gains a factor of nn: an=(A+Bn) rna_n = (A + Bn)\,r^n.

In plain terms. One root cannot carry two initial conditions alone — the extra nn in front supplies the second degree of freedom.

Example. an=6an−1−9an−2a_n = 6a_{n-1} - 9a_{n-2} has (x−3)2(x-3)^2: with a1=3,a2=18a_1=3, a_2=18, an=n⋅3na_n = n\cdot 3^n.

Concept
Fibonacci and Binet

Fibonacci is the recurrence x2=x+1x^2 = x+1 with roots φ=1+52\varphi = \tfrac{1+\sqrt5}{2} and φ^=1−52\hat\varphi = \tfrac{1-\sqrt5}{2}: Fn=φn−φ^n5F_n = \dfrac{\varphi^n - \hat\varphi^n}{\sqrt5}.

In plain terms. The golden ratio IS the characteristic root of Fibonacci. Since ∣φ^∣<1|\hat\varphi|<1, FnF_n is the nearest integer to φn/5\varphi^n/\sqrt5 — closed forms tame huge indices instantly.

Example. Sums telescope too: F1+F2+⋯+Fn=Fn+2−1F_1+F_2+\cdots+F_n = F_{n+2}-1, so the first ten sum to 144−1=143144-1=143.

Example
Worked: an integer hiding in a power

Find the remainder when ⌊(2+3)6⌋\left\lfloor(2 + \sqrt3)^6\right\rfloor is divided by 10001000.

Spotting it. 2±32 \pm \sqrt3 are the roots of x2=4x−1x^2 = 4x - 1, so sn=(2+3)n+(2−3)ns_n = (2 + \sqrt3)^n + (2 - \sqrt3)^n satisfies sn+2=4sn+1−sns_{n+2} = 4s_{n+1} - s_n and is an integer. The second term is tiny, which pins down the floor.

Step 1. s0=2s_0 = 2, s1=4s_1 = 4, then s2=14s_2 = 14, s3=52s_3 = 52, s4=194s_4 = 194, s5=724s_5 = 724, s6=2702s_6 = 2702.

Step 2. 0<(2−3)6<10 < (2 - \sqrt3)^6 < 1 (indeed 2−3≈0.272 - \sqrt3 \approx 0.27), so (2+3)6=2702−(a number in (0,1))(2 + \sqrt3)^6 = 2702 - (\text{a number in } (0, 1)) and its floor is 27012701.

Step 3. The remainder is 701701.

Example
Worked: a repeated root

a0=1a_0 = 1, a1=4a_1 = 4 and an=4an−1−4an−2a_n = 4a_{n-1} - 4a_{n-2}. Find the remainder when a10a_{10} is divided by 10001000.

Spotting it. x2=4x−4x^2 = 4x - 4 is (x−2)2=0(x - 2)^2 = 0: a double root, so the solution has the form (A+Bn)2n(A + Bn)2^n.

Step 1. a0=A=1a_0 = A = 1 and a1=2(A+B)=4a_1 = 2(A + B) = 4, so B=1B = 1 and an=(n+1)2na_n = (n + 1)2^n.

Step 2. Check: a2=4⋅4−4⋅1=12=3⋅4a_2 = 4 \cdot 4 - 4 \cdot 1 = 12 = 3 \cdot 4 ✓

Step 3. a10=11⋅1024=11264a_{10} = 11 \cdot 1024 = 11264, and the remainder is 264264.

Side note
Where it goes wrong

Using Arn+BsnAr^n + Bs^n when the roots coincide. For an=6an−1−9an−2a_n = 6a_{n-1} - 9a_{n-2} the only root is 33, and A⋅3n+B⋅3nA \cdot 3^n + B \cdot 3^n is really one constant: it cannot match a1=3a_1 = 3, a2=18a_2 = 18 (it would need 3C=33C = 3 and 9C=189C = 18). The missing solution is n⋅3nn \cdot 3^n, which is why a double root needs (A+Bn)rn(A + Bn)r^n.

Try it
Try it: two roots of opposite sign

a0=0a_0 = 0, a1=5a_1 = 5 and an=an−1+6an−2a_n = a_{n-1} + 6a_{n-2}. Find a5a_5.

Show the answer

The characteristic equation x2=x+6x^2 = x + 6 has roots 33 and −2-2, so an=A⋅3n+B(−2)na_n = A \cdot 3^n + B(-2)^n with A+B=0A + B = 0 and 3A−2B=53A - 2B = 5: A=1A = 1, B=−1B = -1. Then a5=243+32=275a_5 = 243 + 32 = 275. Check by iterating: 0,5,5,35,65,2750, 5, 5, 35, 65, 275 ✓

Solving Recurrences Two Ways

Tip
The characteristic equation

For an=pan−1+qan−2a_n = pa_{n-1} + qa_{n-2}, solve r2=pr+qr^2 = pr + q: distinct roots give an=Ar1n+Br2na_n = Ar_1^n + Br_2^n, a repeated root gives an=(A+Bn)rna_n = (A + Bn)r^n.

Fibonacci has r2=r+1r^2 = r + 1, roots 1±52\tfrac{1\pm\sqrt5}2, hence Binet's formula. The constants come from the initial terms, and forgetting that a repeated root needs the extra factor nn is the standard error — check any closed form against a1a_1 and a2a_2 before using it.

Tip
Generating functions

Set F(x)=∑anxnF(x) = \sum a_nx^n, multiply the recurrence by xnx^n, sum, and solve for FF; partial fractions recovers ana_n.

For an=2an−1+1a_n = 2a_{n-1} + 1 with a0=0a_0 = 0 you can also just iterate: an=2n−1a_n = 2^n - 1. Generating functions earn their keep when the recurrence has a non-constant forcing term or a convolution, where telescoping and characteristic equations both fail.

Example
Worked: a linear recurrence in closed form

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

Step 1 — characteristic equation r2−5r+6=0r^2 - 5r + 6 = 0, roots 22 and 33.

Step 2 — an=A⋅2n+B⋅3na_n = A\cdot2^n + B\cdot3^n.

Step 3 — A+B=2A + B = 2 and 2A+3B=52A + 3B = 5 give B=1B = 1, A=1A = 1, so an=2n+3na_n = 2^n + 3^n. Check: a2=4+9=13a_2 = 4 + 9 = 13 and 5(5)−6(2)=135(5) - 6(2) = 13 ✓

Example
Worked: a polynomial forcing term

a0=0a_0 = 0 and an=2an−1+na_n = 2a_{n-1} + n. Find the remainder when a10a_{10} is divided by 10001000.

Spotting it. The forcing term nn is a polynomial of degree 11, so look for a particular solution of the same shape, cn+dcn + d, and add the homogeneous part C⋅2nC \cdot 2^n.

Step 1. cn+d=2(c(n−1)+d)+ncn + d = 2(c(n - 1) + d) + n for all nn means c=2c+1c = 2c + 1 and d=−2c+2dd = -2c + 2d, so c=−1c = -1 and d=−2d = -2.

Step 2. an=C⋅2n−n−2a_n = C \cdot 2^n - n - 2, and a0=0a_0 = 0 gives C=2C = 2: an=2n+1−n−2a_n = 2^{n+1} - n - 2. Check: a1=1a_1 = 1 and a2=2⋅1+2=4=8−4a_2 = 2 \cdot 1 + 2 = 4 = 8 - 4 ✓

Step 3. a10=2048−12=2036a_{10} = 2048 - 12 = 2036, and the remainder is 3636.

Side note
Where it goes wrong

Trusting a closed form you have not tested. After solving for the constants, compute a2a_2 (or a3a_3) both from the recurrence and from the formula. In the worked example, a sign slip giving an=3⋅2n−3na_n = 3 \cdot 2^n - 3^n still matches a0=2a_0 = 2 but gives a1=3a_1 = 3 instead of 55; the check catches it in seconds.

Try it
Try it: iterate a simple recurrence

an=3an−1+2a_n = 3a_{n-1} + 2 with a0=0a_0 = 0. Find a closed form.

Show the answer

Add 11 to both sides: an+1=3(an−1+1)a_n + 1 = 3(a_{n-1} + 1), so an+1=3na_n + 1 = 3^n and an=3n−1a_n = 3^n - 1.

Constant Terms, Substitutions and Periodicity

Tip
Shift, flip, or reduce

For an=c an−1+da_n = c\,a_{n-1} + d with c≠1c \ne 1, subtract the fixed point L=d1−cL = \tfrac{d}{1 - c}: then an−L=c(an−1−L)a_n - L = c(a_{n-1} - L), a geometric sequence. For recurrences like an+1=an1+kana_{n+1} = \tfrac{a_n}{1 + ka_n}, the reciprocals bn=1anb_n = \tfrac1{a_n} are arithmetic. And any recurrence taken modulo mm is eventually periodic.

Why it works. The fixed point LL satisfies L=cL+dL = cL + d; subtracting that from an=can−1+da_n = ca_{n-1} + d cancels dd and leaves a pure multiple. Taking reciprocals of an+1=an1+kana_{n+1} = \tfrac{a_n}{1 + ka_n} gives 1an+1=1an+k\tfrac1{a_{n+1}} = \tfrac1{a_n} + k. And modulo mm a recurrence of order kk has at most mkm^k possible windows of kk consecutive terms, so some window repeats and from then on the sequence cycles.

Example
Worked: shift by the fixed point

a1=1a_1 = 1 and an+1=3an+4a_{n+1} = 3a_n + 4. Find the remainder when a7a_7 is divided by 10001000.

Spotting it. A constant term spoils the pure geometric pattern; the fixed point L=3L+4L = 3L + 4, i.e. L=−2L = -2, removes it.

Step 1. an+1+2=3(an+2)a_{n+1} + 2 = 3(a_n + 2), so an+2=3n−1(a1+2)=3na_n + 2 = 3^{n-1}(a_1 + 2) = 3^n and an=3n−2a_n = 3^n - 2.

Step 2. a7=2187−2=2185a_7 = 2187 - 2 = 2185, so the remainder is 185185. Check the start: a1=1a_1 = 1, a2=7=9−2a_2 = 7 = 9 - 2 ✓

Example
Worked: flip it

a1=2a_1 = 2 and an+1=an1+3ana_{n+1} = \dfrac{a_n}{1 + 3a_n}. Then a10=mna_{10} = \tfrac mn in lowest terms. Find m+nm + n.

Spotting it. A fraction whose denominator is 1+(constant)an1 + (\text{constant})a_n: reciprocals turn it into an arithmetic sequence.

Step 1. 1an+1=1+3anan=1an+3\dfrac1{a_{n+1}} = \dfrac{1 + 3a_n}{a_n} = \dfrac{1}{a_n} + 3.

Step 2. 1a1=12\tfrac1{a_1} = \tfrac12, so 1a10=12+9⋅3=552\tfrac{1}{a_{10}} = \tfrac12 + 9 \cdot 3 = \tfrac{55}{2} and a10=255a_{10} = \tfrac{2}{55}.

Step 3. m+n=57m + n = 57.

Example
Worked: a last digit by periodicity

What is the last digit of the Fibonacci number F2026F_{2026} (with F1=F2=1F_1 = F_2 = 1)?

Spotting it. Last digits of Fibonacci numbers follow the same recurrence mod 1010, so they are periodic. The period of the pair (Fn,Fn+1) mod 10(F_n, F_{n+1}) \bmod 10 is 6060: the pair (1,1)(1, 1) first returns at (F61,F62)(F_{61}, F_{62}).

Step 1. 2026=60⋅33+462026 = 60 \cdot 33 + 46, so F2026≡F46(mod10)F_{2026} \equiv F_{46} \pmod{10}.

Step 2. F46=1836311903F_{46} = 1836311903, so the last digit is 33. (Without the exact value: F46=F23(F22+F24)F_{46} = F_{23}(F_{22} + F_{24}), and the last digits of F22,F23,F24F_{22}, F_{23}, F_{24} are 1,7,81, 7, 8, giving 7⋅9=637 \cdot 9 = 63, last digit 33.)

Side note
Where it goes wrong

Solving the homogeneous part and stopping. For an+1=3an+4a_{n+1} = 3a_n + 4, writing an=A⋅3na_n = A \cdot 3^n and fitting a1=1a_1 = 1 gives an=3n−1a_n = 3^{n-1}, which already fails at a2a_2 (3≠73 \ne 7). The constant term needs its own particular solution, the fixed point −2-2; only then does the geometric part carry the initial condition.

Try it
Try it: a fixed point at 3

a0=5a_0 = 5 and an=2an−1−3a_n = 2a_{n-1} - 3. Find the remainder when a10a_{10} is divided by 10001000.

Show the answer

The fixed point solves L=2L−3L = 2L - 3, so L=3L = 3 and an−3=2n(a0−3)=2n+1a_n - 3 = 2^n(a_0 - 3) = 2^{n+1}. Then a10=3+211=2051a_{10} = 3 + 2^{11} = 2051, and the remainder is 5151.