In this post, we'll explore a technique to find the zeroes of a function: the Newton-Raphson Method (or simply Newton's Method).
Deriving the Formula
Let's say we are to find the zero of a function \(f\) using this method:
- Assume any value \(x_1\). It doesn't matter how big or small it is.
- Consider the point on the function corresponding to \(x_1\) and draw a tangent line. Formulate its linear equation using the point-slope form: \(m=\frac{y-y_1}{x-x_1}\)
- Let \(m\) be the function's first derivative, \(f\) and \(y_2\) be the value of \(f(x_1)\): \(f^{\prime}(x)=\frac{y-f(x_1)}{x-x_1}\)
- Rearrange the equation so that we isolate \(x\). In addition, we let \(y=0\). Our goal is to compute the value of \(x\). We want to find the value of \(x\) when the tangent line crosses the x-axis: \(x=x_1-\frac{f\left(x_1\right)}{f^{\prime}\left(x_1\right)}\)
- The computed \(x\) is our first estimate of the zero of the function. Let's call this \(x_2\).
- Improve the estimate by repeating steps 2 to 5 as often as required. Returning to step 2, consider the point on the graph with \(x_2\).
If you continue to repeat this process \((x_3, x_4, x_5, x_6, …, x_n)\), you'll notice that the computed \(x\) values get closer and closer to the zero of the function.
We can summarise this method with the general formula:
\(x_{n+1}=x_n-\frac{f\left(x_n\right)}{f^{\prime}\left(x_n\right)}\)
- \(x_{n+1}\) is the x-value of the next coordinate
- \(x_n\) is the x-value of the original coordinate
- \(f\left(x_n\right)\) is the evaluated function with \(x_n\)
- \(f^{\prime}\left(x_n\right)\) is the evaluated first derivative of the function with \(x_n\)
The more repetitions we make with the formula, the more accurate the result is. It will eventually converge to a singular x-point, the function's zero.