Bisection Method

The bisection method finds a root of a continuous function f by trapping it in an interval [a, b] where f(a) and f(b) have opposite signs. Each step cuts the interval in half at its midpoint and keeps the half where the sign still changes, so the error is at least halved every time.

Before this lesson: Intermediate Value Theorem and Absolute and Relative Error

The idea: trap the root and squeeze

Most equations, like x^3 + x - 3 = 0 or e^x = 3 - x, have no formula for their solutions. A root-finding method produces a sequence of numbers that closes in on a solution instead.

The bisection method is the simplest and safest one. If a continuous function is negative at one end of an interval and positive at the other, its graph must cross the x-axis somewhere in between. Check the sign at the midpoint: one of the two halves still has a sign change, so the root is trapped in that half. Repeat, and the trap keeps shrinking.

Because it only uses signs, bisection never loses the root. The price is speed: it gains about one binary digit of accuracy per step, which is slow next to methods that use slopes.

Graph of f(x) = x³ + x − 3 from x = 0.9 to 2.1, crossing the x-axis near x = 1.213. Below the graph, four brackets shrink toward the root: [1, 2], then [1, 1.5], then [1, 1.25], then [1.125, 1.25]. Each bracket is half as wide as the one before, and the root stays inside every bracket.
Each bisection step keeps the half of the bracket where f changes sign, so the root near 1.213 stays trapped.

Bisection method steps and error bound

Start with a function f that is continuous on [a, b] with f(a) and f(b) of opposite signs, so f(a)f(b) \lt 0.

  1. Find the midpoint c = \dfrac{a + b}{2}.
  2. Evaluate f(c). If f(c) = 0, stop: c is a root.
  3. If f(a) and f(c) have opposite signs, the root is in [a, c], so replace b with c. Otherwise it is in [c, b], so replace a with c.
  4. Repeat until the interval is short enough.

After n steps, the interval has width (b - a)/2^n. The nth midpoint c_n is within that distance of a root r:

|c_n - r| \le \frac{b - a}{2^n}

To guarantee an error of at most \varepsilon, solve (b - a)/2^n \le \varepsilon for n:

n \ge \log_2\!\left(\frac{b - a}{\varepsilon}\right)

A table with columns for a_n, b_n, the midpoint c_n, the sign of f(c_n) and the new interval keeps the work organized.

Bisection method examples

Example 1: Four iterations by hand

Use the bisection method on f(x) = x^3 + x - 3 over [1, 2] for four iterations. Give the final bracket and an error bound.

f(1) = 1 + 1 - 3 = -1

Check the left endpoint: negative.

f(2) = 8 + 2 - 3 = 7

Check the right endpoint: positive. By the intermediate value theorem, a root lies in [1, 2].

c_1 = \frac{1 + 2}{2} = 1.5

Find the first midpoint.

f(1.5) = 3.375 + 1.5 - 3 = 1.875

Evaluate: positive, the opposite sign of f(1), so keep [1, 1.5].

c_2 = \frac{1 + 1.5}{2} = 1.25

Find the next midpoint.

f(1.25) = 1.953125 + 1.25 - 3 = 0.203125

Positive, so keep [1, 1.25].

c_3 = \frac{1 + 1.25}{2} = 1.125

Find the next midpoint.

f(1.125) = 1.423828125 + 1.125 - 3 = -0.451171875

Negative, the same sign as f(1), so keep [1.125, 1.25].

c_4 = \frac{1.125 + 1.25}{2} = 1.1875

Find the next midpoint.

f(1.1875) \approx 1.674561 + 1.1875 - 3 = -0.137939

Negative, so keep [1.1875, 1.25].

|c_4 - r| \le \frac{2 - 1}{2^4} = 0.0625

Apply the error bound with n = 4.

naₙbₙcₙf(cₙ)New interval
1121.51.875 (+)[1, 1.5]
211.51.250.203125 (+)[1, 1.25]
311.251.125−0.451172 (−)[1.125, 1.25]
41.1251.251.1875−0.137939 (−)[1.1875, 1.25]

Answer: the root lies in [1.1875, 1.25], and c_4 = 1.1875 is within 0.0625 of it. The midpoint of the last bracket, 1.21875, is within 0.03125. The true root is 1.213411….

Example 2: How many iterations are needed?

How many bisection steps on [1, 2] guarantee that the midpoint is within 10^{-6} of the root?

\frac{2 - 1}{2^n} \le 10^{-6}

Require the error bound to be at most 10^{-6}.

2^n \ge 10^6

