Title: Default for 12.3 The Newton-Raphson Method
Course: HELM Workbooks 2023-2024

The Newton–Raphson Method

We first remind the reader of some basic notation: If \(f(x)\) is a given function the value of \(x\) for which \(f(x)=0\) is called a root of the equation or zero of the function. We also distinguish between various types of roots: simple roots and multiple roots. The following figures illustrate some common examples.

[Image: Three plots showing a simple root, a double root and a triple root.]

More precisely; a root \(x_0\) is said to be:

- a simple root if
\[f(x_0) = 0 \quad \text{and} \quad \left.\frac{\mathrm{d}f}{\mathrm{d}x}\right\rvert_{x_0} \neq 0.\]
- a double root if
\[f(x_0) = 0, \quad \left.\frac{\mathrm{d}f}{\mathrm{d}x}\right\rvert_{x_0} = 0 \quad \text{and} \quad \left.\frac{\mathrm{d}^2f}{\mathrm{d}x^2}\right\rvert_{x_0} = 0,\]
and so on.

In this Section we shall concentrate on the location of simple roots of a given function \(f(x)\).

Exercise

Given the graphs of the following functions, classify the roots into simple or double.

1. \(f(x) = [value]\).
The negative root is a root.
The positive root is a root.
2. \(g(x) = [value]\).
Each root is a root.
Feedback: 1. \(f(x) = [value]\). Note that if a root is a local maximum or minimum or an inflection point then the derivative of the function must also be zero there. Hence, we can conclude that if a root is a local maximum or minimum or an inflection point then it cannot be simple. With this in mind, we can see from the graph that the negative root is a [value] root, while the positive root is a [value] root. 2. \(g(x) = [value]\). In this case, every root is also a local minimum. Therefore, every root is a double root.

Finding the roots of the equation \(f(x) = 0\)

A first investigation into the roots of \(f(x)\) might be graphical. Such an analysis will supply information as to the approximate location of the roots.

Example

Sketch the function \(f(x) = x - 2 + \ln x\) for \(x > 0\) and estimate the value of the root.

Solution

[Image: A plot showing the function crossing the x-axis somewhere between 1 and 2.]

A simple root is alocated near \(1.5\).

One method of obtaining a better approximation is to halve the interval \(1 \le x \le 2\) into \(1 \le x \le 1.5\) and \(1.5 \le x \le 2\) and test the sign of the function at the end-points of these new regions. We find

\[\begin{array}{l|c} x & f(x) \\ \hline 1 & < 0 \\ 1.5 & < 0 \\ 2 & > 0 \end{array}\]

so a root must lie between \(x=1.5\) and \(x=2\) because the sign of \(f(x)\) changes between these values and \(f(x)\) is a continuous curve. We can repeat this procedure and divide the interval \((1.5,2)\) into the two new intervals \((1.5,1.75)\) and \((1.75,2)\) and test again. This time we find

\[\begin{array}{l|c} x & f(x) \\ \hline 1.5 & < 0 \\ 1.75 & > 0 \\ 2.0 & > 0 \end{array}\]

so a root lies in the interval \((1.5,1.75)\). It is obvious that proceeding in this way will give a smaller and smaller interval in which the root must lie. But can we do better than this rather laborious bisection procedure? In fact there are many ways to improve this numerical search for the root. In this Section we examine one of the best methods: the Newton–Raphson method.

To derive the method we examine the general characteristics of a curve in the neighbourhood of a simple root. Consider the figure below showing a function \(f(x)\) with a simple root at \(x=x^*\) whose value is required. Initial analysis has indicated that the root is approximately located at \(x=x_0\). The aim is to provide a better estimate to the location of the root.

[Image: A plot of f with a root at x star and a first root estimate at x zero.]

The basic premise of the Newton–Raphson method is the assumption that the curve in the close neighbourhood of the simple root at \(x^*\) is approximately a straight line. Hence if we draw the tangent to the curve at \(x_0\), this tangent will intersect the \(x\)-axis at a point closer to \(x^*\) than is \(x_0\): see the figure below.

[Image: The line tangent to f at x equals x nought crosses the x axis at x one, which is the next estimate of the root.]

