21. Differential Equations in Finance#

An ordinary differential equation (ODE) relates a function \(y = f(x)\) to its derivatives with respect to \(x\). An ODE of order \(n\) is an equation of the form:

\[\begin{align*} F(x, y, y', y'', \ldots, y^{(n)}) = 0 \end{align*}\]

Solving differential equations is a vast and important topic in mathematics. In this chapter I will focus on some specific applications that appear in financial problems.

21.1. Continuous Compounding#

We start by deriving the expression for continuous compounding by solving an ODE. Consider an account that starts with an initial balance of \(V_{0}\) and denote by \(V_{t}\) the balance of the account at time \(t.\) The account earns an interest rate \(r\) per unit of time over a time interval \(\Delta t,\) which implies that the balance at time \(t + \Delta t\) is

\[\begin{align*} V_{t + \Delta t} = V_{t} + r V_{t} \Delta t, \end{align*}\]

or

\[\begin{align*} \Delta V_{t} = r V_{t} \Delta t. \end{align*}\]

As \(\Delta \rightarrow 0,\) the previous equation becomes:

(21.1)#\[\begin{align} dV = r V \, dt. \label{ode_bank_account} \end{align}\]

Equation \(\eqref{ode_bank_account}\) is a linear ODE of first-order and is usually written as

\[\begin{align*} \frac{dV}{dt} = r V. \end{align*}\]

In order to solve it, we need to impose a boundary condition, which in this case is the initial balance of the account at time 0. Define \(X = \ln(V),\) so that \(V = e^{X}\) and \(dV = e^{X} dX.\) Using these results we can re-write \(\eqref{ode_bank_account}\) as:

(21.2)#\[\begin{align} dX = r \, dt. \label{log_ode_bank_account} \end{align}\]

Integrating \(\eqref{log_ode_bank_account}\) from 0 to \(t\) we obtain:

\[\begin{align*} X_{t} - X_{0} = \int_{0}^{t} dX = \int_{0}^{t} r \, dt = r t, \end{align*}\]

which can be re-written as:

(21.3)#\[\begin{align} V_{t} = e^{X_{0} + r t} = V_{0} e^{r t}. \label{ode_bank_account_sol} \end{align}\]

We already derived equation \(\eqref{ode_bank_account_sol}\) in chapter Interest Rates by different means, but it is nevertheless informative interesting to understand the derivation that we just did. It basically shows that in continuous-time the instantaneous rate of return of a risk-free investment is given by

\[\begin{align*} \frac{dV}{V} = r \, dt. \end{align*}\]

Also, it is interesting to note that we solved the ODE by defining a new variable \(X = \ln(V).\) This is the so-called change of variable technique that we will use repeatedly to solve other differential equations.

21.2. Valuing an Annuity Paying Continuous Cash Flows#

We will now revisit the valuation of an annuity that pays a continuous flow of cash flows introduced in Example 20.13. Deriving the ODE of the annuity involves again analyzing what happens over a small time interval \(\Delta t.\)

Let us consider an annuity paying coupons \(c \, dt\) at each time \(t \in [0, T].\) Say you do not buy the annuity at time \(t = 0,\) but wait until a later time \(t < T\) to purchase it for \(V_{t}.\) If you hold your investment for a time interval \(\Delta t,\) you can resell it at that point for \(V_{t + \Delta t}.\) In the meantime, you will also receive \(c \Delta t\) since you bought the annuity at time \(t.\) In all these problems we always assume that you buy the security before it goes ex-dividend. The figure below represents the cash flows of this transaction.

Figure made with TikZ

Now, as always in finance, we will compare these cash flows with a reference security. Since our annuity is certain, we will use a risk-free investment as our benchmark. Specifically, in this case we will assume that we can use our annuity purchased at time \(t\) and pledge it as collateral. That allow us to borrow money at the risk-free rate of interest. Borrowing \(V_{t}\) at time \(t\) requires then to repay the amount borrowed plus interest, that is \(V_{t} + r V_{t} \Delta t,\) at time \(t + \Delta t.\)

Figure made with TikZ

The table below shows the combined cash flows of these transactions.

Time

\(t\)

\(t + \Delta t\)

Buy Annuity

\(- V_{t}\)

\(V_{t + \Delta t} + c \Delta t\)

Borrow

\(V_{t}\)

\(-(V_{t} + r V_{t} \Delta t)\)

Total

0

\(\Delta V_{t} + c \Delta t - r V_{t} \Delta t\)

The final strategy requires no investment at time \(t\) but generates a cash flow \(C_{t + \Delta t} = \Delta V_{t} + c \Delta t - r V_{t} \Delta t\) at time \(t + \Delta t.\)

If \(C_{t + \Delta t} > 0,\) we could amplify this transaction by buying as many annuities as possible and borrowing accordingly. That would generate an arbitrary profit at time \(t + \Delta t\) with no investment. If on the other hand \(C_{t + \Delta t} < 0,\) we just need to reverse the transaction, that is, sell as many annuities as possible and invest the proceedings at the risk-free rate.

Either way we could make an arbitrary positive profit with no investment! This is what in finance we call an arbitrage opportunity. Simple intuition tells us that these type opportunities should not last long. Therefore, in the absence of arbitrage opportunities, it must be the case that:

\[\begin{align*} \Delta V_{t} + c \Delta t - r V_{t} \Delta t = 0, \end{align*}\]

As \(\Delta \rightarrow 0,\) the previous equation becomes:

(21.4)#\[\begin{align} dV + c \, dt - r V \, dt = 0. \label{ode_1} \end{align}\]

Define \(X = V e^{-r t}\) so that \(V = X e^{r t}\) and \(dV = (dX) e^{r t} + X \left( r e^{-r t} \, dt \right).\) Using these results we can re-write \(\eqref{ode_1}\) as:

\[\begin{align*} (dX) e^{r t} + X \left( r e^{-r t} \, dt \right) + c \, dt - r X e^{r t} \, dt = 0, \end{align*}\]

or

(21.5)#\[\begin{align} dX = -c e^{-r t} \, dt. \label{ode_2} \end{align}\]

We can now integrate \(\eqref{ode_2}\) from \(t\) to \(T\) to get:

(21.6)#\[\begin{align} X_{T} - X_{t} = \int_{t}^{T} dX = \int_{t}^{T} -c e^{-r t} \, dt = \frac{c}{r} \left( e^{-r T} - e^{-r t} \right). \label{sol_ode} \end{align}\]

We are now in position to solve the problem by applying a boundary condition. Specifically, at time \(T\) the annuity has no more cash flows left top pay, and hence its value must be zero, that is \(V_{T} = 0,\) which also implies that \(X_{T} = 0.\) Plugging \(X_{t} = V_{t} e^{-r t}\) back into \(\eqref{ode_2}\) allows us to find:

(21.7)#\[\begin{align} V_{t} = \frac{c}{r} \left( 1 - e^{-r (T - t)} \right). \label{continuous_annuity} \end{align}\]

21.3. Valuing a Bond Paying Continuous Coupons#

It turns out that the previous analysis applies without modifications to price a bond expiring at time \(T\), with face value \(F\) and paying coupons continuously. What changes is the boundary condition since the bond at time \(T\) pays its face value. So we have that

\[\begin{align*} X_{T} - X_{t} = \frac{c}{r} \left( e^{-r T} - e^{-r t} \right), \end{align*}\]

where \(X(T) = F e^{-r T}.\) Therefore,

(21.8)#\[\begin{align} V_{t} = \frac{c}{r} \left( 1 - e^{-r (T - t)} \right) + F e^{-r (T - t)}. \label{continuous_coupon_bond} \end{align}\]