In this segment we'll talk about the graphical derivation of Newton-Raphson method.
The Newton-Raphson method is based on finding the root of an equation of f(x)=0.
So, let's suppose if we draw f(x) f(x) as uh as a function of x here and what it is based on is
that what you're going to do is you're going to say hey, let me choose the initial guess of x0
let's suppose for the root of the equation, you want to get here. Now what you're going to do is,
at this particular point on the on the function, what you're going to do is you're going to draw a
tangent at that particular point. Once you draw the tangent of the particular point,
you're going to see “hey where does it cross the x-axis?” So, let's suppose that point is x1. And
then you're going to repeat this process you're going to again go here, draw the tangent, and
this will become your next guess or next estimate of the root of the equation. As you can see that
if you graphically follow this, you want to - see that it's getting closer and closer to the
root of the equation. That's what Newton-Raphson method is based on from a graphical point of view.
Let's go and use this knowledge to be able to calculate or to be able to derive the formula
for Newton-Raphson method.
So, Newton-Raphson method, let's say we are at let's suppose the i-th iteration (so it's
an iterative process)so let's suppose if this was my- this was uh the guess or the estimate
I have reached at - what I’m going to do is I’m going to draw a tangent at that particular point
and I’m going to see where it crosses the x-axis; and if it crosses the x-axis I’ll
call that x(i+1), right? Now, what is this point? This point is x(i) is the x-coordinate and the
y-coordinate will be the value of the function, f, at that particular point. And let's suppose
if this angle is phi, then we can very well see the tangent phi will be rise over run.
And this rise over run will be hey what is the rise here, that is nothing but f(xi)-0
because if you look at this point the y value is f(xi) and the y value here is 0.
And then we'll divide it by the run which will be x(i)-x(i+1), which would be x(i)
right here minus x(i+1) because that is the run, right here. And sometimes students get confused
about hey do I put x(i+1) first than x(i), you got to basically see the rise over run. This is the
value of the function x(i), so you put x(i) here, that makes perfect sense, is 0 here and that's
what uh you have getting x(i+1). So, what you're going to see is that this tangent phi is nothing
but the derivative of the function at x(i) right because we are defining the slope of the function
at that particular point, or approximating at least we should say, divided by this.
So, once we have obtained this, what we got to understand is that the unknown
in this whole formula right here (which you are getting for the approximation of the derivative
of the function) is this guy right here. Because you are starting with some initial guess;
you know what the derivative of the function is at that particular point. I shouldn't call it initial
guess, but the current estimate you're starting with (the current estimate at this iteration)
and you know the value of the function at that particular point you know the value of
the derivative at that particular point, you want to find out what the next estimate of the root is.
So, the formula which I have is that f(xi) is equal to – f’(xi) is equal to f(xi)
divided by x(i)-x(i+1). So, I can bring this over there and bring this down here,
so I’ll get x(i)-x(i+1) is equal to f(xi) divided by f’(xi).
Then what I’m going to do is I’m going to move this part to the left side, so I’ll get this…
move this part to the right side, I’ll get x(i+1). But what is my unknown? x(i+1). And the whole
reason why I’m doing all this manipulation is to have unknowns on one side and knowns on the
other side. So, since we always put unknowns on the left side so I’m going to put x(i+1)
here and I’m just going to switch the sides of the equation and uh that's what we get
as our Newton-Raphson method formula. So, it's a recursive formula! You put the current estimate of
the root of the equation, and you find the value of the function at that particular point, the
value of the derivative of the function at that particular point, and you get your next estimate,
and you keep on doing this till you are satisfied that you have obtained a reasonable estimate.
So, in the next slide what we do is we will talk about the algorithm of the Newton-Raphson method.
So, let's talk about the algorithm of the Newton-Raphson method.
Of course, we have to keep in mind that what we are doing is we are trying to find the
root of the equation f(x)=0. So, the first one what we have to do is to find f’(x) symbolically,
so we have to find the derivative of the left-hand side of the of the equation…
you know of the equation, then what we do is we apply this formula
to find the next estimate of the root of the equation,
and keep in mind that we have to start with some kind of initial estimate. And then what I’m going
to do is you want to calculate my absolute relative approximate error, which is the
current approximation minus the previous approximation divided by the current approximation
so I may multiply by 100 if I want to find in terms of percentages.
And then what am I going to do with this information? I'm going to say
if epsilon-a is less than epsilon-s, or maximum iterations reached,
then you're going to say hey stop. Else, go to step 2.
So, if my absolute relative approximate is less than the pre-specified tolerance,
which I have to pre-specify. It could be like a percentage number, I might say hey I want a
prespecified tolerance of 0.03% or somebody might say hey I would like to have at least
so many significant digits to be at least correct in my answer, and that can be converted also into
a percentage number for the pre-specified tolerance. Or if I if maximum number of
iterations has been reached. What “maximum iterations has been reached” is because
you want to stop the possibility of it going into a long loop, so you will have to put maximum
number of iterations for the procedure. But if you want if the if the algorithm
or if the program is stopping because of the maximum number of iterations reached, make sure
that you tell the user that's what has happened, because otherwise they might misinterpret that you
have found the estimate within the pre-specified tolerance. So, if either this has happened, or
this has happened, you will stop or you will say the estimate of the root has been achieved;
otherwise, you will just go to step two right here, find the new estimate of the root,
find the absolute relative approximate error, and continue this process. So,
that's the algorithm for the Newton-Raphson method and that is the end of this segment.