You are on page 1of 5

DSE-1: Numerical Techniques-Unit-2

Bisection method: In mathematics, the bisection method is a root-finding


method that applies to any continuous functions for which one knows two values
with opposite signs. The method is applicable for numerically solving the
equation f(x) = 0 for the real variable x, where f is a continuous function defined on
an interval [a, b] and where f (a) and f (b) have opposite signs. By the intermediate
value theorem, the continuous function f must have at least one root in the interval
[a, b]. At each step the method divides the interval in two by computing the
midpoint c = (a+b)/2 of the interval and the value of the function f(c) at that point.
If f(c) = 0 then c is the root else there are now only two possibilities: either f(a)
and f(c) have opposite signs or f(c) and f (b) have opposite signs. The method
selects the new subinterval (a, b) such that f(a).f(b) < 0. In this way an interval that
contains a zero of f is reduced in width by 50% at each step. The process is
continued until the interval is sufficiently small. It is a very simple and robust method,
but is relatively slow.
Algorithm: The input for the method is a continuous function f, an interval [a, b] for
which f(a).f(b)<0, Each iteration performs the following steps:
a+b
1. Calculate C = the midpoint of the interval
2
2. Calculate the function value f(c) at the midpoint,
3. If convergence is satisfactory (i.e. |f(c)| is sufficiently small), return c and stop
iterating.
4. Examine the sign of f(c) and replace either a or b with c so that f(a).f(b)<0;
Goto step 1;

Example: Consider f(x) = x3 – x – 2 is a continuous function. Find a root of the given


polynomial f(x) correct upto 3 significant digits using the bisection method.
Solution: Now, f(1) = -2 which is -ve and f(2) = +4 which is +ve. So the root lies
between [1, 2].

Manas Ku Mishra, Asst. Prof. of Comp. Sc., FM (A) College, BLS. Page 1 of 5
Update for
Iteration a b c = (a+ b)/2 f(c) the next
iteration
1 1 2 1.5 −0.125 a=c
2 1.5 2 1.75 1.6093750 b=c
3 1.5 1.75 1.625 0.6660156 b=c
4 1.5 1.625 1.5625 0.2521973 b=c
5 1.5 1.5625 1.53125 0.0591125 b=c
6 1.5 1.53125 1.515625 −0.0340538 a=c
7 1.515625 1.53125 1.5234375 0.0122504 b=c
8 1.515625 1.5234375 1.5195313 −0.0109712 a=c
9 1.5195313 1.5234375 1.5214844 0.0006222 b=c
10 1.5195313 1.5214844 1.5205078 −0.0051789 a=c
After 10 iterations, it becomes apparent that there is a convergence to about
1.52 which is a root for the polynomial.
Regula−Falsi method: This
method is also known as false
position method. The regula
falsi method calculates solution
by joining the line segment between
the endpoints (a, b) for which
f(a).f(b)<0.

Using points (a, f(a)) and (b, f(b))

f(b) - f(a)
Slope = ---------(1)
b-a
Equating (1) and (2) we get,
Using points (c, 0) and (b, f(b)) f(b) - f(a) f(b) - 0
= -----------------(3)
b-a b-c
f(b) - 0
Slope = ------------(2)
b-c

Manas Ku Mishra, Asst. Prof. of Comp. Sc., FM (A) College, BLS. Page 2 of 5
(b – c)(f(b) – f(a)) = bf(b) – af(b)
 b(f(b) – f(a)) – c(f(b) – f(a)) = bf(b) – af(b)
–c(f(b) – f(a)) = bf(b) – af(b) – b(f(b) – f(a))
c(f(b) – f(a)) = –bf(b) + af(b) + b(f(b) – f(a))
c(f(b) – f(a)) = –bf(b) + af(b) + bf(b) - bf(a)
c(f(b) – f(a)) = af(b) – bf(a)
af(b) – bf(a)
 c=
