The Newton Raphson Method
What is the Newton Raphson Method and how do you use it?
Newton Raphson Method: Finding Roots with Calculus
The Newton Raphson Method is one of the most powerful and widely used numerical techniques for finding the roots of equations.
A root (or zero) of a function is a value of such that:
When equations become too difficult to solve algebraically, the Newton-Raphson method provides a fast and elegant way to approximate the solution using calculus.
What Is the Newton Raphson Method?
The Newton-Raphson method starts with an initial guess and repeatedly improves that guess by using the tangent line to the function.
This creates a sequence of increasingly accurate approximations:
Under the right conditions, the method converges extremely quickly to the true root.
The Newton Raphson Formula
Where:
- is the current approximation.
- is the next approximation.
- is the value of the function at .
- is the derivative, or the slope of the tangent line.
Why This Formula Works
At the current estimate , we draw the tangent line to the graph of the function.
The tangent line equation is:
To estimate the root, we find where this tangent line crosses the x-axis by setting :
Solving for gives:
This becomes the update formula used in the Newton-Raphson method.
Step by Step Algorithm
- Define the function .
- Compute its derivative .
- Choose an initial guess .
- Calculate the next approximation using the Newton-Raphson formula.
- Repeat until the estimates stop changing significantly.
A common stopping condition is:
Example: Finding
To compute , we solve:
Step 1: Define the Function
Step 2: Compute the Derivative
Step 3: Substitute into the Formula
Step 4: Choose an Initial Guess
Let:
Iteration 1
Iteration 2
Iteration 3
Final Answer
The actual value is:
After only three iterations, the approximation is accurate to many decimal places.
Iteration Table
| Iteration | Approximation |
|---|---|
| 1.5000000000 | |
| 1.4166666667 | |
| 1.4142156863 | |
| 1.4142135624 |
Advantages of the Newton-Raphson Method
- Extremely fast convergence near the root.
- Simple formula to implement.
- Widely used in mathematics, engineering, and computer science.
- Forms the basis of many scientific computing algorithms.
Limitations
The method can fail if:
- The derivative is zero or very close to zero.
- The initial guess is too far from the root.
- The function is not smooth.
- The iterations diverge instead of converging.
Because of this, choosing a reasonable starting point is important.
Python Implementation
def newton_raphson(f, df, x0, tol=1e-6, max_iter=100):
x = x0
for i in range(max_iter):
x_new = x - f(x) / df(x)
if abs(x_new - x) < tol:
return x_new
x = x_new
return x
# Example: sqrt(2)
f = lambda x: x**2 - 2
df = lambda x: 2 * x
root = newton_raphson(f, df, 1.5)
print(root) # 1.4142135623730951