- I. Introduction
- II. Preliminaries
- III. Numerical Solution to ODE
- IV. Numerical Solution to Black-Scholes Equation
- V. Conclusion
- VI. References
Numerical methods are widely used in quantitative finance. For example, the Monte Carlo method is used for option pricing and net present value (NPV) analysis; numerical optimization techniques can be deployed into portfolio management. Another significant result in quantitative finance regarding European option pricing is the Black-Scholes model, which depicts the fair price of an option. In this article, I will introduce some basic numerical methodologies for solving differential equations and analyze the numerical solutions of the Black-Scholes Equation.
The general ODE formulation is as follows: We want to find the function
For example, one can check that the solution to the logistic equation
is of the following form:
The derivation is from separation of variables: One can divide both sides by the right-hand side and get
and integration on both sides, with the given initial condition, can achieve the final solution. However, there is not always an analytic solution to an ODE: either because there is no closed form (e.g., the solution includes an integral sign) or because the ODE is too complex to be separable or solved using known tricks. Hence numerical algorithms play a role in deriving numerical solution that is enough for specific purposes. There are two main classifications: explicit and implicit methods, which I will discuss in the following sections.
To estimate the derivative, the finite difference method is often used. For the first order derivative, there are three common types (with error estimate):
-
Forward Difference:
$f'(x) = \frac{f(x+h) - f(x)}{h} + \mathcal{O}(h)$ -
Backward Difference:
$f'(x) = \frac{f(x) - f(x-h)}{h} + \mathcal{O}(h)$ -
Central Difference:
$f'(x) = \frac{f(x+h) - f(x-h)}{2h} + \mathcal{O}(h^2)$
The error estimates are derived from Taylor expansion. I will derive formula for central difference and the other two are obvious from the expansion expression:
Hence the approximation is
as desired (given enough smoothness of
For second order derivative, one can derive
which can also be derived from Taylor expansion of
The simplest algorithm is called Euler’s method, which is the following:
$x_0 = a, h = \frac{t}{k}$ - for
$i = 1, 2, \dots, k$ $x_i = x_{i-1} + f(t_{i-1}, x_{i-1})h$
This algorithm computes the value of the solution from
8One can estimate the error that in each step by Taylor expansion, we have
The error in each step is
Here is a simulation of Euler’s method for different step size for logistic equation:
We can see that as the step size
However, not all solutions are well-behaved in this way, there is a special type of problem, called stiff problem, which results in numerical instability. For example, the ODE
has explicit solution
However, for a huge negative
We can see that with
Instead of using current value as approximation for the slope in explicit method, implicit method uses “future value” to solve for itself. The following algorithm are called implicit Euler’s method, which in each iteration differs from the explicit one:
Note that
so
Here is the simulated result:
Also note that if the function
An intuitive explanation for stability is that it can get more “feedback” from unknown regions, see [2]. Also, note that numerical stability does not imply accuracy, i.e., there are cases where explicit methods are more accurate for the same step size
Now after enough preparation, we can start our main journey and compute the numerical solution to this partial differential equation. Given appropriate assumptions about the financial market, the formula depicts the pricing of European options. The PDE is
where
$V(t, S_{\min}) = 0$ $V(t, S_{\max}) = S_{\max} - Ke^{-r(T - t)}$ $V(T, S) = \max{S - K, 0}$
To solve the PDE, we must discretize the space, similar to how we partition the domain in 1-dimensional case. With two variables, we should partition the input space into small 2D grids, as the following figure shows:
Note that the red line represents boundary conditions.
Since we know values on the rightmost bound, we can infer the present value from future values. This is similar to the idea in explicit method, where we calculate the “next” step explicitly by known information, but now going backward.
Assume we partition time
Let
$\frac{\partial V}{\partial t} = \frac{V_{i, j} - V_{i-1, j}}{\Delta t}$ $\frac{\partial^2 V}{\partial S^2} = \frac{V_{i, j+1} - 2V_{i, j} + V_{i, j-1}}{\Delta S^2}$ $\frac{\partial V}{\partial S} = \frac{V_{i, j+1} - V_{i, j-1}}{2\Delta S}$
The reason why we use central difference in 3) is because to approximate
Therefore, we establish a linear relationship between the four variables
Since we compute values backward, as the right three values are known, we have a direct formula to calculate
Note that when I am trying to discretize the space, the upper limit for
This means there is still gaps between the true solution and the approximation, especially when the time is farther from the exercise time. Hence, we can develop the implicit method for this PDE to achieve more stability.
We can move the terms for the PDE and get
If we take
and the derivative with respect to
The Black Scholes equation thus is transformed to an inhomogeneous linear system
by substituting the above two approximations into the PDE, where
with
where
For the same partition grid as the upper limit for explicit method, we get the following error estimate:
Note that this is better than the explicit method, where the max error is smaller. In addition, the benefits of implicit method is its stability. If we partition the
The max error is smaller than the the previous discretization. This shows that the cancelation error and rounding error involved in dividing by a small number introduced though finer grid is less than the discretization error (truncation error) when estimating the derivatives.
I have tried taking
In this article, I introduce the foundations of numerical methods in differential equations and comprehensively analyze the explicit and implicit methods to solve for Black-Scholes Equation. Note that in the explicit method, I do not collect terms or complete cancellations in the division for code's readability; one can avoid such flaws in real situations and derive a more stable and accurate approximation. Also note in implicit method where
[1] Dahlquist, G., and Björck Åke. (2003). Numerical methods. Dover, New Jersey, pp. 261–346.
[2] Lehmann, L. (2022). Why do implicit numeric methods have superior stability properties than explicit ones? Mathematics Stack Exchange. https://math.stackexchange.com/questions/4400581/why-do-implicit-numeric-methods-have-superior-stability-properties-than-explicit
[3] Wikimedia Foundation. (2023). Black–Scholes equation. Wikipedia. https://en.wikipedia.org/wiki/Black%E2%80%93Scholes_equation
[4] Stehlíková, B. (2014). Black-Scholes model: Derivation and solution. Financial derivatives, winter term 2014/2015. http://www.iam.fmph.uniba.sk/institute/stehlikova/fd14en/lectures/05_black_scholes_1.pdf
[5] Gilli, M., Maringer, D., and Schumann, E. (2019). Numerical methods and optimization in Finance. Academic Press, New York, pp. 65–71.