# Solving equations using the Newton-Raphson method

--

The Newton-Raphson method is a numerical method to solve equations of the form *f(x) = 0*.

This method requires us to also know the first differential of the function. But the Newton-Raphson method has very good convergence, so it can often provide an accurate result very quickly.

# Example — square root of two using Newton-Raphson method

As a simple example, we will solve the equation:

This equation has a solution *x = √2* (and a second solution *x = -√2*). We will only look for the first solution. Although we already know the answer to the problem, it is still useful to work through the numerical solution to see how it works (and to gain an approximate value for the square root of 2).

To use the technique we need to have a rough idea of where the solution is. It is useful to sketch a graph of the function:

The Newton-Raphson method starts with an initial guess at the solution. The guess doesn’t need to be particularly accurate, we can just use the value 2.

The Newton-Raphson method proceeds as follows:

- Start with an initial guess
*x*(2 in this case). - Draw a tangent to the curve at the point
*x*. - Find the value of
*x*where the tangent crosses the x-axis. This will be the next value for*x*. - Repeat from step two with the new value.

Steps 2 to 4 are repeated until a sufficiently accurate result is obtained, as described in the solving equations article. On each pass, the new guess is usually closer to the required result, so the approximation becomes more accurate. When the result is accurate enough, the process ends.

# A graphical explanation of the Newton Raphson method

To gain an intuitive understanding of the process, we will go through a couple of iterations and show the results on a graph. This is for illustration only, you don’t need to draw an accurate graph to use this method. Once…