Newton-Raphson Method (a.k.a Newton Method) is a method that can be used to find the root of a equation. In other words, the Newton Method helps us find the the input to a function at which the value of the function will be 0, e.g. if we have a function , we want to find a value of where or .
The general formula for the newton method is:
Therefore, we can find the value of with one iteration by:
The way the Newton Method works is that we start with an initial input value for , this value can be any number but we want to come up with a good starting value so that we get to the root in less number of iterations. After picking an initial value for , and inserting it into the Newton formula we get a value which is supposed to be closer to the root of the equation (NOTE: there are some weaknesses to this method, please see the section "Weakness of the method").
After doing one iteration of the newton formula, the value might not be very close to the root of the equation. Therefore, we would want to repeat the newton formula with the value of . This will get us a new value . We keep on repeating this until we get a result that satisfies our precision condition. The precision is in the number of decimal positions we want to remain unchanged after repeating the iterations. In other words, when we repeat the iterations we see that the new value of changes only after a few number of decimal position. Say we want to have precision till 4 places of decimal, this means that we will stop iterating as soon as we see that the value of does not change till 4 places of decimal.
Let's work on an example to see how the method works. Let's find the root of the following equation with a precision of 9 decimal places.
The first step is to find the first derivative of equation . This results in:
Now that we have and all have to do is plug in the values in the formula: and iterate. As a starting point I am choosing the value of . Following is a table of the iterations that were done using excel.
Please see Appendix A to download the excel file with the example
Notice that we stop at iteration 11, that is because our condition of having the decimal precision of 9 places is satisfied (see x' values for 10 and 11 don't change with 9 decimal places precision).
So, what was the benefit of doing all this? Notice how the value of has gone very close to on the 11th iteration and the value of for which is the root (or solution) of the equation. Ofcourse 5.68434E-14 is not equal to 0 but its very close to 0 and is acceptable given the conditions of the example.
Weakness of the method
Although the Newton Method gets us the root of the equation it has its weakness. The function will fail if the tangent (or first derivative or the slope of the function at point ) is parallel to the x-axis. In this case the slope will be and diving the function by will give infinity. Hence the method will fail.