From the geometry of this diagram we see that

\[x_1 = x_0 - PQ.\]

But from the right-angled triangle \(PQR\) we have

\[\dfrac{RQ}{PQ}= \tan \theta =f'(x_0)\]

and so

\[PQ = \dfrac{RQ}{f'(x_0)} = \dfrac{f(x_0)}{f'(x_0)} \qquad \therefore \qquad x_1 = x_0 - \dfrac{f(x_0)}{f'(x_0)}\]

If \(f(x)\) has a simple root near \(x_0\) then a closer estimate to the root is \(x_1\), where

\[x_1 = x_0 - \dfrac{f(x_0)}{f'(x_0)}\]

This formula can be used iteratively to get closer and closer to the root, as in the following Key Point:

Key Point

If \(f(x)\) has a simple root near \(x_n\), then a closer estimate to the root is \(x_{n+1}\), where

\[x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}.\]

This is the Newton–Raphson iterative formula. The iteration is begun with an initial estimate of the root, \(x_0\), and continued to find \(x_1,x_2,\dots\) until a suitably accurate estimate of the position of the root is obtained. This is judged by the convergence of \(x_1,x_2,\dots\) to a fixed value.

Example

\(f(x)=x-2+\ln x\) has a root near \(x=1.5\). Use the Newton–Raphson method to obtain a better estimate.

Solution

Here \(x_0 = 1.5\), \(f(1.5) = -0.5 + \ln(1.5) = -0.0945\).

\[f'(x) = 1 + \frac{1}{x} \quad \therefore \quad f'(1.5) = 1 + \frac{1}{1.5} = \frac{5}{3}\]

Hence, using the formula:

\[x_1 = 1.5 - \frac{(−0.0945)}{1.6667} = 1.5567\]

The Newton–Raphson formula can be used again: this time beginning with \(1.5567\) as our estimate:

\[\begin{aligned} x_2 = x_1 - \frac{f(x_1)}{f'(x_1)} & = 1.5567 - \frac{f(1.5567)}{f'(1.5567)} \\ & = 1.5567 - \frac{\{1.5567 - 2 + \ln(1.5567)\}}{\left\{1 + \frac{1}{1.5567}\right\}} \\ & = 1.5567 - \frac{(−0.0007)}{1.6424} = 1.5571 \end{aligned}\]

This is in fact the correct value of the root to \(4\) d.p., which calculating \(x_3\) would confirm.

Example

Buckling of a strut

The equation governing the buckling load \(P\) of a strut with one end fixed and the other end simply supported is given by

\[\tan \mu L =\mu L,\]

where \(\mu =\sqrt{\dfrac{P}{EI}}\), \(L\) is the length of the strut and \(EI\) is the flexural rigidity of the strut. For safe design it is important that the load applied to the strut is less than the lowest buckling load. This equation has no exact solution and we must therefore use the method described in this Workbook to find the lowest buckling load \(P\).

[Image: A strut of length L whose shape is deflected by a load P.]

We let \(\mu L=x\) and so we need to solve the equation \(\tan x=x\). Before starting to apply the Newton–Raphson iteration we must first obtain an approximate solution by plotting graphs of \(y=\tan x\) and \(y=x\) using the same axes.

[Image: A graph showing both tan x and x, which intersect at a point to the left of 3 pi over 2.]

From the graph it can be seen that the solution is near to but below \(x=3\pi /2\ (\sim 4.7)\). We therefore start the Newton–Raphson iteration with a value \(x_0=4.5\).

The equation is rewritten as \(\tan x-x=0\). Let \(f(x)=\tan x-x\). Then \(f'(x)=\sec^2 x-1=\tan^2x\).

The Newton–Raphson iteration is

\[x_{n+1}=x_n-\dfrac{\tan x_n-x_n}{\tan^2 x_n}, \quad x_0=4.5,\]

so

\[x_1=4.5-\dfrac{\tan(4.5)-4.5}{\tan^2 4.5} = 4.5-\dfrac{0.137332}{21.504847}=4.493614 \text{ to 7 sig.fig.}\]

Rounding to \(\text{4 sig.fig.}\) and iterating:

\[x_2=4.494-\dfrac{\tan(4.494)-4.494}{\tan^2 4.494}=4.494-\dfrac{0.004132}{20.229717}=4.493410 \text{ to 7 sig.fig.}\]

So we conclude that the value of \(x\) is \(4.493\) to \(\text{4 sig.fig.}\) As \(x=\mu L=\left(\sqrt{P/EI}\right)L\) we find, after re-arrangement, that the smallest buckling load is given by \(P=20.19\dfrac{EI}{L^2}\).

Exercise

The function \(f(x) = x - \tan x\) has a simple root near \(x = [value]\). Use one iteration of the Newton–Raphson method to find a more accurate value for the root.

First find the derivative of \(f\).

\(\displaystyle \frac{\mathrm{d}f}{\mathrm{d}x} = \)

Now use the formula

\[x_1 = x_0 - \frac{f(x_0)}{f'(x_0)}\]

with \(x_0 = [value]\) to obtain \(x_1\) to \(3\) d.p.

\(x_1 = \)
Feedback: First we find the derivative of \(f\), which is given by \[f'(x) = [value].\] Next, we apply the formula \[x_1 = x_0 - \frac{f(x_0)}{f'(x_0)}\] with \(x_0 = [value]\). This gives \[x_1 = [value] - \frac{[value] - \tan([value])}{1 - \sec^2([value])} = [value], \quad \text{to 2 d.p.}\]

Exercise

Using the sketch of the function \(f(x) = [value]\) below, confirm that there is a simple root between \(x = [value]\) and \(x = [value]\).

Use \(x_0 = [value]\) as an initial estimate and perform 3 iterations of the Newton–Raphson method to obtain the value of the root to \(2\) d.p.

Keep track of the values of \(x_1\), \(x_2\) and \(x_3\) and give them here to \(3\) d.p.

\(x_1 = \)

\(x_2 = \)

\(x_3 = \)
Feedback: First we find the derivative of \(f\), which is given by \[f'(x) = [value].\] Next, we repeatedly apply the formula: \[x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}\] With \(x_0 = [value]\), we get \[x_1 = [value] - \frac{[value]}{[value]} = [value], \quad \text{to 3 d.p.}\] With \(x_1 = [value]\), we get \[x_2 = [value] - \frac{[value]}{[value]} = [value], \quad \text{to 3 d.p.}\] With \(x_2 = [value]\), we get \[x_3 = [value] - \frac{[value]}{[value]} = [value], \quad \text{to 3 d.p.}\] We can visualise the process in the following graph.

Exercise

Using the sketch of the function \(f(x) = [value]\) below, confirm that there is a simple root near \(x_0 = [value]\).

Use two iterations of the Newton–Raphson method to obtain a better estimate of the root.

Keep track of the values of \(x_1\) and \(x_2\), and give them here to \(4\) d.p.

\(x_1 = \)

\(x_2 = \)
Feedback: First we find the derivative of \(f\), which is given by \[f'(x) = [value].\] Next, we repeatedly apply the formula: \[x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}\] With \(x_0 = [value]\), we get \[x_1 = [value] - \frac{[value]}{[value]} = [value], \quad \text{to 4 d.p.}\] With \(x_1 = [value]\), we get \[x_2 = [value] - \frac{[value]}{[value]} = [value], \quad \text{to 4 d.p.}\] We can visualise the process in the following graph.

Exercise

Obtain an estimate of the point of intersection of the curves \(y = [value]\) and \(y = [value]\).

Use one iteration of the Newton–Raphson method with \(x_0 = [value]\) to find your estimate.

Give it here to \(2\) d.p.
Feedback: In order to find the point of intersection of the curves \(y = [value]\) and \(y = [value]\), we must find a root of the function \(f(x) = [value] - [value]\). First we find the derivative of \(f\), which is given by \[f'(x) = [value].\] Next, we apply the formula: \[x_{1} = x_0 - \frac{f(x_0)}{f'(x_0)}\] With \(x_0 = [value]\), we get \[x_1 = [value] - \frac{[value]}{[value]} = [value], \quad \text{to 2 d.p.}\] We can visualise the process in the following graph.