Newton-Raphson Method

An interactive visualization of Newton’s method for finding roots of equations

The Newton-Raphson method is a technique for approximating the roots (or zeros) of a function. It uses tangent lines to iteratively home in on a solution.

Given a function $f(x)$, the method starts at an initial guess $x_0$, and then refines it using the formula:

$$ x_{n+1} = x_n - \frac{f(x_n)}{f’(x_n)} $$

In this graph, the goal is to find $\sqrt{a}$, which is the inverse of the function $f(x) = x^2$. So we’re solving:

$$ x^2 = a \quad \text{or} \quad f(x) = x^2 - a = 0 $$

Each step draws a tangent line at the current point $x_n$, and uses its intersection with the x-axis to find the next guess $x_{n+1}$.

It’s surprisingly efficient β€” and can take a decent guess to a great guess.


Learn More #

The method in reverse can find the square of a number and is used in squaring tricks:


This algorithm is also part of the Quake III game’s Inverse Square Root function.