How this calculation works
The recurrence determines later terms from the two starting values. Choosing index zero or one returns a supplied starting value.
uₙ = a uₙ₋₁ + b uₙ₋₂A worked example
Starting at 2 and 3 with uₙ = 2uₙ₋₁ − uₙ₋₂ gives u₅ = 7.
Good to know
The first term is indexed by zero.
Reference: OpenStax Algebra and Trigonometry (opens in a new tab) ↗
Carry two earlier values through each update
Start with u₀ = 2 and u₁ = 3, then apply uₙ = 2uₙ₋₁ − uₙ₋₂. The next terms are u₂ = 2 × 3 − 2 = 4 and u₃ = 2 × 4 − 3 = 5. Continuing gives u₄ = 6 and u₅ = 7. The target index five therefore identifies the sixth listed term.
The SVG labels the sequence from index zero and highlights the two inputs used to produce a later term. Updating both stored values together matters because the earlier value must still be available when the next expression is evaluated.
Use characteristic roots to understand the sequence shape
For constant coefficients A and B, substitute a trial solution uₙ = rⁿ into uₙ = Auₙ₋₁ + Buₙ₋₂. The resulting characteristic equation is r² − Ar − B = 0. The default coefficients give (r − 1)² = 0, which permits a linear-in-index solution. The initial values fix it as uₙ = 2 + n.
Different coefficients can produce growth, alternating signs or oscillation. The Quadratic root sum and product calculator helps inspect the characteristic equation, while two starting values determine the specific sequence. Target indices zero and one return the initial values directly. Repeated iteration uses numerical arithmetic, so rounding errors can grow when the recurrence amplifies small changes in its earlier terms.
A few questions, answered
Why are two initial terms required?
Each update depends on two preceding terms. Both starting values are needed to determine all later terms.
Can this represent Fibonacci numbers?
Yes. Use initial values zero and one, with both recurrence coefficients equal to one.