Newton's Method for Approximating Zeros

Illustrated · 2 min

Newton's Method allows us to approximate the zeroes of any function, by using derivatives.

The process is relatively simple: Suppose we want to estimate a zero of f(x)f(x). First, choose any guess for the zero, and call it x0x_0. Then, calculate x1,x2,x3x_1,x_2,x_3, and so on using the recursion xn=xn−1−f(xn−1)f′(xn−1).x_n=x_{n-1}-\frac{f(x_{n-1})}{f'(x_{n-1})}. Each xix_i gives a better estimate for the zero than the previous value xi−1x_{i-1}, and so by repeating this process enough times we can arrive at a reasonably close approximation.

Let's take a look at an example: suppose f(x)=x3+x+1f(x)=x^3+x+1.

Since f(0)=1f(0)=1, which is somewhat close to 00, we can start by letting x0=0x_0=0. (The value that we choose does not actually matter as much in the long-run, so in theory we can start with x0=171,717,171x_0=171,717,171 if we really want. However, choosing a reasonable guess from the start will let us reach an approximation much more quickly.) Before we use the formula provided above, we should find out what the derivative of f(x)f(x) is: f′(x)=(x3+x+1)′=3x2+1.f'(x)=(x^3+x+1)'=3x^2+1. So, we have x1=x0−f(x0)f′(x0)=0−f(0)f′(0)=−11=−1.x_1=x_0-\frac{f(x_0)}{f'(x_0)}=0-\frac{f(0)}{f'(0)}=-\frac{1}{1}=-1. This is closer to the actual solution than 00, but let's continue: x2=x1−f(x1)f′(x1)=−1−f(−1)f′(−1)=−1+14=−34.x_2=x_1-\frac{f(x_1)}{f'(x_1)}=-1-\frac{f(-1)}{f'(-1)}=-1+\frac{1}{4}=-\frac{3}{4}. Now, we're much closer! By doing the same steps, we can find that x3=−5986≈−0.686,x_3=-\frac{59}{86}\approx -0.686, which is a pretty good estimate for the actual value of x=−0.68233x=-0.68233. (If you go one step further, you'll get x4=−523407767077≈−0.68234,x_4=-\frac{523407}{767077}\approx -0.68234, which is even more accurate but a lot more painful to calculate by hand.

To show why this process works, let's play around with the general function f(x)f(x). Suppose we start with an initial guess for the zero- say x=x0x=x_0. Our goal is to determine a closer approximation for the zero, in terms of x0x_0.

To do so, imagine the graph of y=f(x)y=f(x), and let P=(x0,f(x0))P=(x_0,f(x_0)) be one point on the curve. If we draw the tangent line to the curve at PP, we can see that the tangent line intersects the xx-axis at QQ, where QQ closer to the actual solution to f(x)=0f(x)=0 than x0x_0. So, let's let the xx-coordinate of QQ be x1x_1. If we repeat the same process, we can similarly get x2,x3,x4x_2, x_3, x_4, and so on. Each xix_i gives a more accurate approximation of the zero of f(x)f(x).

Great, so we now have a graphical method of approximating the zeroes of f(x)f(x). But can we now find a formula algebraically? Of course, we can!

Recall that the main step of the process is to find the tangent line of the graph at (xi,f(xi))(x_i,f(x_i)) and find its xx-intercept. Let's start with the tangent line: If we let the line be g(x)=mx+bg(x)=mx+b, we simply need to solve for mm and bb. Here mm represents the slope of the tangent line at x=xix=x_i, which by definition is m=f′(xi)m=f'(x_i). Then our equation becomes g(x)=f′(xi)x+b.g(x)=f'(x_i)x+b. Since we know gg passes through the point (xi,f(xi))(x_i,f(x_i)), we can plug this value in to get g(xi)=f(xi)=f′(xi)⋅xi+b.g(x_i)=f(x_i)=f'(x_i)\cdot x_i+b. Solving for bb, we get b=f(xi)−f′(xi)⋅xib=f(x_i)-f'(x_i)\cdot x_i. Therefore, our final equation of the tangent line becomes g(x)=f′(xi)x+(f(xi)−f′(xi)⋅xi).g(x)=f'(x_i)x+(f(x_i)-f'(x_i)\cdot x_i). Since we want to find this line's xx-intercept, we set g(x)=0g(x)=0 to find that 0=f′(xi)x+(f(xi)−f′(xi)⋅xi)0=f'(x_i)x+(f(x_i)-f'(x_i)\cdot x_i) ⟹x=f′(xi)⋅xi−f(xi)f′(xi)=xi−f(xi)f′(xi).\Longrightarrow x=\frac{f'(x_i)\cdot x_i-f(x_i)}{f'(x_i)}=x_i-\frac{f(x_i)}{f'(x_i)}. By setting this new value as xi+1x_{i+1}, we get the exact formula described above. So, we are done with the proof!

Video · + 2 min read

(Video) Newton's Method

by PatrickJMT

Here's a video by patrickJMT where he explains how Newton's Method works and how you use it to find the zeros of functions.

Newton's Method is a way to find xx-intercepts of functions. You'll either be given a point to start with or you choose a point to start at. Let's call this starting point x1x_1.

We want to draw the tangent line at this point and note where it crosses the xx-intercept.

Then we take the point where the tangent line crosses the xx axis and locate it on our original function. This point becomes our x2x_2.

We find the tangent line at our new point now and continue this same process. With each new xnx_n, or iteration, we should start to get closer to where our original function crosses the xx-axis.

The general equation for Newton's Method is: x1x2=x1−f(x1)f′(x1)x3=x2−f(x2)f′(x2)⋯xn+1=xn−f(xn)f′(xn)\boxed{\begin{align} x_1&\\ x_2&=x_1-\frac{f(x_1)}{f'(x_1)}\\ x_3&=x_2-\frac{f(x_2)}{f'(x_2)}\\ \cdots\\ x_{n+1}&=x_n-\frac{f(x_n)}{f'(x_n)} \end{align}}

You have to be careful when using Newton's Method because it doesn't always work! If we took our starting point a little more to the left, the tangent line becomes horizontal.

An example of where Newton's Method fails.

Let's look at an example of Newton's Method. Patrick looks at a problem that says:

Find where f(x)=x7−1000f(x)=x^7-1000 intersects the xx-axis; find a solution that's correct to eight decimal places.

Here's the graph of this function. If we look at x=2x=2 we see it's a negative value. Then, at x=3x=3, it's a positive value. Because our function is a polynomial and because of the Intermediate Value Theorem, we know there's at least one xx-intercept between two and three.

Newton's Method tells us: xn+1=xn−f(xn)f′(xn)xn+1=xn−xn7−10007xn6\begin{align} x_{n+1}&=x_n-\frac{f(x_n)}{f'(x_n)}\\ x_{n+1}&=x_n-\frac{x_n ^7-1000}{7x_n^6} \end{align}

