Newton-Raphson's method
In this post, we will give you overview of Newton-Raphson’s algorithm which is used massively in Option Pricing.
1. BASICS OF NEWTON-RAPHSON’S METHOD
Let start with Taylor’s theorem:
\[f(x) = f(a) + f'(a)(x-a) + \displaystyle\frac{f''(a)}{2!}(x-a)^2 + \dots + \displaystyle\frac{f^{(k)}}{k!}(x-a)^k + h_k(x)(x-a)^k\]The main idea of the Newton-Raphson’s method or Newton’s method is to approximate the function \(f(x)\) by using the straight line or linear function. Newton’s method applies the tangent of \(f(x)\) at the intial point \(x_0\), find the cross of the tangent line at x-axis at \(x_1\). Perform recurring process until the solution of \(f(x)\) is found.
From Taylor’s theorem, assume that \(f(x)=0\), replace \(a=x_0\) and the series is only dependent on the first-order derivatives, then we have:
\[f(x) - f(x_0) = 0 - f(x_0) = f'(x_0)(x-x_0)\]Re-arrange the equation, we have:
\[x = x_0 - \frac{f(x_0)}{f'(x_0)}\]We start with initial guess \(x_0\), then the algorithm will repeat and find the solution based on that.
Example 1: Finding the root of the function
\[f(x) = x^2 - 4\]We implement it in Python as below:
2. ISSUES WITH NEWTON-RAPHSON’S METHOD
Example 1:
Let start with the function
\[f(x) = tan(x)\]we have
\[f'(x) = tan'(x) = \frac{1}{cos^2(x)}\]Let try with initial guess \(x0 = pi/2\)
The function will run forever as the initial guess is bad and \(f(x)/f'(x)\) is kept constant in python with \(f(x) = 1.633123935319537e+16\) and \(f'(x) = 3.749399456654644e-33\).
Example 2:
Let try function below:
\[f(x) = x^3 - 2x + 2\]with derivatives
\[f'(x) = 3x^2 - 2\]If we take the initial guess \(x_0 = 0\) then the loop will enter the 0-1 cycle without converging to a true root as below code:
So with Newton’s method, we might be able to get to solution to due problems with derivatives of the function or divergence. Make sure to include the exception handling when coding.
3. Black-Scholes Implied Volatility using Newton-Raphson method:
Remember that we have the following Black-Scholes formula for call option (no dividend):
\[C = SN(d_1) - K e^{-rT}N(d_2)\]where
\[d_1 = \frac{ln(S/K) + (r+\sigma^2/2)T}{\sigma \sqrt{T}}\]and
\[d_2 = d_1 - \sigma\sqrt{T}\]Assuming that \(C,P,S,K,T\) are known in formula above. What we want to find is \(sigma\) which is implied volatility.
Set for the call option
\[f(x) = SN(d_1(x)) - K e^{-rT}N(d_2(x)) - C\]where
\[d_1 = \frac{ln(S/K) + (r+x^2/2)T}{x \sqrt{T}}\]We know that the first-order derivatives of \(f(x)\) will be the vega of the call option as below:
\[f'(x) = S\sqrt{T}\phi(d_1) = S \sqrt{T} \frac{1}{\sqrt{2\pi}} \exp\bigg(-\frac{d_1(x)^2}{2}\bigg)\]Then we can apply the Newton-Raphson to find the root which is implied volatility. We can implement it in Python as function below:
We use the example of Professor Dan Stefanica with: \(C=7, \hspace{0.5cm} S = 25, \hspace{0.5cm}T = 1, \hspace{0.5cm} K = 20, \hspace{0.5cm}T = 1, \hspace{0.5cm}r = 0.05\)
The result will be: