# Thread: bisection root algorithm

find the root of f(x)=2x^3-x^2+x-1=0 to 3 decimal places using interval bisection.

2. Originally Posted by bobby77
find the root of f(x)=2x^3-x^2+x-1=0 to 3 decimal places using interval bisection.
First sketch the graph to locate the approximate position of the root.
See attachment:

Now we see the root is located at about $x=0.7$. Now we need
a pair of values $x_{lo}, x_{hi}$ such that $x_{lo} such that

$sgn(f(x_{lo}) \ne sgn(f(x_{hi})$.

It looks as though $0.6, 0.8$ will do for these (check).

Now we need a table:

Code:
    x_lo     x_hi     f(x_lo)     f(x_hi)     x_mid     f(x_mid)
0.6      0.8      -0.328      0.184      0.7         -0.104
This is the first row, the next row is obtained by replacing $x_{lo}$ or $x_{hi}$ by $x_{mid}$, so that we
still bracket the zero, thus:

Code:
    x_lo     x_hi     f(x_lo)     f(x_hi)     x_mid     f(x_mid)
0.6      0.8      -0.328      0.184      0.7         -0.104
0.7      0.8      -0.104      0.184      0.75        0.0312
0.7      0.75     -0.104      0.0312     0.725      -0.0385
and so on utill $|x_{hi}-x_{lo}|<0.001$.

RonL