The bisection method is a kind of bracketing methods which searches for roots of equation in a specified interval.
Assume f(x) is an arbitrary function of x as it is shown in Fig. 1.
Fig. 1. f(x), an arbitrary function of x
If f(x) is continuous and real in the interval from a to b and f(a).f(b) has negative sign then there is at least one real root between a and b.
Using this simple rule, the bisection method decreases the interval size iteration by iteration and reaches close to the real root. The brief algorithm of the bisection method is as follows:
Step 1: Choose a and b so that f(a).f(b)<0.
Step 2: Let c=(a+b)/2.
Step 3: If f(a).f(c)<0 then let b=c, else let a=c.
Step 4: if |a-b|<e then let root=(a+b)/2, else go to step 2.
Step 5: End.
e: Acceptable approximated error.
(Source Code in C++)