Root Approximation  Bisection
Root approximation through bisection is a simple method for determining the root of a function. By testing different \(x\)values in a function, the root can be gradually found by simply narrowing down the range of the function's sign change.
Contents
The Algorithm
Below is a graph of the function \(x^{2}+2x1.\)
In order to find the root between \([0, 2]\), for example, \(x\)values can be plugged into the function starting with the original domain:
\[\begin{align} f(0)&=0^{2}+2(0)1\\&= 1\\\\ f(2)&= 2^{2}+2(2)1\\&= 7. \end{align}\]
Because the function is continuous and there is a sign change, by intermediate value theorem, there must be a root between \((0,2)\). The midpoint between every domain is halved until the approximation becomes sufficiently close. In the previous example, the domain can be narrowed down through the midpoint, i.e. \(\frac{x_{1}+x_{2}}{2}\):
\[\begin{align} f(1)&=1^{2}+2(1)1\\&= 2\\\\ f(0.5)&=0.5^{2}+2(0.5)1\\&= 0.25\\\\ f(0.25)&=0.25^{2}+2(0.25)1\\&= 0.4375. \end{align}\]
The root has been established to lie within (0.25, 0.5). Bisection can be further continued:
\[\begin{align} f(0.375)&=0.375^{2}+2(0.375)1\\&= −0.109\\\\ f(0.4375)&=0.4375^{2}+2(0.4375)1\\&= 0.06640625. \end{align}\]
Now, the root's domain lies somewhere within (0.375, 0.4375). Bisection can be continued as precision dictates.
Given that the function \(f(x)=2x^{3}+x^{2}2x+1\) has a root between 0 and 2, find the root to one decimal place.
First we evaluate the function at both intervals:
\[f(0)=1,\quad f(2)=7.\]
Now we bisect and repeat:
\[\begin{align} f(1)&=2\\ f(1.5)&=0.5\\ f(1.25)&=1.156\\ f(1.375)&=0.441. \end{align}\]
We know the root lies somewhere between 1.5 and 1.375. Taking the midpoint, \(\frac{1.5+1.375}{2}=1.4375\). So we know the value to 1 decimal place of the root between 0 and 2 of the equation \(2x^{3}+x^{2}2x+1\) is \(1.4.\ _\square\)
Implementation
Here is a Python implementation of the algorithm:
1 2 3 4 5 6 7 8 9 

Now we could run it like this, for example:
1 2 