Suppose we make our first point, x1=3x_1=3. x2=x1−x17−10007x16x2=3−37−10007(3)6x2=2.76739173\begin{align} x_{2}&=x_1-\frac{x_1 ^7-1000}{7x_1^6}\\ x_{2}&=\color{red}{3}-\frac{\color{red}{3}^7-1000}{7\color{red}{(3)}^6}\\ x_{2}&=2.76739173 \end{align}

Now we repeat this to find x3x_3. x3=x2−x27−10007x26x3=2.76739173−2.767391737−10007(2.76739173)6x3=2.69008741\begin{align} x_{3}&=x_2-\frac{x_2 ^7-1000}{7x_2^6}\\ x_{3}&=\color{red}{2.76739173}-\frac{\color{red}{2.76739173}^7-1000}{7\color{red}{(2.76739173)}^6}\\ x_{3}&=2.69008741 \end{align}

Again for x4x_4. x4=x3−x37−10007x36x4=2.6900874−2.69008747−10007(2.6900874)6x4=2.68275645\begin{align} x_{4}&=x_3-\frac{x_3 ^7-1000}{7x_3^6}\\ x_{4}&=\color{red}{2.6900874}-\frac{\color{red}{2.6900874}^7-1000}{7\color{red}{(2.6900874)}^6}\\ x_{4}&=2.68275645 \end{align}

Again for x5x_5. x5=x4−x47−10007x46x5=2.68275645−2.682756457−10007(2.68275645)6x5=2.6826958\begin{align} x_{5}&=x_4-\frac{x_4 ^7-1000}{7x_4^6}\\ x_{5}&=\color{red}{2.68275645}-\frac{\color{red}{2.68275645}^7-1000}{7\color{red}{(2.68275645)}^6}\\ x_{5}&=2.6826958 \end{align}

Again for x6x_6. Don't worry it's almost over. x6=x5−x57−10007x56x6=2.6826958−2.68269587−10007(2.6826958)6x6=2.68269578\begin{align} x_{6}&=x_5-\frac{x_5 ^7-1000}{7x_5^6}\\ x_{6}&=\color{red}{2.6826958}-\frac{\color{red}{2.6826958}^7-1000}{7\color{red}{(2.6826958)}^6}\\ x_{6}&=2.68269578 \end{align}

Notice that the first eight digits after the decimal didn't change from the previous answer. This is because we're getting so insanely close that it's differing in very very very minute ways. So we actually have the answer accurate to eight decimal places. This tells us that our function, f(x)=x7−1000f(x)=x^7-1000, intercepts the xx-axis at x≈2.6826958x\approx2.6826958.

Video · + 1 min read

(Videos) Newton's Method Example

by PatrickJMT

