Secant Method Calculator for Polynomial Roots
Enter a real polynomial and two starting values to estimate one of its real roots with the secant method. The results show every update along with the step size, residual, and checks that prevent a small step from being treated as a root by itself.
Estimated root1.521379707
- Residual |f(x)|
- 1.820766e-14
- Absolute step error
- 1.180307e-9
- Relative step error
- 7.758137e-8%
- Iterations
- 7
- Observed convergence order
- 1.629199224
- Convergence status
- Converged
Iteration table
| n | xₙ₋₁ | xₙ | f(xₙ₋₁) | f(xₙ) | xₙ₊₁ | Absolute step | Relative step | Residual |
|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 2 | -2 | 4 | 1.333333333 | 0.6666666667 | 50% | 0.962962963 |
| 2 | 2 | 1.333333333 | 4 | -0.962962963 | 1.462686567 | 0.1293532338 | 8.843537415% | 0.3333388748 |
| 3 | 1.333333333 | 1.462686567 | -0.962962963 | -0.3333388748 | 1.531169432 | 0.06848286498 | 4.472585694% | 0.05862641771 |
| 4 | 1.462686567 | 1.531169432 | -0.3333388748 | 0.05862641771 | 1.520926421 | 0.01024301163 | 0.6734718713% | 0.002693300202 |
| 5 | 1.531169432 | 1.520926421 | 0.05862641771 | -0.002693300202 | 1.521376317 | 0.0004498961545 | 0.02957165492% | 0.00002015019239 |
| 6 | 1.520926421 | 1.521376317 | -0.002693300202 | -0.00002015019239 | 1.521379708 | 0.000003391315128 | 0.0002229105009% | 7.015478e-9 |
| 7 | 1.521376317 | 1.521379708 | -0.00002015019239 | 7.015478e-9 | 1.521379707 | 1.180307e-9 | 7.758137e-8% | 1.820766e-14 |
Convergence requires both the combined absolute and relative step limit and the residual limit.
The displayed root is a real root estimate for the selected polynomial only.
How to use this calculator
- Choose whether the polynomial is quadratic, cubic, or quartic, then enter coefficients down to the constant term.
- Enter two different starting values near the real root you want to investigate.
- Set step and residual tolerances to match the precision that matters for your problem.
- Read the convergence status and the final residual before relying on the estimated root.
- Use the iteration table to check whether the estimates are settling, oscillating, or moving toward another root.
How the secant method finds a polynomial root
For the selected degree m, the calculator evaluates f(x) = a₀ + a₁x + a₂x² + ... + aₘxᵐ. A root is an x-value where that polynomial is zero. Starting from two different estimates, the secant method draws the line through (xₙ₋₁, f(xₙ₋₁)) and (xₙ, f(xₙ)), then uses that line's x-intercept as the next estimate.
The update is:
xₙ₊₁ = xₙ − f(xₙ) × (xₙ − xₙ₋₁) ÷ (f(xₙ) − f(xₙ₋₁))
Unlike Newton's method, this does not require entering or differentiating the polynomial. Unlike bisection, the two starting values do not have to surround a sign change. That freedom can be useful, but it means the path can leave the interval, settle on a different root, or fail to settle at all.
How this calculator decides whether it converged
Every update reports the absolute step Aₙ₊₁ = |xₙ₊₁ − xₙ|, the relative step Rₙ₊₁ = Aₙ₊₁ ÷ max(1, |xₙ₊₁|), and the residual Fₙ₊₁ = |f(xₙ₊₁)|. It declares convergence only when the step satisfies Aₙ₊₁ ≤ T_abs + T_rel × |xₙ₊₁| and the residual is at most T_res.
That second check matters. A sequence can take a very small step because the secant line has become nearly horizontal, while the polynomial value is still not close to zero. The calculator also stops with a warning if the two function values make a zero or numerically indistinguishable secant denominator.
What changes the result most
The two starting values influence which root the method reaches and whether it reaches one. Values near a simple real root usually behave better than distant guesses. A repeated root often converges more slowly, and coefficient rounding can change a nearly multiple root substantially. The observed convergence order uses the last three usable step sizes; near a well-behaved simple root it may approach about 1.618, but it is only a diagnostic, not a guarantee.
What this calculator leaves out
This tool works with real quadratic, cubic, and quartic polynomials only. It does not find complex roots, prove that every real root has been found, choose starting values for you, or replace a bracketing method when a guaranteed real-root interval is required. Its arithmetic uses ordinary floating-point numbers, so precision near machine limits is limited.
Worked example
For f(x) = x³ − x − 2, select a cubic and enter coefficients 1, 0, −1, and −2 for the x³ through constant terms. With starting values 1 and 2, the first secant update is x₂ = 2 − 4 × (2 − 1) ÷ (4 − (−2)) = 1.333333333.
The following updates move through about 1.462686567, 1.531169432, and 1.520926421 before settling at approximately 1.521379707. With all three default tolerances set to 1e-8, the calculator reports convergence only once the step and |x³ − x − 2| are both small enough.
Common questions
What is the secant method?
The secant method is an iterative way to approximate a zero of a function. It uses the line through the two most recent function values to estimate the next x-intercept, so it does not need an explicit derivative.
How should I choose the two starting values?
Choose two distinct values reasonably near the real root you want. A sign change between them can be a useful clue that a root lies between them, but the secant method does not preserve that bracket and can still move outside it.
Does the secant method require the starting values to bracket a root?
No. It can start from any two distinct real values for which the polynomial can be evaluated. Bisection, in contrast, needs a sign-changing bracket and keeps that bracket, which makes it more conservative.
Why can the secant denominator become zero?
The update divides by the difference between the two function values. When those values are equal or too close relative to floating-point precision, the secant line is effectively horizontal and its x-intercept cannot be calculated reliably.
Why is the observed order not exactly 1.618?
The usual order near a simple root is asymptotic, meaning it describes behavior only after the iterates are already close to the root. Early steps, rounded arithmetic, repeated roots, and unsuitable step ratios can all make a short-run estimate differ substantially.
What is the difference between step error and residual?
The step error measures how much the estimate changed from the previous iteration. The residual measures how close the polynomial value is to zero at that estimate. A reliable stopping rule checks both because either one alone can be misleading.