Bisection Method

Description

The bisection method is a root-finding method for numerically solving the equation f(x)=0f(x) = 0 for the real variable xx where the function is defined on an interval [a,b][a, b] and where f(a)f(a) and f(b)f(b) have opposite signs. According to the intermediate value theorem, ff must have at least one root in the interval (a,b)(a, b).

Each step, the interval is divided in two halves by computing the midpoint of the interval and the value of the function at that point, if it’s a root, the process stops there, otherwise the midpoint now becomes one of the ends of the range. The method continues until the root is found or the error is sufficiently small.

Algorithm

  1. Select the initial values of aa and bb, evaluate f(a)f(a) and f(b)f(b), select a tolerance of error epe_p.

  2. Calculate the midpoint of the interval:

    xR=a+b2x_R = \dfrac{a + b}{2}
  3. Determine if the root has been found or where does the root is:

    • If f(a)×f(xR)=0f(a) \times f(x_R) = 0, the root is xRx_R, the iteration stops
    • If f(a)×f(xR)>0f(a) \times f(x_R) \gt 0, the root is the interval (xR,b)(x_R, b)
    • If f(a)×f(xR)<0f(a) \times f(x_R) \lt 0, the root is the interval (a,xR)(a, x_R)
  4. Recalculate the midpoint

  5. Calculate the relative error, if it’s sufficiently small, the calculation stops, otherwise, continue:

    ep=xR(current)xR(previous)xR(current)×100e_p = |\dfrac{x_{R (current)} - x_{R (previous)}}{x_{R (current)}}| \times 100

Calculator