Newton's Method: Formula, Steps and Worked Examples
Learn Newton's method for approximating roots: the formula, why it works, how to iterate step by step, worked examples, and when the method fails.
By the PracticeCalculus team Published 8 min read
Try it yourself
On this page
- What is Newton's method?
- The Newton's method formula
- How to use Newton's method, step by step
- Worked example 1: approximating the square root of 2
- Worked example 2: solving cos x = x
- Worked example 3: a cubic equation
- Worked example 4: when Newton's method fails
- When does Newton's method fail?
- Common mistakes with Newton's method
- Newton's method quick reference
- Why Newton's method converges so fast
- Practice Newton's method until it feels routine
Some equations simply cannot be solved with algebra. Try isolating x in \cos x = x or x^3 - 2x - 5 = 0 and you will get nowhere fast. Newton's method turns derivatives into a root-finding machine: start with a reasonable guess, follow a tangent line, and within a few steps you have an answer accurate to six or more decimal places.
This guide explains the Newton's method formula, where it comes from, how to run it step by step, and when it breaks down.
What is Newton's method?
Newton's method (also called the Newton-Raphson method) is a procedure for approximating a root of a function, that is, a number r with f(r) = 0.
The idea in plain language: near a point, a smooth curve looks almost like its tangent line. Finding where a curve hits the x-axis is hard, but finding where a straight line hits the x-axis is easy. So you swap the curve for its tangent line, solve the easy problem, and use that answer as a better guess. Then you repeat.
If this sounds familiar, it should. It is the same tangent line idea behind linear approximation, used over and over.
The Newton's method formula
Starting from a guess x_0, each new approximation is
You need two things to use it: the function f and its derivative f'. Every step uses only the current guess x_n.
Where the formula comes from
The tangent line to y = f(x) at x = x_n is
Set y = 0 to find where this line crosses the x-axis:
Solve for x (assuming f'(x_n) \neq 0):
That crossing point is x_{n+1}. The whole method is just this one derivation, repeated.
How to use Newton's method, step by step
- Rewrite the equation as f(x) = 0. For example, \cos x = x becomes f(x) = \cos x - x.
- Find f'(x).
- Choose a starting guess x_0 close to the root. A quick sketch or a sign change helps.
- Apply the formula to get x_1, then x_2, and so on.
- Stop when successive values agree to the accuracy you need.
Tip: Write a simplified iteration formula first. Combining x - \frac{f(x)}{f'(x)} into one fraction often makes the arithmetic much cleaner and less error prone.
Worked example 1: approximating the square root of 2
The number \sqrt{2} is a root of f(x) = x^2 - 2. Let's approximate it with x_0 = 1.
Step 1. Derivative. f'(x) = 2x.
Step 2. Simplify the iteration.
This says: average your guess with 2 divided by your guess. (This is the ancient Babylonian square root method, which turns out to be Newton's method in disguise.)
Step 3. Iterate.
The true value is \sqrt{2} \approx 1.4142136. After only three steps we are off by about 0.000002.
| Step | x_n | Correct digits |
|---|---|---|
| x_0 | 1 | 1 |
| x_1 | 1.5 | 1 |
| x_2 | 1.416667 | 3 |
| x_3 | 1.414216 | 6 |
Notice the pattern in the table: the number of correct digits roughly doubles each step. That is called quadratic convergence, and it is why Newton's method is so popular.
Worked example 2: solving cos x = x
No algebra trick isolates x here, so this is a perfect job for Newton's method.
Step 1. Set up. f(x) = \cos x - x, so f'(x) = -\sin x - 1 (see the derivative of cos x).
Step 2. Choose x_0. Since f(0) = 1 > 0 and f(1) = \cos 1 - 1 \approx -0.4597 < 0, the Intermediate Value Theorem guarantees a root between 0 and 1. Take x_0 = 1. Use radians throughout.
Step 3. First iteration.
Step 4. Second iteration.
Step 5. Third iteration.
So the solution of \cos x = x is x \approx 0.739085. A fourth step would not change any of these six decimal places.
Worked example 3: a cubic equation
Newton himself tested his method on x^3 - 2x - 5 = 0. Let's do the same.
Step 1. Set up. f(x) = x^3 - 2x - 5 and f'(x) = 3x^2 - 2.
Step 2. Choose x_0. f(2) = 8 - 4 - 5 = -1 and f(3) = 27 - 6 - 5 = 16, so a root lies between 2 and 3, much closer to 2. Take x_0 = 2.
Step 3. First iteration.
Step 4. Second iteration.
Step 5. Third iteration.
The root is x \approx 2.094551. Check: f(2.094551) is within about 0.000001 of zero.
Worked example 4: when Newton's method fails
Newton's method is powerful, but it is not foolproof. Take f(x) = \sqrt[3]{x} = x^{1/3}, whose only root is obviously x = 0.
The derivative is f'(x) = \frac{1}{3}x^{-2/3}, so
Start at x_0 = 1 and you get -2, 4, -8, 16, \ldots Each step doubles the distance from the root and flips sides. The method diverges no matter how close (but not equal to zero) your starting guess is. The culprit is that the cube root graph has a vertical tangent at its root, so the tangent lines are too steep in the wrong way and overshoot badly.
When does Newton's method fail?
Watch for these situations:
- Horizontal tangent. If f'(x_n) = 0, the tangent line never crosses the x-axis and the formula divides by zero. For f(x) = x^2 - 2, starting at x_0 = 0 fails immediately.
- Nearly horizontal tangent. If f'(x_n) is tiny, the next guess shoots far away, possibly toward a different root or off to infinity.
- Bad starting guess. The method can converge to a root you did not want, or cycle. For f(x) = x^3 - 2x + 2 with x_0 = 0, you get x_1 = 1, then x_2 = 0, and it bounces between 0 and 1 forever.
- Shape of the function. Functions like \sqrt[3]{x} near their root can push iterates away every time.
The cure is usually a better x_0. Sketch the graph, look for a sign change, and start close to the root on a stretch where the curve is not flat.
Common mistakes with Newton's method
- Forgetting to rewrite as f(x) = 0. For \cos x = x you must use f(x) = \cos x - x, not f(x) = \cos x.
- Adding instead of subtracting. The formula is x_n - \frac{f(x_n)}{f'(x_n)}. A plus sign sends you the wrong way.
- Using degrees. Calculus with trig functions assumes radians. In degree mode, example 2 produces nonsense.
- Rounding too early. Carry at least two more decimal places than you need in the final answer. Rounding x_1 to one decimal place can cost you the fast convergence.
- Mixing up f and f'. Write both formulas clearly before you start plugging in numbers. A wrong derivative still gives numbers, just not the right ones. Our derivatives of trig functions guide is a good refresher if trig derivatives trip you up.
- Ignoring the question's iteration count. If an exam asks for x_2, give x_2, not the fully converged root.
Newton's method quick reference
| Goal | Function f(x) | Iteration x_{n+1} |
|---|---|---|
| General root | f(x) | x_n - \frac{f(x_n)}{f'(x_n)} |
| \sqrt{a} | x^2 - a | \frac{1}{2}\left(x_n + \frac{a}{x_n}\right) |
| \sqrt[3]{a} | x^3 - a | \frac{1}{3}\left(2x_n + \frac{a}{x_n^2}\right) |
| \frac{1}{a} | \frac{1}{x} - a | x_n(2 - a x_n) |
| Solve g(x) = h(x) | g(x) - h(x) | x_n - \frac{g(x_n) - h(x_n)}{g'(x_n) - h'(x_n)} |
The reciprocal row is a nice curiosity: it computes \frac{1}{a} using only multiplication and subtraction, which is how some computer chips actually perform division.
Why Newton's method converges so fast
Near a simple root (one where f'(r) \neq 0), the error after a step is roughly proportional to the square of the error before it. If you are off by 0.01, the next step is off by something on the order of 0.0001, then 0.00000001. That is exactly the doubling of correct digits you saw with \sqrt{2}.
The reason is that the tangent line matches the function's value and slope at x_n, so the only error comes from curvature, the second-order term. This connects directly to linear approximation: Newton's method is linear approximation used as a search tool.
Practice Newton's method until it feels routine
Newton's method rewards careful, organized work: set up f and f', pick a sensible start, and iterate without rounding too soon. The best way to get fast and accurate is to run through a few iterations on different functions and see the convergence happen for yourself. Try the interactive lesson below, where every tangent line question gives instant feedback and shows you exactly where a calculation went wrong.
Practice it now
Tangent lines at work
Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.
Practice this lesson