Secant Method Calculator
Find a root using two estimates and no derivative.
What it does
The secant method is a root finding technique that uses a line through two points on the function to estimate where it crosses zero. It can be viewed as Newton's method with the derivative replaced by a divided difference.
University of Waterloo numerical analysis notes explain that this trade removes the need for derivative code but gives up the guaranteed convergence of bracket methods.
McGill University lecture slides give the iteration formula and show the geometric idea: the next estimate is where the secant line through the last two points meets the x axis.
This tool offers three built in functions, two starting estimates and an iteration count. It reports the final estimate, the residual and the number of steps.
If the two function values become equal, the division fails and the tool reports an error rather than producing a misleading answer.
How to use
- Choose one of the three built in functions.
- Enter two starting estimates, preferably near the root.
- Enter the number of iterations, up to 200.
- Read the root estimate in the main result.
- Check the residual to judge accuracy.
- Try a different pair of starting points if the iteration fails.
Formula
- x(n-1), x(n)
- The two most recent estimates.
- f
- The function whose root is sought.
- divided difference
- The slope of the line through the last two function values.
- residual
- Magnitude of f at the final estimate.
The engine stops early when the residual is below 1e-12. It rejects a step where the two function values are equal within 1e-14.
Worked example
Example: x³ - x - 2
Starting estimates 1 and 2 with 10 iterations.
- f(1) = -2 and f(2) = 4, so the two points lie on opposite sides of the root.
- The secant line through them crosses the x axis at about 1.3333.
- Later steps use the two most recent estimates and converge quickly.
- After 10 iterations the estimate is 1.5213797068.
- The residual is effectively zero to the displayed precision.
- The tool reports root 1.5213797068 and iterations 10.
Reference table
| Step | Estimate | Residual |
|---|---|---|
| 0 | 1.000000 | -2.000000 |
| 1 | 2.000000 | 4.000000 |
| 2 | 1.333333 | -0.962963 |
| 10 | 1.5213797068 | near zero |
Limits
- Only the three built in functions are available.
- The method is not guaranteed to converge on every function.
- Equal consecutive function values cause an error.
- Results are shown to ten decimal places.
Common mistakes
- Expecting a bracket guarantee, which this method does not have.
- Starting with two points where f has nearly equal values.
- Assuming faster convergence always beats bisection reliability.
- Using too many iterations when the residual is already tiny.
- Confusing the secant method with the method of false position.
Try it yourself
Quick checks. Answers sit tucked under each question.
What does the secant method use in place of a derivative?
A divided difference between the last two function values.
How many starting values does it need?
Two.
What is the root of x³ - x - 2?
About 1.5213797068.
Questions
What is the secant method?
A root finding method using a secant line through two points.
How is it related to Newton's method?
It replaces the derivative with a divided difference.
Does it always converge?
No. Unlike bisection it can fail for poor starting values.
Why use it?
It converges faster than bisection when no derivative is available.
What is false position?
A related method that keeps a bracket while using a secant step.
Does the tool need a derivative input?
No.