# Newton Raphson Method

Newton Raphson Method is yet another numerical method to approximate the root of a polynomial. Newton Raphson Method is an open method of root finding which means that it needs a single initial guess to reach the solution instead of narrowing down two initial guesses.

Newton Raphson Method uses to the slope of the function at some point to get closer to the root.
Using equation of line **y = mx _{0} + c** we can calculate the point where it meets x axis, in a hope that the original function will meet x-axis somewhere near. We can reach the original root if we repeat the same step for the new value of x.

# Formula

The following formula gives the next value of x (hopefully closer to the root)

$$ x_{n+1}=x_n-\frac{f\left(x_n\right)}{f^\prime\left(x_n\right)} $$

# Steps

- Initial guess
- Using the formula mentioned above calculate the next value of x
- Check if x is the root of the function or is in the range of affoardable error. In other words check if
**f(x)=0**or**|f(x)| < affordable error**. Repeat step 2 if not. 3 (option b) If the formula mentioned above gives the same result, x is the root of the polynomial.

# Example

Let's approximate the root of the following function with Newton Raphson Method

$$ \ f\left(x\right)\ =\ e^{-x}-x $$

### Solution

$$ f\left(x\right)=e^{-x}-x $$

## show hidden steps

$$ \frac{df}{dx}=-e^{-x}-1 $$

$$ x_{n+1}=x_n-\frac{f\left(x_n\right)}{f^\prime\left(x_n\right)}=x_n+\frac{e^{-x_n}-x_n}{e^{-x_n}+1\mathrm{\ } } $$

$$ error < 0.05% $$

$$ x_{n+1}=x_n+\frac{e^{-x_n}-x_n}{e^{-x_n}+1\mathrm{\ } } $$

x_{n} |
x_{n+1} |
error | |
---|---|---|---|

1 | 0 | 0.5 | |

2 | 0.5 | 0.5663 | |

3 | 0.5663 | 0.5671 | 0.0014 |

4 | 0.5671 | 0.5671 | 0.0000 |

The relative error is 0 because we have found the exact root and a function.

Written by Arifullah Jan and last modified on