Recurrence Relations
Defining a sequence by how each term relates to the ones before it, rather than by a direct formula — the natural language for compounding, backtesting loops, and any process where today depends on yesterday.
Prerequisites: Sequences and Series Convergence
A portfolio's value at the end of each month depends only on its value at the end of last month, plus that month's return. There's no need to re-derive the value from scratch each time using the entire history — you just need last month's number and this month's rule. That's the essence of a recurrence relation: a sequence defined not by a direct formula for the -th term, but by a rule connecting each term to the ones just before it, plus a starting point. Recurrences are how compounding, backtests, and recursive algorithms are naturally described, and often the real work is converting a recurrence into a closed-form formula you can evaluate directly without looping through every prior step.
An analogy: a chain of dominoes
A recurrence relation is like a row of dominoes: knocking down domino depends entirely on domino having just fallen (and maybe , if they're close enough to double-trigger). You don't need to know anything about domino 1 to predict domino 50's fate directly — you just need to know the rule connecting consecutive dominoes, plus where the row started. Compounding interest is the same: this month's balance is last month's balance times , and that one local rule, applied repeatedly, determines the whole sequence.
The math, one piece at a time
A recurrence relation defines a sequence using earlier terms of the same sequence. The simplest useful kind quants meet is linear with constant coefficients, such as:
where is the term you're solving for, are fixed numbers, are the previous terms the new term depends on, and is an optional external "forcing" term that doesn't come from the sequence itself (like a fixed monthly deposit). In words: each new term is a weighted blend of a fixed number of the terms right before it, plus possibly some outside input. To actually compute values you also need initial conditions — enough starting terms (, or and , etc.) to seed the recursion; without them the relation alone has infinitely many possible sequences satisfying it.
Solving a recurrence means finding a closed form — a direct formula for in terms of alone, no recursion needed. For the simplest first-order case with given, the closed form is : each step multiplies by again, so after steps you've multiplied by a total of times.
Worked example 1: compounding by hand, recurrence vs. closed form
A $10,000 account earns 5% per year, recurrence: , . Stepping through by hand: , , . The closed form gives the same directly: — matching, but computed in one step instead of three, which matters enormously when is 30 years, not 3.
Worked example 2: the Fibonacci-style deposit sequence
Suppose a fund's monthly inflow follows (this month tracks the sum of the last two, a crude momentum rule), starting from and (units: $thousands). By hand: , , , . This is the Fibonacci recurrence with different starting values — it grows geometrically, at a rate approaching the golden ratio per step, even though the rule only references the two immediately preceding terms.
What this means in practice
Recurrences are the natural way to describe anything that updates step by step: compounding returns, moving-average and EWMA filters (each new value blends the previous estimate with a new observation), backtest loops that carry state (inventory, cash, drawdown) forward one bar at a time, and dynamic-programming solutions to optimal-execution or option-pricing lattices. Recognizing a problem as a recurrence — "this value depends on the last one or two values plus a rule" — is often the first step to either writing a clean loop or, better, solving for a closed form that skips the loop entirely.
A recurrence relation defines each term of a sequence using a fixed rule applied to the terms just before it, plus initial conditions to seed it — solving a recurrence means finding a closed-form formula for the -th term that doesn't require stepping through every prior term.
The classic mistake is treating a recurrence as if it were already a closed form — assuming can be read off directly instead of realizing it requires computing (or deriving a formula for) every term up to . This matters practically: a loop implementing naively takes steps (or worse, if written as naive recursion without memoization), while the closed form evaluates in . Confusing "I have a rule connecting the terms" with "I have a formula for the term" leads to needlessly slow code and, in interviews, to missing the intended closed-form answer.
Related concepts
Practice in interviews
Further reading
- Graham, Knuth & Patashnik, Concrete Mathematics, ch. 1-2
- Cormen et al., Introduction to Algorithms, ch. 4