Solution (source code)

= Solution
{c}

The <bisection method> begins with a finite interval $[a,b]$ on which the continuous function has opposite signs at its endpoints. The <intermediate value theorem> guarantees a root inside. Evaluate at the midpoint $m=(a+b)/2$. If $f(m)=0$, stop. Otherwise retain the half whose endpoints have opposite signs and repeat. An endpoint that is already a root is returned immediately. The nested intervals retain a root and their lengths halve, so their midpoints converge to a root.