Multiply both sides by 2^n \cdot 10^6.

n \ge \log_2(10^6)

Take the base-2 logarithm of both sides (see logarithms).

\log_2(10^6) = \frac{\ln 10^6}{\ln 2} \approx 19.93

Use the change-of-base formula (see properties of logarithms).

n = 20

Round up: n must be a whole number.

2^{19} = 524288 \lt 10^6 \lt 2^{20} = 1048576

Check: 19 steps are not enough, 20 are.

Answer: 20 iterations. Each step adds one correct binary digit, so each decimal digit costs about \log_2 10 \approx 3.3 steps. The count depends only on the interval and the tolerance, not on f.

Example 3: Solving an equation with a stopping rule

Solve e^x = 3 - x with the bisection method. Stop when the bracket is narrower than 0.1, and give the midpoint as the estimate.

f(x) = e^x + x - 3

Move every term to one side, so the solutions are the roots of f.

f(0) = 1 + 0 - 3 = -2

Try x = 0: negative.

f(1) = e + 1 - 3 \approx 0.718282

Try x = 1: positive, so start with [0, 1].

f(0.5) \approx 1.648721 + 0.5 - 3 = -0.851279

Midpoint 0.5: negative, so keep [0.5, 1].

f(0.75) \approx 2.117000 + 0.75 - 3 = -0.133000

Midpoint 0.75: negative, so keep [0.75, 1].

f(0.875) \approx 2.398875 + 0.875 - 3 = 0.273875

Midpoint 0.875: positive, so keep [0.75, 0.875].

f(0.8125) \approx 2.253535 + 0.8125 - 3 = 0.066035

Midpoint 0.8125: positive, so keep [0.75, 0.8125].

0.8125 - 0.75 = 0.0625 \lt 0.1

The bracket is narrower than 0.1, so stop.

\frac{0.75 + 0.8125}{2} = 0.78125

Take the midpoint of the last bracket.

naₙbₙcₙf(cₙ)New interval
1010.5−0.851279 (−)[0.5, 1]
20.510.75−0.133000 (−)[0.75, 1]
30.7510.8750.273875 (+)[0.75, 0.875]
40.750.8750.81250.066035 (+)[0.75, 0.8125]

Answer: x \approx 0.78125, within 0.03125 of the solution. The true solution is 0.792059…, so the actual error is about 0.011.

Example 4: When bisection finds the wrong thing

Apply the bisection method to f(x) = \tan x on [1, 2], with x in radians. What happens?

\tan 1 \approx 1.557408, \quad \tan 2 \approx -2.185040

The endpoint signs differ, so bisection seems to apply.

c_1 = \frac{1 + 2}{2} = 1.5

Find the first midpoint.

\tan 1.5 \approx 14.101420

Positive, so keep [1.5, 2].

\tan 1.75 \approx -5.520380

Midpoint 1.75: negative, so keep [1.5, 1.75].

\tan 1.625 \approx -18.430863

Midpoint 1.625: negative, so keep [1.5, 1.625].

\tan 1.5625 \approx 120.532506

Midpoint 1.5625: |f(c_n)| is growing, not shrinking.

\frac{\pi}{2} \approx 1.570796

The brackets close in on \pi/2, where \tan x has a vertical asymptote.

Answer: there is no root in [1, 2]. The sign change comes from the asymptote at x = \pi/2, where \tan x is not continuous, and bisection converges to that point instead. Always check continuity first, and be suspicious when |f(c_n)| gets larger.

Example 5: Depth of water in a spherical tank (word problem)

A spherical tank has radius 2 m. When the water is h meters deep, the tank holds V(h) = \frac{\pi h^2(6 - h)}{3} cubic meters. Use four bisection steps on [1, 2] to estimate the depth when the tank holds 10 m³.

f(h) = \frac{\pi h^2 (6 - h)}{3} - 10

Set V(h) = 10 and subtract 10, so the depth is a root of f.

f(1) = \frac{5\pi}{3} - 10 \approx -4.764

Check h = 1: negative.

f(2) = \frac{16\pi}{3} - 10 \approx 6.755

Check h = 2: positive, so the depth is between 1 and 2 m.

f(1.5) = \frac{\pi (2.25)(4.5)}{3} - 10 \approx 0.603

Midpoint 1.5: positive, so keep [1, 1.5].

f(1.25) = \frac{\pi (1.5625)(4.75)}{3} - 10 \approx -2.228

Midpoint 1.25: negative, so keep [1.25, 1.5].

