b2KIT

Recurrence Relation Solver

Solve linear recurrence relations with characteristic equations. Visualize sequences and compare closed-form solutions.

Tested tool guide Tested browser tools Checked August 16, 2026

What Recurrence Relation Solver does, with a checked example

Enter a linear recurrence with constant coefficients - a(n) = 3a(n-1) - 2a(n-2) - along with starting values, and the tool forms the characteristic equation, factors it, and returns a closed-form solution, a term-by-term table, and a graph of the sequence. Two things surprise people. First, the closed form is fitted to the exact initial values you typed: the same recurrence with different starting values produces a different formula. Second, a repeated root changes the shape of the answer, from A*r1^n + B*r2^n to (A + Bn)*r^n; that is the method working as intended, not an error.

Worked example

A concrete input and expected output from the current implementation.

Input

a(n) = 3a(n-1) - 2a(n-2), a(0) = 1, a(1) = 2

Expected output

Characteristic equation: x^2 - 3x + 2 = 0, roots 1 and 2. Closed form: a(n) = 2^n. Sequence: 1, 2, 4, 8, 16, 32, 64, ...

The roots 1 and 2 give the general form A*1^n + B*2^n; the initial values force A = 0 and B = 1, so a(n) = 2^n. Direct iteration agrees: a(2) = 3*2 - 2*1 = 4, matching 2^2.

How the result is produced

1

Characteristic equation

For a(n) = c1*a(n-1) + c2*a(n-2), the tool substitutes the trial solution a(n) = r^n, which turns the relation into the polynomial r^2 - c1*r - c2 = 0. Each root r contributes a candidate r^n; two distinct roots combine as A*r1^n + B*r2^n, while a repeated root replaces the second term with B*n*r^n. The initial values then fix A and B through two linear equations.

2

Verification and display

Before showing results, the tool evaluates the derived formula against the recurrence itself for the first several indices; a mismatch would betray a sign error in the characteristic polynomial. The output then pairs the closed form with a sequence table and a graph, so you can read growth, decay, or alternation directly instead of trusting the algebra sight unseen.

Good uses

  • Check a hand derivation: enter a recurrence you solved on paper and compare the tool's closed form and iterated table with your own answer; any difference points at a sign or initial-value error.
  • Jump ahead in a model sequence - a growth, interest, or amortization relation - to get term 100 or term 1000 without stepping through every term.
  • Explore how the roots shape behavior: edit the coefficients and watch the graph move between exponential growth, decay toward zero, sign alternation, and oscillation.

Limits and checks

  • The characteristic-equation method covers linear recurrences with constant coefficients only. Nonlinear forms such as a(n) = a(n-1)^2, and recurrences whose coefficients depend on n, lie outside it.
  • The closed form belongs to the exact initial values entered. Re-enter the same recurrence with a(1) and a(2) as the starting values and the constants A and B change, even though the recurrence itself is identical.
  • Repeated and complex roots make the output look unusual on purpose: complex roots produce sine-and-cosine forms, and irrational roots such as (1 + sqrt(5))/2 are evaluated numerically, so a residual like 1e-15 where you expect zero is rounding, not a wrong answer.

Common questions

Why does the answer contain an n multiplied by the root when a root repeats?

Two constants A*r^n and B*r^n are the same family when both roots equal r, so they cannot supply the two free constants a second-order recurrence needs. Multiplying one candidate by n produces the missing independent solution, giving (A + Bn)*r^n. For a(n) = 4a(n-1) - 4a(n-2) with a(0) = 1 and a(1) = 4, the result is (1 + n)*2^n, and iterating the recurrence confirms it.

Can it solve a recurrence with a constant term, like a(n) = 2a(n-1) + 3?

The characteristic-equation method as usually described applies to the homogeneous case, with no extra term. A constant added on the right needs a particular solution on top of the homogeneous form, so a(n) = 2a(n-1) + 3 is treated differently from a(n) = 2a(n-1). Whether this tool accepts that input is worth testing directly on the page, since the method alone does not cover it.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools