Watch these two (2) videos in order. The total video time is 7 min. Be sure to test your knowledge with the knowledge checks after each video.

Description: This video discusses using Newton-Raphson’s method to find the root using the first derivative of the function.

Video Transcript Hide Video transcript

Hello, this is video NLE|VL|12 and it is the theory of Newton-Raphson’s method for solving non-linear equations.

Let's first look at the principle behind Newton-Raphson’s method. Let's first start with the Taylor series approximation. The Taylor Series is an infinite series, but we will just take the first two terms, that is f(xi+1) ≃ f(xi) +f’(xi)*(xi+1 - xi). In this case, we know xi and our next point, we want to find is xi+1. We also know that we want to get to 0, which means that f(xi+1) should be equal to zero. We can rearrange the equation to get xi+1 = xi -f(xi)/f’(xi). So let's look at a function f(x) which is the top graph here and its derivative f’(x), which is the bottom graph. First notice that f(x) crosses the x-axis and goes from a negative to a positive, where f’(x) is always positive. In this case, graphically, we can draw a tangent line from a point xi. To the x-axis and this will be our next estimate xi+1, so we can find f(xi+1) now and draw a tangent line to the x-axis to determine the next estimate of the root. In this case, you'll notice that the estimate of the root is almost directly on the x-axis, which means it's very, very close to the answer and converge quite quickly. This will however depend on what your first initial guess is, which is one of the drawbacks to Newton-Raphson’s method. Depending on the function f(x), you may need a good initial estimate of the root for this to converge, and if it's not, it may actually diverge in some cases.

Let's look at the graphical steps for Newton-Raphson’s method. Let's start with a function that crosses the x-axis. We will choose one point xi, which we believe will be close to the root of the equation. This is how the method differs from bracketed methods as bracketed methods we need two values that bracket the root. In this case, we only use one that is hopefully close to the root. To determine the next estimate of the root, we'll use the equation xi+1 = xi -f(xi)/f’(xi). This is the same as drawing the tangent line from xi to the x-axis. That will give us the f(xi) value which should be getting closer to 0 if our function is converging. This new point can be seen as our new xi and we can repeat the same procedure as before finding where the tangent crosses the x-axis and updating our estimate of the root over the iterations. The f(xi) value should be decreasing and the function will be becoming more and more linear. If it does not converge, then it is likely that the initial estimate of the root was not close enough to the true root and therefore is diverging. In the example shown. we did about 6 iterations and with the six iterations we are close to an f(xi) that is close to 0. This means we can use our final value of xi to be an estimate of the root, or we can call it XR is equal to 1.65744 in this case.

Let's now look at the algorithm for Newton-Raphson’s method

  • Step 1: With the initial guess xi, calculate f(xi) and f’(xi).
  • Step 2:  Calculate xi+1 where xi+1 xi+1 = xi -f(xi)/f’(xi).
  • Step 3: Repeat Steps 1 and 2 until the exact root is found or desired error is reached. The error or εa, is |( xRi - xRi-1)/xRi|.
  • Step 4:  With the last approximation of the root xn, check that f(xn) is approximately equal to 0 and set that to the root.

This concludes the video. This project could not have been completed without the support of eCampusOntario and the University of Ottawa.

Description: This video implements Newton-Raphson’s method to solve a problem in a step-by-step procedure.

Video Transcript Hide Video transcript

Hello, this is video NLE|VL|13 and it is a step-by-step example of Newton-Raphson’s method for solving nonlinear equations.

First, let's look at the problem. Solve the following equation ex = x2 and stop iterating when your error, εa is less than 1%. For the problem, we'll use our first guess that is x1 =0. Step one is to first rearrange the equation. We take ex = x2and put it on the same side. So we have f(x) =ex - x2, which is of course equal to 0. Let's look at the calculations for this problem and how we'll solve it in the following layout. In the top left-hand corner will be the graphical representation of the solution. On the top right side there will be the important equations that will be used to solve this problem. On the right side is a graph showing how the estimate of the error εa will be changing over iterations. On the bottom is a table of all the important calculations that are done for each iteration. Let's look at the important equations. We have f(x) = ex -x2 and its derivative f’(x) = ex -2x. Then we have the equation to determine our next estimate of the root, which is xi+1 = xi -f(xi)/f’(xi). Finally, we have the approximation of the error εa which is equal to |( xRi - xRi-1)/xRi|. Let's now graph our function around original estimate of x1 = 0. Now that we have a first guess we can calculate f(xi) as well as the derivative f’(xi). Normally we can calculate the error εa at this point, however, we only have one estimate of the root which was the x1 = 0. We can now calculate our next estimate xi+1 by using the formula. So our next estimate of the root, x2, at iteration 2 is -1. We can now repeat the same procedure by calculating a f(xi) and f’(xi) and now that we have two estimates of the root, we can calculate the error. In this case it is 100% error. So we will continue with our iterations in the same way. We'll calculate our next estimate of the root as x3 and you'll notice from the graph on the top left that our estimate is closer to the x- axis. We can continue with our calculations and we notice that the approximation of the error is now approximately 36%. And so we can continue iterating until our εa is less than 1% and this will occur after five iterations. Now that we are below 1% error for εa, we can take our last estimate of the root x5 as our xR, which in this case equals -0.703. The value of f(x) is very close to 0 in this case and therefore we have solved the problem.

This concludes the video. This project could not have been completed without the support of eCampusOntario and the University of Ottawa.