f(1.375) = \frac{\pi (1.890625)(4.625)}{3} - 10 \approx -0.843

Midpoint 1.375: negative, so keep [1.375, 1.5].

f(1.4375) = \frac{\pi (2.06640625)(4.5625)}{3} - 10 \approx -0.127

Midpoint 1.4375: negative, so keep [1.4375, 1.5].

\frac{1.4375 + 1.5}{2} = 1.46875

Take the midpoint of the last bracket as the estimate.

Answer: the depth is between 1.4375 m and 1.5 m, about 1.47 m, within 0.03125 m (about 3 cm). More steps give 1.4485 m.

Common mistakes

MistakeExample of the errorFix
Starting without a sign changeUsing [0, 2] for x^2 - 2x + 1, where f(0) = f(2) = 1Check that f(a) and f(b) have opposite signs before starting.
Keeping the wrong halff(1) \lt 0, f(1.5) \gt 0, but continuing with [1.5, 2]Keep the half whose endpoints have opposite signs: [1, 1.5].
Ignoring discontinuitiesBisecting \tan x on [1, 2] and reporting 1.5708 as a rootMake sure f is continuous on the interval, and check that f(c_n) gets small.
Rounding down the number of stepsUsing n = 19 when \log_2(10^6) \approx 19.93Always round up.
Using |f(c)| as the errorStopping because |f(c)| = 0.001A small |f(c)| doesn’t mean c is close to r. Use the bracket width (b - a)/2^n.
Mixing degrees and radiansEvaluating \tan 1.5 in degree modeUse radians unless the problem says degrees.

Related methods

Newton’s method

Newton’s method follows tangent lines and usually converges much faster, often doubling the number of correct digits each step. But it needs a derivative and a good starting guess, and it can fly off. A few bisection steps are a common way to get that starting guess.

Secant and false position methods

The secant method replaces the tangent line with a line through two points, and false position keeps the bracket of bisection but uses that line instead of the midpoint. Both come later in this unit.

Accuracy and round-off

Stopping tests use absolute or relative error: an absolute tolerance on the bracket width, or a relative one like (b - a)/|c| \lt \varepsilon when the root is large. Computers often find the midpoint as a + (b - a)/2, which stays inside [a, b] even after rounding.

Practice problems

  1. Do one bisection step for f(x) = x^2 - 7 on [2, 3]. What is the new interval?
  2. Do three bisection steps for f(x) = x^3 - 2x - 5 on [2, 3].
  3. How many steps on [0, 4] guarantee an error of at most 10^{-3}?
  4. What is the error bound for c_8 when bisection starts on [1, 3]?
  5. Can the bisection method be used for f(x) = x^2 - 2x + 1 on [0, 2]? Explain.
  6. The function f(x) = 1/x has f(-1) \lt 0 and f(1) \gt 0. Does it have a root in [-1, 1]?
  7. Do four bisection steps to solve \cos x = x on [0, 1] (radians).
  8. Do three bisection steps for f(x) = \ln x + x - 2 on [1, 2].
  9. How many steps on [2, 3] guarantee an error less than 5 \times 10^{-5}?
  10. A wooden ball of radius 1 ft floats with its bottom h ft below the water line, where h^3 - 3h^2 + 1.6 = 0. Do three bisection steps on [0, 2].
Show answers

1.

c = \frac{2 + 3}{2} = 2.5

Find the midpoint.

f(2.5) = 6.25 - 7 = -0.75

Negative, like f(2) = -3; f(3) = 2 is positive.

Answer: the new interval is [2.5, 3].

2.

f(2) = 8 - 4 - 5 = -1, \quad f(3) = 27 - 6 - 5 = 16

Check the signs: they differ.

f(2.5) = 15.625 - 5 - 5 = 5.625

Midpoint 2.5: positive, so keep [2, 2.5].

f(2.25) = 11.390625 - 4.5 - 5 = 1.890625

Midpoint 2.25: positive, so keep [2, 2.25].

f(2.125) = 9.595703125 - 4.25 - 5 = 0.345703125

Midpoint 2.125: positive, so keep [2, 2.125].

Answer: the root is in [2, 2.125]; c_3 = 2.125 is within 1/8 = 0.125 (the root is 2.094551…).

3.

\frac{4 - 0}{2^n} \le 10^{-3}

Set the error bound at most 10^{-3}.

2^n \ge 4000

Multiply both sides by 2^n \cdot 1000.

n \ge \log_2 4000 \approx 11.97

Take the base-2 logarithm.

Answer: 12 steps (2^{12} = 4096).