Here's a video by patrickJMT where he goes over some more examples using Newton's Method.

The problem he looks at is:

Compute two iterations of Newton's method for the given function and indicated initial guess: f(x)=x2−8, x1=3f(x)=x^2-8,\ x_1=3

xn+1=xn−f(xn)f′(xn)xn+1=xn−xn2−82xn\begin{align} x_{n+1}&=x_n-\frac{f(x_n)}{f'(x_n)}\\ x_{n+1}&=x_n-\frac{x_n^2-8}{2x_n} \end{align}

Let's do the first iteration. x2=x1−f(x1)f′(x1)x2=3−32−82(3)x2=176\begin{align} x_{2}&=x_1-\frac{f(x_1)}{f'(x_1)}\\ x_{2}&=\color{red}{3}-\frac{\color{red}{3}^2-8}{2\color{red}{(3)}}\\ x_{2}&=\frac{17}{6} \end{align}

Now the second iteration. x3=x2−f(x2)f′(x2)x3=176−(176)2−82(176)x3≈2.82843\begin{align} x_{3}&=x_2-\frac{f(x_2)}{f'(x_2)}\\ x_{3}&=\color{red}{\frac{17}{6}}-\frac{\color{red}{(\frac{17}{6})}^2-8}{2\color{red}{(\frac{17}{6})}}\\ x_{3}&\approx2.82843 \end{align}

Here's another video with another example.

Apply two iterations of Newton's Method to approximate the xx-value of a point of intersection of these two functions using the given initial guess: f(x)=x2−4, g(x)=2x−3, x1=0f(x)=x^2-4,\ g(x)=2x-3,\ x_1=0 What is the value of x3x_3?

If we wanted to find the intersection of these two functions we would set them equal to each other. x2−4=2x−3x^2-4=2x-3 What Newton's Method does is look for where the function equals zero. So we can rewrite this as: x2−2x−1=0x^2-2x-1=0

Now we just apply Newton's Method do our new function which we'll call h(x)h(x). xn+1=xn−h(xn)h′(xn)xn+1=xn−xn2−2xn−12xn−2\begin{align} x_{n+1}&=x_n-\frac{h(x_n)}{h'(x_n)}\\ x_{n+1}&=x_n-\frac{x_n^2-2x_n-1}{2x_n-2} \end{align}

The first iteration gives us: x2=x1−h(x1)h′(x1)x2=0−02−2(0)−12(0)−2x2=−12\begin{align} x_{2}&=x_1-\frac{h(x_1)}{h'(x_1)}\\ x_{2}&=\color{red}{0}-\frac{\color{red}{0}^2-2\color{red}{(0)}-1}{2\color{red}{(0)}-2}\\ x_2&=-\frac12 \end{align}

The second iteration give us: x3=x2−h(x2)h′(x2)x3=−0.5−(−0.5)2−2(−0.5)−12(−0.5)−2x3=−512\begin{align} x_{3}&=x_2-\frac{h(x_2)}{h'(x_2)}\\ x_{3}&=\color{red}{-0.5}-\frac{\color{red}{(-0.5)}^2-2\color{red}{(-0.5)}-1}{2\color{red}{(-0.5)}-2}\\ x_3&=-\frac{5}{12} \end{align}

Here's one more video on Newton's Method. This one is to show you how this method can fail.

Given the following equation and initial guess, why would Newton's Method fail to approximate a solution? f(x)=(x−2)2−1; x1=2f(x)=(x-2)^2-1;\ x_1=2

We want to start at an xx that gives us something close to zero. If we plug in x=2x=2 we get out f(2)=−1f(2)=-1 which is close. So why will this not work? Let's look at the graph.

Newton's Method looks at the tangent line at the point we choose. We then want to see where this tangent line hits the xx-axis because that place becomes our new xx value. But this point gives us a horizontal tangent line which doesn't hit the xx-axis.

Let's see what would happen if we didn't notice this and instead jumped right in to using the method.

xn+1=xn−f(xn)f′(xn)xn+1=xn−(xn−2)2−12(xn−2)\begin{align} x_{n+1}&=x_n-\frac{f(x_n)}{f'(x_n)}\\ x_{n+1}&=x_n-\frac{(x_n-2)^2-1}{2(x_n-2)} \end{align}

So our first iteration yields: x2=x1−f(x1)f′(x1)x2=2−(2−2)2−12(2−2)x2=2−−10\begin{align} x_{2}&=x_1-\frac{f(x_1)}{f'(x_1)}\\ x_{2}&=\color{red}{2}-\frac{(\color{red}{2}-2)^2-1}{2(\color{red}{2}-2)}\\ x_2&=2-\frac{-1}{0} \end{align}

And we all know we can't divide by zero.

Type a concept, like “slope” or “photosynthesis”.

↑ ↓ to choose · Enter to openSearch explanations and problems