In this explainer, we will learn how to use the NewtonโRaphson method to approximate the solutions of equations of the form .
Often, it is not easy (or even possible) to determine the exact values of roots of certain functions. This is one reason it is useful to develop numerical techniques to approximate these values to any degree of accuracy that is necessary. Another reason is that computers are becoming faster, and so developing more efficient algorithms can aid us in finding approximations.
In this explainer, we will explore a method for approximating the roots of differentiable functions named after Isaac Newton and Joseph Raphson. The idea of the method is to use tangent lines to find the roots. First of all, it is necessary to choose a value that is a โcloseโ first approximation to the root we want to find, which we usually denote by . Then, there is an iterative process for any greater than or equal to 0 that we can use:
- Find the tangent line to at .
- Find the point of intersection between the tangent line and the , denoted by .
- Repeat this process for and so on.
Using this process from a given estimate, , to a root, we can find , , and so on, with the process (hopefully) converging to the root in question.
We can represent this process graphically by sketching tangent lines. For instance, consider the following graph of , with as our first approximation. We find the tangent line to at by differentiating to find that . So, the slope of the tangent line is .
We get the following tangent line with equation
.
We can apply this process again starting at ,
the -intercept of the tangent, to obtain the following.
If we keep applying this process, then we see that successive iterations will approach the root of the function.
We can find the exact equation of a tangent line at by noting it passes through the point and has a slope of . We recall that the equation of a line passing through with a slope of has the equation , so the tangent line has the equation
The -intercept of this line occurs when . We can substitute and into the equation and rearrange to get provided we can differentiate and is nonzero.
We now have an equation where on the right-hand side, we can substitute in the previous value in the iteration, , and on the left-hand side, we will get the new value, .
It is worth noting that we should not choose a starting value close to a turning point of or any point with slope close to 0 since that will make the term very large or undefined. Graphically, the tangent line will run parallel to the and therefore will never intersect it.
We also ideally want to choose a starting value that is close to the root we want to find since it will take more iterations to converge if the root is further away. And if there are multiple roots, then the algorithm could potentially converge to a different root.
This iterative formula is known as the NewtonโRaphson method for approximating the roots of , and we can define the method formally as follows.
Theorem: NewtonโRaphson Method for Approximation of Roots
If is a differentiable function, then the NewtonโRaphson method for approximating the roots of is the given by iterative formula
We should choose the starting value, , such that the slope is not close to 0 so that the term is not too large (or undefined).
In our first example, we will use a graph of a function to identify which of a list of five given points are suitable stating points for a NewtonโRaphson approximation of a specific root of the function.
Example 1: Explaining Why It Is Important to Be Careful When Picking the Starting Value in the NewtonโRaphson Method
The diagram shows the graph of the equation
, where
. The function
has a root in the interval
. Which of the
points on the graph are suitable first approximations to
when applying the NewtonโRaphson method to
?
- Only , , and
- Only and
- Only and
- Only , , and
- Any of the points are suitable.
Answer
The NewtonโRaphson method of approximating the root of an equation is often a very quick way of approximating the roots of functions that we can differentiate. However, we need to be careful when choosing our starting values. The NewtonโRaphson method uses lines of tangency to choose the next iteration. This means that choosing initial points where the curve has a slope close to 0 can cause the process to fail.
For instance, on points and , the
slope of the curve appears to be 0. We can see that this means
tangent lines at these points will not intersect the
, which means the NewtonโRaphson method will fail
to define the next value in the iteration .
We can also see this by recalling that the NewtonโRaphson method is the iterative formula
If , then the expression is not defined since we cannot divide by zero. Similarly, if is close to zero, then will be very large. So, it is a good idea not to choose the initial value close to any turning point.
The other three points all have a slope that is not close to zero, so they should be good points to start with in this method. However, we should check that they will approach root . But since is the only root, there is no chance that it will converge to a different root.
Hence, only points , , and are suitable choices, and points and are not suitable. We see that this is given by choice A.
In our next example, we will apply the NewtonโRaphson method to a given function at a given starting value in order to approximate a root of the function.
Example 2: Using the NewtonโRaphson Method to Approximate the Root of an Equation
Given that and that a root to denoted by lies in the interval , find the second approximation to given a first approximation of .
Answer
We first recall that the NewtonโRaphson method for approximating the roots of a function is given by the iterative formula
We want to apply this formula with . To do this, we need to find an expression for . We can differentiate each term of separately using the power rule for differentiation for the first term and recalling that . Therefore,
It is worth noting that to apply this derivative result we need the angles to be measured in radians.
We can substitute this expression for and the given expression for into the iterative formula to obtain
We can now substitute and into the formula and evaluate to get
We should be careful to evaluate the trigonometric functions in radians since we used differentiation to find this approximation and there is no root in when the angle is measured in degrees.
Since is our first approximation, is our second approximation. We can round this to three decimal places to obtain .
In our next example, we will apply the NewtonโRaphson method to a given function involving an exponential function at a given starting value in order to approximate a root of the function.
Example 3: Using the NewtonโRaphson Method to Approximate the Root of an Equation
Let . If we were to apply the NewtonโRaphson method to find the solution to taking as a first approximation, then what would be to 3 decimal places?
Answer
We first recall that the NewtonโRaphson method for approximating the roots of a function is given by the iterative formula
We want to apply this formula with . To do this, we need to find an expression for . We can do this using the power rule for differentiation and the rule that for any real constant .
This allows to differentiate term by term as follows:
We can substitute this expression for and the given expression for into the iterative formula to obtain
We can now substitute and into the formula and evaluate to get
Since is our first approximation, is our second approximation. We can round this to three decimal places to obtain 1.087.
Until now, we have just used the NewtonโRaphson method to find a second approximation given a first one. But inevitably, we will need to ask how accurate these approximations are and when we can stop the process. To answer these, recall that given a function , we can check that an approximation to the solution is accurate by considering the values on either side of the approximation.
For instance, if we find an approximation of and that and have opposite signs, then this would prove that the root lies in the interval . We can also note that all values in this interval round to give , so this would show that is an accurate approximation of the root to one decimal place.
In our next example, we will apply the NewtonโRaphson method and this process to approximate the root of a function to three decimal places of accuracy.
Example 4: Using the NewtonโRaphson Method to Approximate the Root of an Equation
Let . Let us take a first approximation of 2.1 to the root of , where .
- Apply the NewtonโRaphson method once to find a second approximation. Give your answer to 3 decimal places.
- By considering the change of the sign of over an appropriate interval, determine whether this answer is accurate to 3 decimal places.
Answer
Part 1
We first recall that the NewtonโRaphson method for approximating the roots of a function is given by the iterative formula
We want to apply this formula with . To do this, we need to find an expression for . We can do this using the product rule, which tell us if , then provided and are differentiable. We then recall that and . This allows to differentiate as follows:
It is worth noting that to apply this derivative result we need the angle to be measured in radians.
We can substitute this expression for and the given expression for into the iterative formula to obtain
We can now substitute and into the formula and evaluate to get
We should be careful to evaluate the trigonometric functions in radians since we used differentiation to find this approximation.
Since is our first approximation, is our second approximation. We can round this to three decimal places to obtain 2.069.
Part 2
We can recall that if a function is continuous and the function changes sign between two input values and , then the function must have a root between these values. This is useful for bounding the possible values where a root can occur.
We want to check if our approximation is accurate to three decimal places. For the approximation to be accurate to three decimal places, root must round to this value, so we must have .
We can check if is in this interval by checking if the function changes sign between these values:
Since both of these outputs are negative and there is a single root in the interval , we know that this is not the correct interval for the root.
Although it is not necessary, we can find that the sign of changes between 2.0695 and 2.0705; so, to three decimal places, we note that .
Hence, we can say that it is not accurate to three decimal places.
In our final example, we will apply the NewtonโRaphson method to approximate the root of a function and then we will consider the change of the sign of the function on an appropriate interval to check the accuracy of this approximation.
Recall that if is a continuous function and changes sign between and , then has a root between these values.
Example 5: Using the NewtonโRaphson Method to Approximate the Root of an Equation
Given that and that a root of lies within the interval , answer the following questions.
- Use the NewtonโRaphson method with the first approximation 0.8 to to find a second approximation. Give your answer to 3 decimal places.
- By considering the change of the sign of over an
appropriate interval, determine whether this answer is accurate to
3 decimal places.
- Yes, it is accurate.
- No, it is not accurate.
Answer
Part 1
We first recall that the NewtonโRaphson method for approximating the roots of a function is given by the iterative formula
We want to apply this iteration a single time with an initial value of . To do this, we first need to differentiate with respect to . We could do this by applying the chain rule; however, it is easier to rewrite using the power rule for logarithms. We have
We can now differentiate each term separately to get
We can use this expression for and the given expression for to apply one iteration of the NewtonโRaphson method:
Rounding this value to three decimal places yields 0.806.
Part 2
We can recall that if a continuous function changes sign between two input values and , then the function must have a root between these values. This is useful for bounding the possible values where a root can occur.
We want to check if our approximation is accurate to three decimal places. For the approximation to be accurate to three decimal places, root must round to this value, so we must have .
We can check if is in this interval by checking if the function changes sign between these values:
Since the function changes sign between and , we know that the root lies between these values. Any value of between these values rounds to three decimal places to give 0.806.
Hence, we can say that it is accurate to three decimal places.
Letโs finish by recapping some of the important points from this explainer.
Key Points
- The NewtonโRaphson method is the iterative formula for approximating the roots of . We start by choosing a starting approximation as close to the root as possible and putting it into the right-hand side of the equation to get the next value in the iteration. We need to be able to differentiate to apply this formula, and we should also choose starting values where the slope is not close to 0 so that the term is not too large (or undefined).
- We can recall that if a continuous function changes sign between two input values and , then the function must have a root between these values. This is useful for bounding the possible values where a root can occur. We can also use this to determine the accuracy of our approximations by checking for sign changes.