4.

\frac{3 - 1}{2^8} = \frac{2}{256} = 0.0078125

Apply (b - a)/2^n with n = 8.

Answer: |c_8 - r| \le 0.0078125.

5.

f(0) = 1, \quad f(2) = 4 - 4 + 1 = 1

Check the endpoint signs.

f(x) = (x - 1)^2 \ge 0

Factor (see perfect square trinomials).

Answer: no. The root x = 1 is a double root where f touches the axis without changing sign, so there is never a bracket with opposite signs.

6.

f(-1) = -1, \quad f(1) = 1

The signs differ.

Answer: no. 1/x is never 0; the sign change comes from the discontinuity at x = 0, so the intermediate value theorem doesn’t apply. Bisection would close in on 0.

7.

f(x) = \cos x - x;\; f(0) = 1, \; f(1) \approx -0.459698

Move x to the left side and check the signs.

f(0.5) \approx 0.877583 - 0.5 = 0.377583

Positive, so keep [0.5, 1].

f(0.75) \approx 0.731689 - 0.75 = -0.018311

Negative, so keep [0.5, 0.75].

f(0.625) \approx 0.810963 - 0.625 = 0.185963

Positive, so keep [0.625, 0.75].

f(0.6875) \approx 0.772835 - 0.6875 = 0.085335

Positive, so keep [0.6875, 0.75].

Answer: the solution is in [0.6875, 0.75]; the midpoint 0.71875 is within 0.03125 (true value 0.739085…).

8.

f(1) = 0 + 1 - 2 = -1, \quad f(2) \approx 0.693147

Check the signs: they differ.

f(1.5) \approx 0.405465 + 1.5 - 2 = -0.094535

Negative, so keep [1.5, 2].

f(1.75) \approx 0.559616 + 1.75 - 2 = 0.309616

Positive, so keep [1.5, 1.75].

f(1.625) \approx 0.485508 + 1.625 - 2 = 0.110508

Positive, so keep [1.5, 1.625].

Answer: the root is in [1.5, 1.625] (true value 1.557145…).

9.

\frac{3 - 2}{2^n} \lt 5 \times 10^{-5}

Set the error bound below the tolerance.

2^n \gt 20000

Solve for 2^n.

n \gt \log_2 20000 \approx 14.29

Take the base-2 logarithm.

Answer: 15 steps (2^{14} = 16384 is too small; 2^{15} = 32768 works).

10.

f(0) = 1.6, \quad f(2) = 8 - 12 + 1.6 = -2.4

Check the signs: they differ.

f(1) = 1 - 3 + 1.6 = -0.4

Midpoint 1: negative, the opposite of f(0), so keep [0, 1].

f(0.5) = 0.125 - 0.75 + 1.6 = 0.975

Midpoint 0.5: positive, so keep [0.5, 1].

f(0.75) = 0.421875 - 1.6875 + 1.6 = 0.334375

Midpoint 0.75: positive, so keep [0.75, 1].

Answer: h is in [0.75, 1], about 0.875 ft, within 0.125 ft (the root is 0.865862… ft).

Bisection method FAQ

What is the bisection method?

It is a root-finding method that repeatedly halves an interval where a continuous function changes sign, keeping the half that still contains a sign change. The midpoints converge to a root.

Does the bisection method always converge?

Yes, if f is continuous on [a, b] and f(a) and f(b) have opposite signs. It may converge to any one of several roots in the interval, and it can’t find roots where the graph touches the axis without crossing.

How many iterations does the bisection method need?

To guarantee an error of at most \varepsilon on [a, b], you need n \ge \log_2((b - a)/\varepsilon) steps, rounded up. For example, 20 steps shrink an interval of length 1 below 10^{-6}.

Is the bisection method faster than Newton’s method?

No. Bisection converges linearly, halving the error each step, while Newton’s method usually converges quadratically near a simple root. Bisection’s advantage is that it can’t fail once a valid bracket is found.

Summary

  • Bisection needs a continuous f and an interval [a, b] with f(a)f(b) \lt 0.
  • Each step: find c = (a + b)/2, then keep the half where the sign changes.
  • After n steps, |c_n - r| \le (b - a)/2^n.
  • To reach a tolerance \varepsilon, take n \ge \log_2((b - a)/\varepsilon) steps, rounded up.
  • It always converges with a valid bracket, but slowly; check continuity so you don’t trap an asymptote.

Previous lesson: Loss of Significance

Next lesson: Fixed-Point Iteration

Back to the Numerical Methods Index