For linear homogeneous recurrences with constant coefficients, a standard method turns the recurrence into an ordinary quadratic equation. This topic shows how to get a closed formula.

The characteristic equation method

For a recurrence of the form aₙ = c₁aₙ₋₁ + c₂aₙ₋₂:

  1. Replace aₙ by r², aₙ₋₁ by r and aₙ₋₂ by 1 to get the characteristic equation r² − c₁r − c₂ = 0.
  2. Find its roots r₁ and r₂.
  3. Distinct roots: aₙ = A r₁ⁿ + B r₂ⁿ. Repeated root r: aₙ = (A + Bn) rⁿ.
  4. Use the initial conditions to find A and B.

Worked example 1: distinct roots

Solve aₙ = 5aₙ₋₁ − 6aₙ₋₂ with a₀ = 1 and a₁ = 0.

  • Characteristic equation: r² − 5r + 6 = 0, so (r − 2)(r − 3) = 0 and r = 2 or 3.
  • General solution: aₙ = A·2ⁿ + B·3ⁿ.
  • Conditions: n = 0 gives A + B = 1; n = 1 gives 2A + 3B = 0. Then B = 1 − A, so 2A + 3 − 3A = 0, so A = 3 and B = −2.
  • Answer: aₙ = 3·2ⁿ − 2·3ⁿ.
  • Check: a₂ from the recurrence is 5(0) − 6(1) = −6; from the formula 3·4 − 2·9 = −6 ✓.

Worked example 2: repeated root

Solve aₙ = 4aₙ₋₁ − 4aₙ₋₂ with a₀ = 1 and a₁ = 4.

  • r² − 4r + 4 = 0 gives (r − 2)² = 0, a repeated root r = 2.
  • aₙ = (A + Bn) 2ⁿ.
  • n = 0: A = 1. n = 1: (1 + B)·2 = 4, so B = 1.
  • Answer: aₙ = (1 + n) 2ⁿ.

Fibonacci closed form

For F(n) = F(n − 1) + F(n − 2): r² − r − 1 = 0 has roots (1 ± √5) / 2. With F(0) = 0 and F(1) = 1 the solution is

F(n) = ( φⁿ − ψⁿ ) / √5, where φ = (1 + √5)/2 and ψ = (1 − √5)/2.

The root φ ≈ 1.618 is the golden ratio, which is why Fibonacci numbers grow about 1.618 times each step.

Tower of Hanoi, solved

T(n) = 2T(n − 1) + 1 is non-homogeneous. Adding 1 to both sides gives T(n) + 1 = 2 (T(n − 1) + 1), so T(n) + 1 doubles each step: T(n) + 1 = 2ⁿ, hence T(n) = 2ⁿ − 1.

Common mistakes

  • Solving the characteristic equation but not using initial conditions.
  • Forgetting the extra factor n when a root repeats.

Practice questions

  1. Solve aₙ = 3aₙ₋₁ − 2aₙ₋₂ with a₀ = 2 and a₁ = 3.
  2. Solve aₙ = 6aₙ₋₁ − 9aₙ₋₂ with a₀ = 1 and a₁ = 6.
  3. Write the characteristic equation of F(n) = F(n − 1) + F(n − 2).
  4. Why does a repeated root need the factor n?
  5. Solve T(n) = 2T(n − 1) + 1, T(0) = 0.

Answers to the practice questions

  1. r² − 3r + 2 = 0 gives r = 1, 2. A + B = 2, A + 2B = 3 so B = 1, A = 1: aₙ = 1 + 2ⁿ.
  2. (r − 3)² = 0. A = 1, (1 + B)·3 = 6 so B = 1: aₙ = (1 + n) 3ⁿ.
  3. r² − r − 1 = 0.
  4. A single term A rⁿ gives only one independent solution; n·rⁿ supplies the second needed to fit two initial conditions.
  5. T(n) = 2ⁿ − 1.

Sources

  • Official BCA syllabus Mathematics Foundations to Computer Science I, course code CC101, Unit II
  • Kolman, Busby and Ross, Discrete Mathematical Structures, 6th edition, Pearson