f(b) – f(a)
At iteration number k, the number ck is calculated as above and then,
if f (ak) and f (ck) have the same sign, set ak + 1 = ck and bk + 1 = bk, otherwise set ak +
1 = ak and bk + 1 = ck. This process is repeated until the root is approximated
sufficiently well.
Example: Find a root of an equation f(x) = 2x3 - 2x - 5 using Regula-Falsi method.
Solution: Now, f(1) = -5 which is -ve and f(2) = +7 which is +ve. So the root lies
between [1, 2].
Update
(af(b) – bf(a)) for the
iteration a f(a) b f(b) c = f(c)
(f(b) – f(a)) next
iteration
1 1 –5 2 7 1.41667 –2.14699 a=c
2 1.41667 –2.14699 2 7 1.55359 –0.60759 a=c
3 1.55359 –0.60759 2 7 1.58924 –0.15063 a=c
4 1.58924 –0.15063 2 7 1.59789 –0.0361 a=c
5 1.59789 –0.0361 2 7 1.59996 –0.00858 a=c
6 1.59996 –0.00858 2 7 1.60045 –0.00203 a=c
7 1.60045 –0.00203 2 7 1.60056 –0.00048 a=c
So the root of the equation using False Position mehtod is 1.60056
Newton−Raphson method (or Newton’s method):

f '(xn) = f(xn) / (xn – xn+1) f(Xn)


∴ Xn+1 = Xn –
 (xn – xn+1) = f(xn) / f '(xn) f '(Xn)

Manas Ku Mishra, Asst. Prof. of Comp. Sc., FM (A) College, BLS. Page 3 of 5
Procedure:
Step-1: We find the interval (a, b) containing the solution (called root) of the equation
f(x) = 0 .
Step-2: Let x = x0 be initial guess or initial approximation to the equation f(x) = 0
Step-3: We use xn+1 = xn - [f(xn) / f΄(xn)] as the successive formula to find
approximate solution (root) of the equation f(x) = 0
Step-4: Then x1 , x2 , x3 ............ and so on are calculated and we will continue this
process till we get root of the equation f(x) = 0 up to desired accuracy.
Example: Use Newton−Raphson method to find the root of the function f(x) = x 2−10.
Solution: Now f(3) = -1 and f(4) = +6. So the root lies between [3, 4]
f’(x) = 2x;
 f(x) / f’(x) = (x2−10) / (2*x)
Let x0 = 3;
We know xn+1 = xn − f(xn) / f΄(xn)
x1 = 3 – (9 – 10) / 6 = 3 + 1 / 6 = 3.166667
x2 = 3.166667−(3.1666672−10) / (2 * 3.166667) = 3.162281
x3 = 3.162281−(3.1622812−10) / (2 * 3.162281) = 3.162278

Thus 3.162278 is the estimated root of the function.

Secant method: Unlike bisection


method or regula falsi method, secant
method does not require the root to be
bracketed (i.e. it does not check
f(a).f(b)<0) and hence it does not
always converge. But bisection
method and regula falsi method always
converge. The recurrence formula for
Secant method is same as that of the
regula falsi method.
In this method, the 3rd point is calculated from previous two points (1st and 2nd). The
1st point is discarded. The 2nd and 3rd points are considered as 1st and 2nd points for
the next iteration. Until the desired accuracy is achieved, the iteration continues.
The recurrence formula of the secant method can also be derived from the formula
for Newton's method.
xn+1 = xn - f(xn) / f′(xn)
When it is difficult to find the derivative of f(x) i.e. f’(x), by using the finite-
difference approximation f '(xn) can be replaced with (f(xn) - f(xn-1)) / (xn - xn-1).

Manas Ku Mishra, Asst. Prof. of Comp. Sc., FM (A) College, BLS. Page 4 of 5
So the formula for Secant method can be written as
f(xn)
xn+1 = xn –
[f(xn) - f(xn-1) ] / (xn - xn-1)
 xn+1 = xn - f(xn) * (xn - xn-1) / (f(xn) - f(xn-1))
 xn+1 = (xn * (f(xn) - f(xn-1)) - f(xn) * (xn - xn-1)) / (f(xn) - f(xn-1))
 xn+1 = (xn * f(xn) - xn * f(xn-1) - xn * f(xn) + xn-1 * f(xn)) / (f(xn) - f(xn-1))
 xn+1 = (xn-1 * f(xn) - xn * f(xn-1)) / (f(xn) - f(xn-1))

Let xn-1 = a, xn = b, and c = xn+1 Then,

af(b) – bf(a)
c= This formula is same as regula-falsi method.
f(b) – f(a)

Manas Ku Mishra, Asst. Prof. of Comp. Sc., FM (A) College, BLS. Page 5 of 5

You might also like