Notes Math Recursion
Notes Math Recursion
The concept of recursion runs throughout modern mathematics and computer science. The
same is true of economics and finance. There’s a reason the leading PhD textbook in macroe-
conomics is called Recursive Macroeconomic Theory. Such work in economics reflects, in
large part, the adoption by economists of methods developed elsewhere.
What follows is a short informal introduction to the idea and a start on the kinds of
applications you’ll find in economics and finance.
Warning: This contains a little linear algebra. Skip it if that’s not part of your skill set.
1 Examples of recursion
If we have a starting point, say x0 , the rule tells us how to compute as many succeeding
items as we wish. We would say that the set {xn } is generated recursively and refer to (1)
as the defining recurrence relation. A “solution” to (1) is a formula that expresses xn as a
function of n.
Examples:
This has the solution xn = an x0 . It converges to zero if |a| < 1, but it’s the solution
either way.
xn+1 = axn (1 − xn )
with 0 < a ≤ 4. If you try some experiments, you’ll see that it generates wildly
different behavior depending on the value of a. You might set x0 = 0.3 and a =
(0.98, 1.5, 2.5, 3.25, 3.5), generate (say) 20 terms, and graph the output. See Wikipedia.
The point, which we won’t develop further, is that even quite simple nonlinear recur-
rences can generate complex behavior.
3. Fibonacci numbers. The Fibonacci numbers are generated by the second order system
fn+1 = fn + fn−1
starting with f0 = 0 and f1 = 1. In matrix terms, we can write this as xn+1 = Axn with
fn 1 1
xn = , A = .
fn−1 1 0
This is similar to (2), but here xn is a vector. The matrix A has eigenvalues (λ1 , λ2 )
satisfying λ2 − λ − 1 = 0. The “solution” has the form fn = c1 λn1 + c2 λn2 for constants
(c1 , c2 ) that satisfy the initial conditions.
This is a common example in computer science courses. A recursive version of a Matlab
program to compute Fibonacci numbers is
Note that the function f refers to itself — it’s recursive in the sense the word is used
in computer science. In Matlab, we would save this as a file called f.m, then call it by
typing (say) f(8) in the command line or as a line in another program. (If you enter a
fraction, it blows up, so a better function would check and generate an error message, or
perhaps convert n to an integer.)
4. Mean and variance. John Cook describes the Welford method of computing the mean and
variance recursively. Consider a sequence of observations: x1 , x2 , . . .. We can compute
rolling estimates of the mean and variance from
5. Natural numbers. The natural numbers are the set N = {0, 1, 2, . . .}. We can define them
recursively with the rules: (i) 0 is in N and (ii) if n is in N then so is n + 1.
Which reminds me of an old George Gamov story. In the story, the Hilbert Hotel has an
infinite number of rooms numbered 1, 2, 3, . . .. By law, it must save one for the King, but
the innkeeper fills them all anyway. When asked, he says: “No problem, I can always get
2
an open room by asking everyone to move over one.” And if we move the person in room
j to room 2j, we open up an infinite (countable) number of rooms, all the odd-numbered
ones.
6. Combinatorics. Computer scientist Herbert Wilf notes that many combinatoric identities
satisfy recurrences. For example, the binomial coefficients,
n n!
f (n, k) = = ,
k k!(n − k)!
are the solution to
f (n, k) = f (n − 1, k) + f (n − 1, k − 1)
starting with f (n, 0) = 1.
7. Functions. In economics and finance we often run across recursion with functions. Sup-
pose we have a sequence of functions fn (x) over some domain x that satisfy the recurrence
fn+1 (x) = g[fn (x)]
for some g. Even better, suppose the recurrence has a fixed point:
f (x) = g[f (x)].
Here we have an equation in which the unknown is another function f rather than a
number x. It’s similar to (1), but we’re dealing with a more complex object.
Similar methods show up throughout economics and finance. The idea is to string together
a series of one-period steps — recurrences — similar to those we used earlier in the course.
That allows us to approach the price of (say) an n-period bond with the same methods we
used to price a one-period bond.
We’ll do all this in Markov settings, which require some notation. You’ll recall that modern
asset pricing is based on the no-arbitrage theorem: there exists a positive pricing kernel m
that satisfies E(mr) = 1 for returns r on all assets. In a Markov environment, we need
to keep track of the current state zt and the possible future states zt+1 . The ingredients
include:
3
Examples:
with {wt } a sequence of independent standard normal random variables and 0 < ϕ < 1.
Then bond prices are loglinear functions of the state:
log q n+1 (zt ) = log Et {exp [log m(zt , zt+1 ) + log q n (zt+1 )]} .
We get the left side from (5). The right side takes some work. The inside of the square
brackets on the right can be expressed
log Et m(zt , zt+1 )q n+1 (zt+1 ) = log Et exp log m(zt , zt+1 ) + log q n+1 (zt+1 )
= δ + An + a + (b + Bn )ϕ zt + (b + Bn )2 σ 2 /2.
4
[If this isn’t clear, go through it again, it’s important.] By assumption, this equals
An+1 + Bn+1 zt for all values of zt , so we must have
An+1 = δ + An + (b + Bn )2 σ 2 /2
Bn+1 = a + (b + Bn )ϕ.
Evidently we’ve converted the recursion in q n (zt ), equation (4), into recursions in the
coefficients (An , Bn ). They’re not pretty, but we can easily compute them. The initial
conditions A0 = B0 = 0 correspond to log q 0 (zt ) = log(1) = 0.
2. Equity pricing. A dividend paying stock is a more complicated object. In the same
environment as before, let the dividend in state zt be d(zt ). The ex-dividend value of a
share might be expressed recursively as
v(zt ) = Et m(zt , zt+1 )[d(zt+1 ) + v(zt+1 )] . (6)
In words: equity today is a claim to two things tomorrow, a dividend and the same share
of equity.
Note that the unknown in this equation is the function v. It’s also recursive: you need
to know v on the right to compute v on the left. You’re now as ready as you’ll ever be
for the recursion joke: “To understand recursion, you need to understand recursion.” Or
Google “recursion.” You get back: “Did you mean: recursion?”
One way to think about this is as the limit of a finite horizon. Suppose we value next
period’s dividend by
v 1 (zt ) = Et m(zt , zt+1 )d(zt+1 ) .
The superscript 1 here means we’re valuing one period of dividends. We can value two
periods of dividends recursively with
v 2 (zt ) = Et m(zt , zt+1 )[d(zt+1 ) + v 1 (zt+1 )] .
starting with v 0 (zt ) = 0 (the value of zero dividends is zero). As we increase n, we have
more and more dividends. We might imagine, if all goes well, that as n gets larger and
larger, we approach (6).
3. Perpetual American options. Consider the option to buy one share of stock next period
for strike price k. The value today in state zt is
q(zt ) = Et m(zt , zt+1 )[v(zt+1 ) − k]+ ,
where x+ = max{0, x}. Evidently we exercise in states where v(zt+1 ) − k is positive and
not in other states.
A perpetual option allows us to wait. If we don’t exercise now, we can hold the option
for another period. Valuation has a recursive form:
q(zt ) = max v(zt ) − k, Et m(zt , zt+1 )q(zt+1 ) .
That is: we either exercise now and get v(zt )−k (the first branch of the max) or continue
to hold the option and get the current value of the option next period (the second branch).
5
3 Bottom line
Recursive methods are at the heart of modern macroeconomics and finance. We’ll use them
extensively to value bonds.
Practice problems
1. Discounted cash flows. Our goal here is to simplify the pricing relation (6) and de-
rive a more conventional valuation of equity as the expected discounted value of future
dividends.
(a) Simplify (6) using m(zt , zt+1 ) = δ and replacing dependence on the state zt with a
subscript t — that is, by replacing v(zt ) with vt .
(b) Use this simplification to express equity’s value as
n
X
vt = δ j Et (dt+j ) + δ n Et (vt+n ).
j=1
(c) What happens as n gets large? What happens to the second term on the right
above?
(d) What does this example leave out that’s present in (6)?
Answer.
(a) Equation (6) becomes
(b) This follows from repeated substitution and the law of iterated expectations.
(c) We hope that the second term goes to zero. That leaves us with the infinite sum
∞
X
vt = δ j Et (dt+j ).
j=1
(d) If m(zt , zt+1 ) = δ there are no risk premiums. The price of equity depends only on
expected future dividends.
2. Consols. A consol pays a constant coupon c every period — forever. They have been
used by the British as a government financing tool since the 1700s. How would you adapt
equation (6) to value such an instrument?
Answer. We set d(zt ) = c, giving us
v(zt ) = Et m(zt , zt+1 )[c + v(zt+1 )] .
The variation in price here comes from m, which translates roughly as variation in interest
rates.