# Bisection method

This article is about a root-finding algorithm. See all root-finding algorithms

## Contents

## Definition

The **bisection method**, also called the **interval halving method**, **binary search method**, and **dichotomy method**, is a root-finding algorithm.

## Summary

Item | Value |
---|---|

Initial condition | works for a continuous function (or more generally, a function satisfying the intermediate value property) on an interval given that and have opposite signs. |

Iterative step | At stage , we know that has a root in an interval . We test at . We then define the new interval as the left half if the signs of at and oppose one another, and as the right half otherwise. |

Convergence rate | The size of the interval within which we are guaranteed to have a root halves at each step. The distance between the root and our "best guess" at any stage (say, the midpoint of the guaranteed interval) has an upper bound that halves at each step, so we have linear convergence. |

Computational tools needed | Floating-point arithmetic to compute averages Ability to compute the value of a function at a point, or more minimalistically, determine whether the value is positive or negative. |

Termination stage | We may terminate the algorithm based either on the size of the interval in the domain (i.e., we know that we are close to a root) or the closeness of the function value to zero. How we terminate depends on our goals. |

## Initial condition

The bisection method works for a continuous function (or more generally, a function satisfying the intermediate value property) on an interval given that and have opposite signs.

The bisection method can be used to find a root of a continuous function on a connected interval if we are able to locate two points in the domain of the function where it has opposite signs. We simply restrict the function to that domain and apply the method.

## Iterative step

Let .

At stage for a positive integer.

**Prior knowledge**:

- and are both numerically distinguishable from zero (so they have defined signs, positive or negative) and they have opposite signs.
- Combining that with the fact that is a continuous function, the intermediate value theorem tells us that has a root on .

**Iterative step**:

- Compute .
- If it is equal to (or numerically indistinguishable from) zero, then return as the root and terminate the algorithm.
- If has sign opposite to (and therefore the same as ), then choose and , so the new interval (for the next iteration) is .
- If has sign opposite to (and therefore the same as ), then choose and , so the new interval (for the next iteration) is .

## Convergence rate

### Rate of decline in guaranteed interval size

We have the relationship:

Thus, we obtain that:

In particular, the size of each interval is a linear multiple of the size of the preceding one, with a fixed constant of proportionality 1/2, and the overall interval size decays exponentially with . This fits the paradigm of linear convergence.

### Convergence rate for best guess point estimate

At stage , we can define our *best guess* as the midpoint .

The sequence converges to a root, say . We need to determine the rate of convergence.

The convergence is not necessarily *steady*: some steps could get us closer to the root than others, and some steps may move us farther from the root in absolute terms. Therefore, the appropriate notion of convergence rate should rely on the R-convergence idea: bound the error from above by a known sequence:

We know that:

Equivalently:

Thus, we can define a sequence:

Clearly, the sequence has linear convergence to zero, threfore the original sequence of point has R-linear convergence to zero.

## Computational tools needed

- We need to be able to compute halves of intervals. This is most easily done using floating-point binary arithmetic.
- We also need to be able to compute function values at particular points, and determine the signs of these values. Note that we do not care about computing the function value
*per se*but we do need reliable information about its size.

## Termination

### Domain-based termination

We may terminate the algorithm when the size of the interval within which a root is guaranteed has fallen below a certain pre-specified length . The number of steps for such termination can be predicted in advance as:

At this stage, we may return the interval or the midpoint, depending on the desired format of the answer.

### Output-based termination

We may terminate the algorithm once the value of the function at the midpoint is sufficiently close to zero.

The number of stages needed for such termination cannot be computed simply by knowing the length of the domain. However, if is differentiable and we have an upper bound on the magnitude of the derivative of , then we know that if we are within distance of the root on the domain, the absolute value of the function value is at most . We can therefore put an upper bound on the number of steps necessary.

## Selection of root found and sensitivity to interval choice

### This finds only one root, not all roots

It's worth noting that this process finds only one root, not all roots. Consider, for instance, the function:

on the interval . This is negative at 0 and positive at 6. At the midpoint 3, it is positive, so our first iteration picks the left half of the interval, namely . The process will then gradually converge to the root 1. The roots 4 and 5 get missed out. The reason they get missed out is that because an even number of them appeared in the test interval , we had the same sign of the function at both ends of the interval.

