Many equations, such as \( x^3 - x - 2 = 0 \) or \( \cos x = x \), cannot be solved exactly with algebra. Numerical methods find approximate roots to any accuracy you need by repeating a simple rule. This guide explains the two most important root-finding methods, bisection and Newton–Raphson, with complete worked iterations.
The Root-Finding Problem
We want a value \( r \) with \( f(r) = 0 \). Both methods start from an initial guess or interval and produce a sequence of approximations \( x_0, x_1, x_2, \ldots \) that approach \( r \).
Locating a Root First
The Intermediate Value Theorem guarantees that if \( f \) is continuous on \( [a, b] \) and \( f(a) \) and \( f(b) \) have opposite signs, then there is at least one root between \( a \) and \( b \).
For \( f(x) = x^3 - x - 2 \):
$$ f(1) = 1 - 1 - 2 = -2, \qquad f(2) = 8 - 2 - 2 = 4 $$
The sign changes, so a root lies in \( [1, 2] \). We will find it with both methods.
The Bisection Method
Bisection repeatedly halves the interval and keeps the half where the sign change occurs.
Algorithm
- Start with \( [a, b] \) where \( f(a) f(b) < 0 \).
- Compute the midpoint \( m = \frac{a + b}{2} \) and \( f(m) \).
- If \( f(a) f(m) < 0 \), the root is in \( [a, m] \), so set \( b = m \). Otherwise set \( a = m \).
- Repeat until the interval is small enough.
Error Bound
After \( n \) steps the interval width is \( \frac{b - a}{2^n} \), so the midpoint is within half of that of the root. To guarantee an error below \( \varepsilon \), you need
$$ n > \log_2\left( \frac{b - a}{\varepsilon} \right) $$
Worked Example 1: Bisection
Find the root of \( f(x) = x^3 - x - 2 \) in \( [1, 2] \) using bisection.
| Step | Interval \( [a, b] \) | Midpoint \( m \) | \( f(m) \) |
|---|---|---|---|
| 1 | \( [1, 2] \) | 1.5 | \(-0.1250\) |
| 2 | \( [1.5, 2] \) | 1.75 | \( 1.6094 \) |
| 3 | \( [1.5, 1.75] \) | 1.625 | \( 0.6660 \) |
| 4 | \( [1.5, 1.625] \) | 1.5625 | \( 0.2522 \) |
| 5 | \( [1.5, 1.5625] \) | 1.53125 | \( 0.0591 \) |
| 6 | \( [1.5, 1.53125] \) | 1.515625 | \(-0.0341\) |
| 7 | \( [1.515625, 1.53125] \) | 1.5234375 | \( 0.0123 \) |
How each step was decided. In step 1, \( f(1.5) = 3.375 - 1.5 - 2 = -0.125 \) is negative, while \( f(2) > 0 \), so the root lies in \( [1.5, 2] \). In step 2, \( f(1.75) = 5.359375 - 1.75 - 2 = 1.609375 \) is positive, so the root lies in \( [1.5, 1.75] \). The same logic continues each row.
After 7 steps the root lies in \( [1.515625, 1.5234375] \), an interval of width \( \frac{1}{128} \approx 0.0078 \). So the root is about 1.52, correct to 2 decimal places. Bisection is reliable but slow: each step gains only one binary digit of accuracy.
The Newton–Raphson Method
Newton–Raphson uses the tangent line at the current guess. Where the tangent crosses the x-axis becomes the next guess:
$$ x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)} $$
When it works, it converges quadratically: the number of correct digits roughly doubles each step.
Worked Example 2: Newton–Raphson on the Same Equation
Solve \( x^3 - x - 2 = 0 \) starting from \( x_0 = 1.5 \).
Step 1: Differentiate.
$$ f(x) = x^3 - x - 2, \qquad f'(x) = 3x^2 - 1 $$
Step 2: First iteration.
$$ f(1.5) = -0.125, \qquad f'(1.5) = 3(2.25) - 1 = 5.75 $$
$$ x_1 = 1.5 - \frac{-0.125}{5.75} = 1.5 + 0.021739 = 1.521739 $$
Step 3: Second iteration.
$$ f(1.521739) \approx 0.002137, \qquad f'(1.521739) \approx 5.947070 $$
$$ x_2 = 1.521739 - \frac{0.002137}{5.947070} \approx 1.521739 - 0.000359 = 1.521380 $$
Step 4: Third iteration. \( f(1.521380) \approx 0.0000006 \), giving \( x_3 \approx 1.5213797 \).
The root is \( r \approx 1.521380 \) to 6 decimal places, reached in just 3 iterations. Bisection would need about 20 steps for the same accuracy.
Worked Example 3: Computing a Square Root
Newton–Raphson is how calculators find square roots. To find \( \sqrt{10} \), solve \( f(x) = x^2 - 10 = 0 \). Since \( f'(x) = 2x \),
$$ x_{n+1} = x_n - \frac{x_n^2 - 10}{2x_n} = \frac{1}{2}\left( x_n + \frac{10}{x_n} \right) $$
Start with \( x_0 = 3 \):
$$ x_1 = \frac{1}{2}\left(3 + \frac{10}{3}\right) = \frac{1}{2}\left(\frac{19}{3}\right) = \frac{19}{6} \approx 3.166667 $$
$$ x_2 = \frac{1}{2}\left(3.166667 + \frac{10}{3.166667}\right) = \frac{1}{2}(3.166667 + 3.157895) \approx 3.162281 $$
$$ x_3 \approx 3.162278 $$
The true value is \( \sqrt{10} = 3.16227766\ldots \), so \( x_3 \) is correct to 6 decimal places.
Comparing the Two Methods
| Feature | Bisection | Newton–Raphson |
|---|---|---|
| Needs | Sign-change interval | Derivative and a good guess |
| Speed | Slow (linear) | Fast (quadratic) |
| Reliability | Always converges | Can fail or diverge |
A common practical strategy is to use a few bisection steps to get close, then switch to Newton–Raphson to finish quickly.
Common Mistakes
- Starting Newton–Raphson where \( f'(x_0) \approx 0 \). The tangent is nearly flat and the next guess shoots far away.
- Using degrees instead of radians for trigonometric equations. Calculus formulas require radians.
- Rounding intermediate values too much. Keep at least two more decimal places than you need in the answer.
- Forgetting to check the sign change before starting bisection.
- Stopping too early. Stop when successive iterates agree to the required accuracy, and verify by checking the sign of \( f \) either side.
Key Takeaways
- A sign change of a continuous function on \( [a, b] \) guarantees a root inside.
- Bisection halves the interval each step: slow but guaranteed.
- Newton–Raphson uses \( x_{n+1} = x_n - f(x_n)/f'(x_n) \) and roughly doubles the correct digits each step.
- Newton–Raphson can fail with a poor starting value or a near-zero derivative.
- The root of \( x^3 - x - 2 = 0 \) is approximately 1.521380.
If you need help with numerical methods, iteration tables or a programming-based maths assignment, contact Amathify on WhatsApp or use the "Ask a Question" form. Our experts and PhD scholars will provide step-by-step solutions.
Stuck on a problem or assignment?
Our experts and PhD scholars solve maths, physics and chemistry — step by step.