A numerical root finder approximates a value \(x^\*\) where a function becomes zero:
\[
f(x^\*)=0.
\]
Many equations cannot be solved easily by exact algebraic methods, so numerical methods
build a sequence of approximations that gets closer and closer to a root.
1. What a root means
A root, zero, or solution of \(f(x)=0\) is an \(x\)-value where the graph crosses or touches
the horizontal axis. For example, if:
\[
f(x)=x^3-x-2,
\]
then one root is approximately:
\[
x\approx1.521.
\]
This means:
\[
f(1.521)\approx0.
\]
2. Bisection method
The bisection method is a safe bracketing method. It starts with an interval \([a,b]\)
where \(f(a)\) and \(f(b)\) have opposite signs.
\[
f(a)f(b)<0.
\]
If \(f\) is continuous, a root must exist somewhere between \(a\) and \(b\).
The midpoint is:
\[
m=\frac{a+b}{2}.
\]
Then we check the sign of \(f(m)\).
\[
\begin{cases}
\text{keep }[a,m], & \text{if } f(a)f(m)<0,\\
\text{keep }[m,b], & \text{if } f(m)f(b)<0.
\end{cases}
\]
The interval is cut in half at every step, so bisection is reliable but usually slower
than Newton-Raphson or the secant method.
3. Bisection example
For:
\[
f(x)=x^3-x-2,
\]
choose \([1,2]\):
\[
f(1)=-2,\qquad f(2)=4.
\]
Because the signs are opposite, a root lies between \(1\) and \(2\).
The first midpoint is:
\[
m=\frac{1+2}{2}=1.5.
\]
Then:
\[
f(1.5)=1.5^3-1.5-2=-0.125.
\]
Since \(f(1.5)\) is negative and \(f(2)\) is positive, the root is in:
\[
[1.5,2].
\]
4. Newton-Raphson method
Newton-Raphson uses a tangent line. Starting from an initial guess \(x_n\),
the next approximation is:
\[
x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}.
\]
The method is often very fast when the initial guess is close to the root.
However, it can fail if the derivative is zero, very small, or if the starting point
is poorly chosen.
5. Numerical derivative
If the derivative is not entered directly, it can be approximated by a symmetric difference:
\[
f'(x)\approx\frac{f(x+h)-f(x-h)}{2h}.
\]
Here \(h\) is a small number chosen relative to the size of \(x\).
6. Secant method
The secant method avoids computing a derivative. It starts with two guesses,
\(x_{n-1}\) and \(x_n\), then uses the slope of the secant line:
\[
\frac{f(x_n)-f(x_{n-1})}{x_n-x_{n-1}}.
\]
The update formula is:
\[
x_{n+1}
=
x_n
-
f(x_n)\frac{x_n-x_{n-1}}{f(x_n)-f(x_{n-1})}.
\]
The secant method often converges faster than bisection, but it is not guaranteed
to converge for every pair of starting values.
7. Stopping rules
A numerical method stops when the approximation is accurate enough. Common checks include:
\[
|f(x_n)|<\varepsilon
\]
and:
\[
|x_{n+1}-x_n|<\varepsilon.
\]
The number \(\varepsilon\) is the tolerance. Smaller tolerances require more accurate answers,
but they may require more iterations.
8. Residual
The residual is the size of the function value at the approximate root:
\[
\text{residual}=|f(x_{\text{approx}})|.
\]
A small residual means the approximation is close to satisfying \(f(x)=0\).
9. Multiple roots by scanning
To find several roots inside an interval, the calculator can scan many small subintervals.
If a sign change is detected, bisection is applied to that smaller interval.
This works well for roots that cross the x-axis. It may miss even-multiplicity roots,
where the graph touches the x-axis without changing sign.
10. Method comparison
11. Practical advice
- Use bisection when you can find an interval where the function changes sign.
- Use Newton-Raphson when you have a good starting guess and the function is smooth.
- Use the secant method when you have two good guesses but do not want to use a derivative.
- Always check the residual \(|f(x)|\), not only the displayed root.
- Use the graph to make sure the approximation matches the visible behavior of the function.
12. Common mistakes
- Using bisection without a sign change in the interval.
- Choosing a Newton starting point where the derivative is close to zero.
- Assuming every numerical approximation is an exact root.
- Stopping too early with a large tolerance.
- Expecting a sign-change scan to find roots where the graph only touches the x-axis.
- Entering unsupported function syntax or forgetting multiplication signs.
Key idea: numerical root finding creates a sequence of approximations, then stops when the residual
or step size is small enough for the requested tolerance.