The The Intermediate Value Theorem promises a root of a continuous $f$ wherever $f(a)$ and $f(b)$ have opposite signs. Bisection turns that promise into an algorithm: keep cutting the interval in half, always keeping the half where the sign changes.
- Start with $[a, b]$ where $f$ is continuous and $f(a)f(b) < 0$.
- Compute the midpoint $m = \frac{a + b}{2}$ and $f(m)$. If $f(m) = 0$, stop.
- If $f(m)$ has the same sign as $f(a)$, replace $a$ by $m$; otherwise replace $b$ by $m$.
- Repeat until the interval is as short as you need.
Idea clave
Por qué funciona
Ejemplo resuelto: Three steps by hand
- $f(1) = -2 < 0$ and $f(2) = 1 > 0$: there is a root in between ($\sqrt{3}$).
- $m = 1.5$: $f(1.5) = -0.75 < 0$, so keep $[1.5, 2]$.
- $m = 1.75$: $f(1.75) = 0.0625 > 0$, so keep $[1.5, 1.75]$.
- $m = 1.625$: $f(1.625) \approx -0.36 < 0$, so keep $[1.625, 1.75]$.
- Its midpoint $1.6875$ is within $\frac{1}{2^{4}} = 0.0625$ of the root; in fact $\sqrt{3} - 1.6875 \approx 0.045$.
Respuesta: $[1.625, 1.75]$
Ejemplo resuelto: How many steps?
- We need $\frac{1}{2^{n+1}} \le 10^{-6}$, that is, $2^{n+1} \ge 10^{6}$.
- $2^{19} = 524{,}288$ is too small and $2^{20} = 1{,}048{,}576$ is enough, so $n + 1 = 20$.
- $n = 19$ steps, known in advance, whatever $f$ is.
Respuesta: $19$
Ejemplo resuelto: A sign change that is not a root
- The signs differ, so bisection runs, and the midpoints close in on $1.5708\ldots = \frac{\pi}{2}$.
- But $\tan x$ is not continuous on $[1, 2]$: it has a vertical asymptote at $\frac{\pi}{2}$, where it jumps from $+\infty$ to $-\infty$.
- Check the result: $|f(m)|$ grows as the interval shrinks. At a real root it would shrink.
Respuesta: to the asymptote $\frac{\pi}{2}$, not a root
Error común