The bisection method finds a root by repeatedly halving an interval in which the function changes sign. It is slow, but it always works.
Algebraic and Transcendental Equations
An equation f(x) = 0 is algebraic if f is a polynomial, such as x³ − x − 1 = 0. It is transcendental if f contains functions such as sin x, eˣ or log x, as in x − cos x = 0. A value r with f(r) = 0 is a root. Polynomials of degree five and more, and most transcendental equations, have no formula for their roots, so we use iterative methods, which start from a guess and improve it step by step until it is accurate enough.
Principle of the Method
The method rests on the intermediate value theorem: 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. The bisection method takes the midpoint c = (a + b)/2 and evaluates f(c). If f(c) = 0, c is the root. Otherwise the root lies in the half where the sign changes: if f(a) × f(c) < 0, the new interval is [a, c], else it is [c, b]. The process is repeated until the interval is small enough.
Definition: Bisection method. An iterative method that finds a root of a continuous function by repeatedly halving an interval at whose ends the function has opposite signs.
Algorithm and Convergence
- Choose a and b with f(a) × f(b) < 0. 2. Compute c = (a + b)/2. 3. If f(a) × f(c) < 0, set b = c, else set a = c. 4. Repeat until |b − a| is less than the required tolerance. Each step halves the interval, so after n steps the error is at most (b − a)/2ⁿ. To get an error below ε, about log₂((b − a)/ε) steps are needed. The method always converges for a continuous function with a sign change, but it converges slowly (linearly), gaining about one binary digit per step. It cannot find roots where the function touches the axis without changing sign.
Table 3.2: Merits and limits of bisection
| Feature | Bisection | Note |
|---|---|---|
| Convergence | Always, if sign changes | Guaranteed |
| Speed | Slow (linear) | One bit per step |
| Needs | Two points with opposite signs | No derivative |
| Fails | Double roots without sign change | e.g. (x − 1)² |
Example 3.2: Bisection on a cubic
Problem: Find a root of x³ − x − 1 = 0 between 1 and 2 by four steps of bisection.
Solution:
- f(1) = −1, f(2) = 5. Signs differ.
- c = 1.5, f(1.5) = 0.875 > 0, so the root is in [1, 1.5].
- c = 1.25, f(1.25) = −0.297 < 0, so the root is in [1.25, 1.5].
- c = 1.375, f(1.375) = 0.225 > 0, so the root is in [1.25, 1.375].
- c = 1.3125, f(1.3125) = −0.052 < 0, so the root is in [1.3125, 1.375].
Result: After four steps the root lies in [1.3125, 1.375]. The true root is about 1.3247.
f = lambda x: x**3 - x - 1
a, b = 1.0, 2.0
for i in range(1, 16):
c = (a + b) / 2
if f(a) * f(c) < 0:
b = c
else:
a = c
if i <= 4 or i == 15:
print(i, round(c, 6))
Output
1 1.5
2 1.25
3 1.375
4 1.3125
15 1.324738
Common mistakes
- Starting with an interval where f(a) and f(b) have the same sign.
- Updating the wrong end of the interval.
- Expecting bisection to be fast. It is reliable but slow.
Key takeaways
- Bisection needs f(a) and f(b) of opposite signs.
- Each step halves the interval, so the error after n steps is at most (b − a)/2ⁿ.
- It always converges, but slowly.
- It does not need the derivative.
Practice questions
- On what theorem is the bisection method based?
- What is the maximum error after n steps from [a, b]?
- Give one limitation of the bisection method.
Answers to the practice questions
- The intermediate value theorem.
- (b − a)/2ⁿ.
- It converges slowly (also, it cannot find roots without a sign change).
Sources
- Official BCA syllabus Mathematics Foundations to Computer Science II, course code 25BCA402DS01, Unit III
