Newton's Method Calculator
Find a root of a cubic polynomial with Newton's tangent line iteration.
What it does
Newton's method, also called the Newton-Raphson method, finds a root of an equation by repeatedly improving a guess. At each step it draws the tangent line to the curve at the current guess and takes the place where that line crosses the x axis as the next guess.
The iteration is x next = x - f(x) / f'(x). It comes from writing the tangent line equation and solving for its zero. Because the curve and its tangent agree at the starting point, the new guess is usually much closer to the true root when the function is well behaved there.
This page applies the method to a cubic polynomial a x³ + b x² + c x + d = 0. The derivative is 3a x² + 2b x + c, which is easy to evaluate at every step. The tool prints the final estimate, the absolute residual and the full list of iterates.
Convergence is fast but not guaranteed. A starting guess near a turning point can make the derivative almost zero, sending the next guess far away. The engine stops with a clear error if the derivative vanishes or the values stop being finite.
A cubic has at least one real root. Different starting guesses can lead to different roots, so trying more than one guess is a good way to check whether you have found the one you need.
How to use
- Enter the four coefficients of a x³ + b x² + c x + d = 0. The a coefficient cannot be zero.
- Type a starting guess. A value close to the root you expect gives the fastest convergence.
- Choose how many iterations to run, from 1 to 20.
- Read the root estimate and its residual, which is the absolute value of f at the final estimate.
- Open the note under the tool to inspect every iterate and see how quickly the values settled.
- If the tool reports a zero derivative or divergence, pick a different starting guess.
Formula
- f(x)
- The cubic polynomial whose zero is being sought.
- f'(x)
- The derivative of the cubic, giving the slope of the tangent line.
- x(n)
- The current estimate at iteration n.
- x(n+1)
- The next estimate, where the tangent line crosses the x axis.
- residual
- The absolute value of f at the final estimate, a measure of accuracy.
The engine evaluates the cubic with nested multiplication, which is (a x + b) x + c all multiplied by x and added to d. It checks the derivative before dividing, so a zero slope produces an error message instead of an infinity. Results are shown to six decimal places and the residual to eight.
Worked example
Example: the cube root of 27
Solve x³ - 27 = 0 starting from x = 5. Here a = 1, b = 0, c = 0, d = -27, with 5 iterations.
- The function is f(x) = x³ - 27 and its derivative is f'(x) = 3x².
- Starting value x0 = 5 gives f(5) = 98 and f'(5) = 75.
- First step: x1 = 5 - 98 / 75 = 3.693333.
- Second step uses f(3.693333) about 23.380 and f'(3.693333) about 40.902, giving x2 = 3.122012.
- The next iterates are x3 = 3.004706 and x4 = 3.000007.
- Fifth step gives x5 = 3.000000 with a residual below 0.00000001.
- The tool reports Root 3.000000, Absolute residual 0.00000000 and 5 steps completed.
Reference table
| Step | Estimate x | f(x) |
|---|---|---|
| 0 | 5.000000 | 98.000000 |
| 1 | 3.693333 | 23.3800 |
| 2 | 3.122012 | 3.4301 |
| 3 | 3.004706 | 0.12727 |
| 4 | 3.000007 | 0.00019892 |
| 5 | 3.000000 | 0.00000000048851 |
Limits
- The tool handles a cubic only. Higher degree polynomials need their own derivative and a different engine.
- A starting guess at a turning point can make the derivative zero and stop the iteration.
- Convergence can be slow or chaotic for roots that are very close together.
- The displayed root is a floating point estimate, not an exact algebraic expression.
Common mistakes
- Entering a = 0, which makes the polynomial quadratic and invalid for this tool.
- Forgetting that b, c and d can be negative and entering them as positive numbers.
- Choosing a starting guess exactly where the derivative is zero, such as x = 0 for x³ - 27.
- Assuming more iterations always help when the guess is already within display precision.
- Reading the residual as the error in x. It is the error in the function value.
Try it yourself
Quick checks. Answers sit tucked under each question.
For x³ - 27 with x0 = 5, what is the first iterate?
3.693333. The calculation is 5 - 98 / 75.
What is f'(x) for x³ - 27?
3x². At x = 5 the slope is 75.
After five iterations the estimate is 3.000000. What is the residual?
0.00000000 to eight decimal places. The actual value of f is about 4.9 x 10^-10.
Questions
What is Newton's method used for?
Finding numerical solutions to equations that are hard or impossible to solve exactly, including polynomials like the cubic on this page.
How many iterations do I need?
Often five or fewer when the guess is close. Watch the residual: once it stops shrinking at the displayed precision, more steps add little.
Why did I get a derivative error?
Your starting guess or an iterate landed where 3a x² + 2b x + c is zero. Move the guess away from a turning point.
Can the method find more than one root?
Yes. Each real root has its own basin of starting guesses, so run the tool again with a different guess to look for another.
Is this the same as the secant method?
No. The secant method approximates the derivative from two points, while Newton's method uses the exact derivative at one point.
Does the tool use exact arithmetic?
No. It uses ordinary floating point numbers, which is why the answer is shown as a decimal estimate with a residual.