Secant Method Calculator

Use this Secant Method Calculator to enter values, adjust options, and review results in a compact responsive workspace.

Results are calculated automatically as you enter data.

Enter a function and two starting guesses.

Formula and interpretation
Root estimate -

▼ See explanations and tips below ▼

What Is the Secant Method?

The secant method is a numerical way to estimate a root of an equation. A root is an input value where a function equals zero, so the goal is to find an \(x\) such that:

$$ f(x) = 0 $$

Many equations do not have a simple algebraic solution, or the exact solution may be inconvenient to find by hand. The secant method helps by building a sequence of better approximations. It starts with two guesses, draws a straight line through the two corresponding points on the function, and uses the place where that line crosses the \(x\)-axis as the next guess.

The method is called derivative-free because it does not require an exact formula for \(f'(x)\). That makes it useful when differentiating the function is difficult, unavailable, or not worth the extra work.


Why the Secant Method Matters

Root finding appears throughout algebra, calculus, engineering, physics, statistics, finance, and computer science. Whenever a problem can be written as “make this expression equal to zero,” a root-finding method may be useful.

The secant method matters because it sits between two common approaches:

  • It is usually faster than simple bracketing methods such as bisection when it converges well.
  • It avoids the explicit derivative required by Newton’s Method.
  • It uses only the two most recent estimates, so each new step is relatively simple.
  • It helps students see the connection between geometry, algebra, and numerical approximation.

The tradeoff is reliability. The secant method is not guaranteed to converge for every function or every pair of starting guesses. A good result depends on the shape of the function, the starting values, the tolerance, and the stopping conditions.


Key Terms to Know

  • Root: A value of \(x\) where \(f(x)=0\).
  • Starting guesses: The first two values, usually written as \(x_0\) and \(x_1\), used to begin the method.
  • Secant line: A straight line passing through two points on a curve.
  • Iteration: One repeated step of the method.
  • Root estimate: The current approximation to the root.
  • Residual: The size of the function value at the current estimate, usually written as \(\left|f(x)\right|\).
  • Step error: The size of the latest change in the estimate, such as \(\left|x_{n+1}-x_n\right|\).
  • Tolerance: The threshold used to decide when an approximation is close enough.
  • Convergence: The process of estimates moving toward a stable answer.
  • Divergence: The process of estimates moving away from a useful answer or failing to settle.

How the Secant Method Works

The secant method uses the idea that a curve can often be approximated locally by a straight line. If you know two current points on the function curve,

$$ (x_{n-1}, f(x_{n-1})) \quad \text{and} \quad (x_n, f(x_n)), $$

you can draw the secant line through them. The point where that line crosses the \(x\)-axis becomes the next estimate, \(x_{n+1}\).

The update formula is:

$$ x_{n+1} = x_n - \dfrac{f(x_n)(x_n-x_{n-1})}{f(x_n)-f(x_{n-1})} $$

Where:

  • \(x_{n-1}\) is the previous estimate.
  • \(x_n\) is the current estimate.
  • \(x_{n+1}\) is the next estimate.
  • \(f(x_n)\) and \(f(x_{n-1})\) are the function values at the two most recent estimates.

The denominator,

$$ f(x_n)-f(x_{n-1}), $$

is important. If the two function values are equal or nearly equal, the secant line is horizontal or almost horizontal. In that case, the next step can be undefined, extremely large, or numerically unreliable.

Relationship to Newton’s Method

Newton’s Method uses the tangent line at one point:

$$ x_{n+1}=x_n-\dfrac{f(x_n)}{f'(x_n)} $$

The secant method replaces the derivative with a finite-difference slope based on two points:

$$ f'(x_n) \approx \dfrac{f(x_n)-f(x_{n-1})}{x_n-x_{n-1}} $$

Substituting that approximation into Newton’s Method gives the secant update. This is why the secant method often behaves like a derivative-free cousin of Newton’s Method.


Examples of the Secant Method in Practice

Example 1: Estimating \(\sqrt{2}\)

To estimate \(\sqrt{2}\), solve:

$$ x^2-2=0 $$

Use the starting guesses \(x_0=1\) and \(x_1=2\).

Step Estimate \(x_n\) Function value \(f(x_n)\)
\(0\) \(1\) \(-1\)
\(1\) \(2\) \(2\)
\(2\) \(1.333333\) \(-0.222222\)
\(3\) \(1.400000\) \(-0.040000\)
\(4\) \(1.414634\) \(0.001190\)
\(5\) \(1.414211\) \(-0.000006\)

The estimates move toward:

$$ \sqrt{2} \approx 1.41421356 $$

The important lesson is not just the final number. The table shows how each pair of recent points produces the next estimate, and how the residual tends to shrink as the estimate improves.


Example 2: Solving \(\cos(x)-x=0\)

A common fixed-point-style equation is:

$$ \cos(x)-x=0 $$

Use the starting guesses \(x_0=0.5\) and \(x_1=1\).

Step Estimate \(x_n\) Function value \(f(x_n)\)
\(0\) \(0.500000\) \(0.377583\)
\(1\) \(1.000000\) \(-0.459698\)
\(2\) \(0.725482\) \(0.022698\)
\(3\) \(0.738399\) \(0.001149\)
\(4\) \(0.739087\) \(-0.000003\)
\(5\) \(0.739085\) approximately \(0\)

The result is near:

$$ x \approx 0.739085 $$

This example shows why the method can be efficient when the function is smooth and the starting guesses are reasonably placed.


Example 3: When the Secant Step Breaks Down

Distinct starting guesses do not guarantee a valid secant step. For example, let:

$$ f(x)=x^2+1 $$

Choose \(x_0=-1\) and \(x_1=1\). Then:

$$ f(-1)=2 $$

and

$$ f(1)=2 $$

The denominator in the secant formula becomes:

$$ f(x_1)-f(x_0)=2-2=0 $$

That means the secant line is horizontal, so it does not provide a usable \(x\)-intercept. This is one reason a status message matters: a displayed estimate is only meaningful when the method has made valid progress.


How to Interpret the Result

The root estimate is the calculator’s best current approximation of the \(x\)-value where the entered function is close to zero. If your \(x\) values represent a physical quantity, the root estimate has the same units as your starting guesses. If the problem is purely mathematical, the value is unitless.

The residual, \(\left|f(x)\right|\), tells you how close the final estimate makes the function value to zero. A smaller residual usually means the estimate satisfies the equation more closely.

The last error is the latest step size:

$$ \left|x_{n+1}-x_n\right| $$

This is not the same as the exact error from the true root. The true root is usually unknown, so the step size is only a practical stopping signal.

A result should be read together with the status message. Except for an exact zero, a converged status means both the normalized residual and the relative latest step are within the requested tolerance. A warning or early-stop message means the displayed value is only the final available estimate, not a confirmed root.

The iteration table shows the numerical history of the method. It is useful for checking whether the estimates are settling down, oscillating, growing, or stopping because of a numerical problem.

The graph gives a geometric view of the same process. Each secant line connects two recent points, and its \(x\)-intercept becomes the next estimate.

The optional Newton’s Method comparison is only a benchmark from the second starting guess. It does not change the secant method result.


Common Mistakes and Misconceptions

One common mistake is entering the whole equation instead of only the expression in \(x\). For example, enter x^3 - 6*x + 2, not f(x)=x^3 - 6*x + 2 or y=x^3 - 6*x + 2.

Another mistake is using the same value for both starting guesses. The secant method needs two distinct \(x\) values to form a line.

Do not assume that the method always converges. The secant method can fail when the starting guesses are poorly chosen, the function is not smooth near the root, the denominator becomes too small, or the estimates move into invalid values.

Be careful with tolerance. A very loose tolerance can stop too early, while an extremely tight tolerance can lead to unnecessary iterations or floating-point limits. This calculator requires both a scale-aware residual check and a relative step check, so a small step alone cannot confirm convergence.

Do not confuse residual with exact error. A small residual means \(f(x)\) is close to zero, but it does not always prove that \(x\) is close to the true root, especially for flat or ill-conditioned functions.

For trigonometric functions, use radians. For example, \(\sin(\pi/2)=1\) uses radians, not degrees.

Use decimal points rather than comma decimal notation. Scientific notation such as 1e-3 is supported; a standalone e represents Euler’s constant.


When to Use the Secant Method

Use the secant method when:

  • You need to solve an equation that can be written as \(f(x)=0\).
  • You can evaluate the function but do not want to calculate its derivative.
  • You have two reasonable starting guesses.
  • You want a faster open method than bisection, while accepting less guaranteed reliability.
  • You are studying numerical methods and want to compare derivative-free and derivative-based root finding.

For high-stakes work, the secant method should be only one part of the checking process. Verify the residual, inspect the iteration behavior, and compare with another method when the result affects money, safety, engineering design, health, legal obligations, or official records.


Limitations and Things to Keep in Mind

The secant method is an open method, which means it does not necessarily keep the root bracketed between two endpoints. This can make it fast, but it also means convergence is not guaranteed.

The method can stop or fail when:

  • The two starting guesses are identical or nearly identical.
  • The function values at the two recent points are equal or nearly equal.
  • A step produces a non-finite value.
  • The update or function evaluation becomes non-finite.
  • Scaled residuals and relative steps keep increasing, or the estimates enter a cycle.
  • The maximum iteration count is reached before convergence.

This calculator works with real-valued functions of one variable, \(x\). It does not handle complex roots, multiple variables, inequalities, conditionals, piecewise definitions, or functions requiring multiple arguments.

Supported function names include common functions such as sin, cos, tan, sqrt, abs, exp, ln, and log. Here, ln means natural logarithm, and log means base-10 logarithm.

The calculator uses floating-point arithmetic, so very small differences, very large values, and nearly horizontal secant lines can be affected by rounding. Displayed results are rounded for readability, but nonzero values retain scientific notation instead of being silently shown as zero. Extra displayed digits do not guarantee extra mathematical certainty.

The maximum iteration input must be an integer from 1 to 80, and tolerance must be between 1e-14 and 0.1. Invalid values are rejected rather than silently rounded or clamped. If the iteration limit is too low, the method may stop before reaching the requested tolerance.


How to Use This Calculator

  1. Enter the function as an expression in \(x\), such as x^3 - 6*x + 2 or cos(x) - x.
  2. Enter the first starting guess, \(x_0\).
  3. Enter the second starting guess, \(x_1\). It must be different from the first.
  4. Enter a positive tolerance.
  5. Enter the maximum number of iterations. The calculator uses an integer value within its allowed range.
  6. Optionally enable the Newton’s Method comparison.
  7. Calculate the result, or use step and animation controls to inspect the iteration sequence.
  8. Review the root estimate, status, residual, last error, iteration table, graph, and comparison result.

Frequently Asked Questions

Does the secant method require a derivative?

No. The secant method estimates the needed slope from two function values. That is why it is useful when Newton’s Method would require a derivative that is difficult or inconvenient to compute.


Are the two starting guesses supposed to bracket the root?

Not necessarily. The secant method can work even when the root is not between the two starting guesses. However, unlike bracketing methods, it does not guarantee that the root remains trapped between the current points.


What does a small residual mean?

A small residual means the final estimate makes \(\left|f(x)\right|\) close to zero. This is usually a good sign, but it should be considered together with the status message, the step size, and the behavior of the iteration table.


Is the last error the exact error?

No. The last error is the size of the most recent step, \(\left|x_{n+1}-x_n\right|\). It is a useful stopping indicator, but it is not the exact distance from the true root unless the true root is already known.


Why might the secant method fail?

It can fail if the starting guesses are poor, if the function values become equal or nearly equal, if the function is not well behaved near the root, or if the estimates diverge. Trying different starting guesses or comparing with a bracketing method can help diagnose the problem.


Sources and References

Books

  1. Tobin A. Driscoll and Richard J. Braun. Fundamentals of Numerical Computation. Society for Industrial and Applied Mathematics, 2017. Chapter 4, “Roots of nonlinear equations,” Section 4.4, “Interpolation-based methods.” Online Python edition.
  2. Jeffrey R. Chasnov. Numerical Methods. Mathematics LibreTexts / Hong Kong University of Science and Technology. Chapter 2, “Root Finding,” Section 2.3, “Secant Method.” LibreTexts page.

Online and Educational Sources

  1. Eric W. Weisstein. “Secant Method.” Wolfram MathWorld, accessed July 4, 2026. Wolfram MathWorld page.
  2. John T. Foster. “Nonlinear Equation Root Finding.” Numerical Methods and Programming, University of Texas at Austin / Jupyter Book, accessed July 4, 2026. Course page.