Submitted ByMr. Arun Kumar Singh
(MCA 2nd SEM) (Bisection method or Bolzano method)

Introduction –
This method is based on the repeated application of intermediate value property or theorem.
If we know that a root of f(x) =0 lies in the interval I0= (a0, b0), we bisect I0 at the point
M1=(a0+b0)/2.denote by I1 the interval (a0,m1) if f(a0)*f(m1)<0 or the interval (m1,b0) if f(m1)*f(b0)<0.
Therefore the interval I1 also contain the root .we bisect the interval I1 and get subinterval I2 at whose end point f(x) takes the value of f(x) takes the value of opposite sign and therefore contain the root .continuing this procedure ,we obtain a sequence of nested sets of sub interval .

Simplification—
Let the function be continuous between a and b .For definiteness, let f (a) be (-) and f (b) be (+) .then the first approximation to the root is –
X1=1/2(a+b).
If f(x1)=0,then x1 is a root of f(x)=0 otherwise ,the root lies between a and x1 or x1 and b according as f(x1) is (+)ve or (-)ve .then we bisect the interval as before and continue the process until the root is found to desired accuracy .
In the adjoining figure, f(x1) is (+) ve so that the root lies between a and x1. Then second approximation to the root is x2=1/2(a+x1).
If f(x2) is (-)ve; the root is lies between x1 and x2 .then the third approximation to the root is x3=1/2(x1+x2) and so on.



Program—
Bisection method through the ‘C’

#include<stdio.h>
#include<conio.h>
#include<math.h>
float funx (float x)
{
float s;
s=((x*x*x)-(5*x)+1);
return(s);
}
//main function */
void main()
{
float x1, x2, x3,eps,max;
int i;
clrscr();
printf("enter the initial interval\n");
scanf("%f%f",&x1,&x2);
printf("the value of possible error epsilon");
scanf("%f",&eps);
max=(log(x2-x1)-log(eps))/log(2);
for(i=0;i<max;i++)
{
x3=(x1+x2)/2;
if(funx(x1)*funx(x3)<0)
x2=x3;
else
x1=x3;
printf("function value is =%f\n",funx(x3));
printf("root is =%f\n",x3);
}
getch();

}

Output of the program

Enter the initial interval
0
1
the value of possible error epsilon.01
function value is =-1.375000
root is =0.500000
function value is =-0.234375
root is =0.250000
function value is =0.376953
root is =0.125000
function value is =0.069092
root is =0.187500
function value is =-0.083282
root is =0.218750
function value is =-0.007244
root is =0.203125
function value is =0.030888
root is =0.195312



Question—
Perform five iteration of the bisection method to obtain the smallest positive root of the equation.
F(x) = x3-5x+1=0
Solution
Since f(0)>0 and f(1)<0,the smallest positive root lies in the interval (0,1).
Taking a0=0 and b0=1, we get
m1`=(a0+b0)/2
m1=(0+1)/2
m1=0.5
f(m1)=-1.375
now we check the condition f(a0)*f(m1)<0
thus ,the root lies in the interval (0,0.5).Tking a1=0,b0=0.5
We get
m2=(a1+b1)/2
m2=(0+0.5)/2
m2=0.25
f(m2)=f(0.25)=-0.234375 and f(a1)*f(m2)<0.
Thus the root lies in the interval (0, 0.25). the sequence of interval is given in follows—

K ak-1 bk-1 mk f(mk)*f(ak-1)
__
1 0 1 0.5 < 0
2 0 0.5 0.25 < 0
3 0 0.25 0.125 > 0
4 0.125 0.25 0.1875 > 0
5 0.1875 0.25 0.21875 < 0


Hence the root lies in (0.1875, 0.21875).the approximation root is taken as the midpoint of this interval, that is 0.203125.