### The root found may transition as we move either endpoint of the interval

Consider a function:

Suppose we apply the bisection method to determine a root of on the interval where . Note that the sign of is negative at 0 and positive at , so the bisection method is applicable. However, *what* root it converges to depends on the value of . Explicitly:

- If , then the first iteration yields the interval , with , and therefore we converge to the root 1 (which is the only root in the interval).
- If , then the first iteration yields the interval , with , and therefore we converge to the root 5 (which is the only root in the interval).
- More generally, if for a nonnegative integer, we converge to the root 1. On the other hand, if for a nonnegative integer, we converge to the root 5.

### The process sacrifices smart use of information about the function for a guaranteed convergence rate

By always picking the midpoint, we may be ignoring valuable information about just how far from zero the values of the functions at the endpoints are. There are some other methods that are better suited to making use of this information. However, these methods either work only for some functions or take more of a "gamble": they could go more horribly wrong. The methods include:

## Sensitivity to the form in which the function is presented

### The qualitative behavior depends purely on the signum of the function

In order to determine how the bisection method works for a particular function , it suffices to know the function , i.e., the composite of the signum function and . Explicitly, the function that predicts the way the bisection method will unfold is the function:

Further, it is also invariant under the flipping of *all* signs. So it is dependent on the signum of the function, up to global sign.

From the computational perspective, there is an important caveat to the above: what matters for the signum function is not whether the actual value of is positive, negative, or zero, but rather, whether the value as computed is definitely positive, definitely negative, or numerically indistinguishable from zero.

Modulo this computational caveat, two functions that are positive at the same places and negative at the same places would exhibit the same behavior with respect to the bisection method. In particular, if , and behave identically under the bisection method.

### Invariance under scalar multiplication

The qualitative behavior of the bisection method (and in particular, the sequence of nested intervals obtained while running the method) is invariant under scalar multiplication of the function by a constant. In other words, the functions and , for a constant , behave the same way. This is modulo the caveat about numerical precision. Note, however, that given a particular function, multiplying it by a constant can never *improve* the precision (because we cannot get more information than already exists) so the key point remains that replacing the function by a scalar multiple doesn't help.

### Covariance under affine transformations on the domain

Consider a function and a a function for and . The functions behave the same way with respect to the bisection method, provided that we adjust the values of by the same scalar multiple. In other words, the nested intervals for the second function would correspond to the interval with endpoints at for an interval endpoint for the function . Note that in the case that is negative, the roles of left and right would also get switched.

## The case of polynomials

### Polynomials with distinct roots

Consider a polynomial of the form:

on an interval where has constant sign on the interval (and in particular, has no root) and . Also assume that is odd. Thus, the bisection method can be applied to the function .

In order to determine the value of for which the bisection method converges to , it suffices to know the values:

Moreover, one of the following must be true for the to which the bisection method converges:

- The quotient is a dyadic rational, i.e., it has the form for an integer and positive integer ,
**and**the bisection method terminates in finitely many steps at precisely . - is odd, so there are an even number of roots in the interval and an even number of roots in the interval ,
**and**the bisection method converges to the root but does not reach it in finitely many steps: The rationale for this case is that every time we narrow the interval, we discard either an even number of roots on the left or an even number of roots on the right.

### Polynomials with some root repetition

Consider a polynomial of the form:

on an interval where has constant sign on the interval (and in particular, has no root) and . Further, assume that and have opposite signs. This is equivalent to the assumption that is odd, or equivalently, that the number of s that are odd is odd.

It is still the case that the behavior can be predicted by knowledge of:

along with knowledge of the tuple . Moreover, one of the following must be true for the to which the process converges:

- The quotient is a dyadic rational, i.e., it has the form for an integer and positive integer ,
**and**the bisection method terminates in finitely many steps at precisely . - is odd, and the number of s, , with odd, is even (the latter is equivalent to requiring that the number of s, , with odd, is even)
**and**the bisection method converges to the root but does not terminate at it in finitely many steps.

Further, note the following: with the exception of the situation that the bisection method terminates in finitely many steps (and this can happen only if the relevant quotient is a dyadic rational) what matters is *only* the set of values for which is odd. We do not need to know the values of the s for which is even, nor do we know the values of the odd s themselves.