You are on page 1of 13

Numerical Methods for High school kids-

Secant Method

N K Srinivasan Ph D

Introduction
There are several algebraic equations that cannot be
solved easily,by factorization or applying any formula:
Consider the equation of the form:
f(x) =0
where f(x) = x
2
-2 =0
The solution is ,of course, the square root of 2, which
your calculator gives in a flash of a second.
Often we use trial-error or guess work methods, using
"successive approximation".
We start with an approximate root of the equation, that
is, guess the values of x for which f(x) is pretty close
to zero. Then improve upon this value of x by some
means...usually an "iterative ' or repeated procedure.


Such numerical methods or schemes are called
"algorithms" for numerical computation.
Successive Approximation
Let us illustrate this with respect to f(x)= x
2
-2 =0.
If we take the root as x= 1.5, we get
f(x) = 2.25 -2 =0.25
Therefore x= 1.5 is close to the root , but slightly
higher than the actual root.
[Note that square root of 2 is an irrational number that
troubled Pythagoras and his school of mathematicians in
Ancient Greece.]
Sqrt(2) = 1.414213562......]
Now we can try the next guess as x = 1.4.
Then we get f(x) = 1.96 - 2 = -0.04
f(x) is pretty close to zero and f(x) is negative now.
Therefore we can infer that the sqrt(2) lies between
x=1.4 and x=1.5 .
You must keep in mind that f(1.4) is negative and f(1.5)
is positive and therefore there is a value of x ,in
between 1.4 and 1.5, such that f(x) is exactly equal to


zero.!
[This is a 'bracketing method' --the root lies between
the intervals x=1.4 and x= 1.5 or x:[1.4,1.5] ]

Secant Method

There are two powerful methods for solving such problems
called :
1'Secant method ' or 'regula falsi' method and
2 Newton -Raphson method .
Since Newton-Raphson method involves the use of
calculus, I am not discussing it here. If you had
studied calculus in advanced classes, you can easily
learn this method which involves 'differential
calculus.'
Both the methods are iterative methods which means that
you repeat the numerical calculations using a formula,
"iterative formula" ,by ploughing back the approximate
answer again into the formula to get better result.[In
fact the term "iteration" means "plough back" in Latin.]


One math historian claims that the secant method is
known for nearly 3000 years!

Secant method is easy to derive because it uses the
linear interpolation or use of a straight line
relationship for the function f(x) near the root.


Recall the "Point-slope formula" for a straight line.
If there is a point (x1,y1) on a straight line with
slope m, then the equation for the straight line is just
this:
y = y1 + m (x-x1)
If we have the straight line equation, we can find all
the points on the straight line by plugging any value of
x.
For secant method , we find two points on the curve
f(x); call it :
x=a , f(x) = f(a)
and x=b , f(x)= f(b).


[It is better if f(a) and f(b) are of opposite signs;
that is, if f(a) is >0 or positive, f(b) is <0 or
negative or vice Versa. Then this method is called
"regula -falsi" or'false position ' method; but this
need not be always necessary.!!Both f(a) and f(b) may be
of the same sign]
We join the two points by a straight line and the
equation of this line is as follows:'Slope ' is 'raise
over run , as you learn in algebra course.
Slope = m = [f(b) - f(a)]/ (b-a) -------------(1)

Taking one of the points ,say (a, f(a)) as (x1,y1)
we get the straight line formula using the "point-slope
formula":
y = y1 + m( x1-x)
y = f(x) = f(a) + {[f(b) - f(a)]/(b-a)} [x-a } ----(2)
To find the solution for f(x) =0.
Let y=0 in the above equation(2).
-f(a)[b-a] = [ f(b)-f(a)](x-a)
Expanding we get:


-f(a)b + f(a)a = -a.f(b) + a f(a) + x.f(b) -xf(a)
Canceling the term 'af(a)' on both sides and regrouping
like terms:
- b f(a) = -a f(b) + x [f(b) - f(a)]
Rearranging again, we get:
x [ f(b) - f(a)] = a f(b) - b f(a)
or
x = x* = [a f(b) - b f(a)]/ [ f(b) - f(a)] ------(3)
This is our final equation for finding the root x* for
which f(x) will be close to zero.

Note that we have used a linear interpolation or
straight line formula for the two points (a,f(a)) and
(b,f(b)) on the curve of f(x) and this is indeed an
approximation. This line is the "chord" on the curve and
so this method is also called "chord method".
Therefore x* is the approximate root and f(x*) will not
be zero, but close to zero.
We can repeat the procedure taking x* as x=a or x=b and
using the formula all over again.


Example 1
Solve f(x) = x
2
-2 =0
Let the initial guess points be:
a=1.4 f(a) = 1.96-2 = -0.04;
b = 1.5 f(b) = 2.25 -2 = 0.25
Note that f(a) and f(b) are of opposite signs.
Using the secant method formula (3)
x* = [1.4 x 0.25 - 1.5 x (-0.04)]/(0.25 +0.04)
= (0.35 + 0.06)/ 0.29 = 0.41/0.29

x* = 1.4138
The calculator gives: sqrt(2) = 1.4142135
The error = 1.4142135 - 1.4138 = 0.0004135
Note that we get the result accurate to three
decimal places [three zeros] in one trial.
Second iteration
Let us iterate with a = 1.4138 and b = 1.45
a= 1.4138 f(a) = -0.001169


b = 1.45 f(b) = 0.1025
Applying secant formula:
x* = [1.4138 x 0.1025 -
1.45(-0.001169)]/0.103669
= [0.1449145 + 0.001695]/0.103669
= 1.414207719
Error = 1.414213561 - 1.414207719
= 0.00000584337
The value is accurate to 5 decimal places.
Note that we find the root to a high degree of accuracy
in just two iterations.
Rate of convergence or speed
The rate of convergence to the actual root or the 'speed
of the method is computed from the error reduction after
each iteration.
Note that in this example ,error was e1 = 0.0004135
in the first iteration and error e2 = 0.00000584 in the
second iteration.
With each iteration, we are adding two more zeros after


the decimal point in the error.
The rate of convergence is said to be of the order of
1.618 for secant method. This is interesting because
"1.618" is the Golden ratio and is also connected to
Fibonacci series.!
In advanced books ,you will find the proof for this rate
of convergence .
[Comparison with Newton_Raphson method: Newton_Raphson
formula, using Calculus, gives you a method with rate of
convergence equal to 2. Therefore N-R method is only
'slighly faster' than Secant method .Furthermore the
secant method is easy to apply with two function
evaluations.
Newton-Raphson method has an inherent limitation : if
the first derivative is close to zero, NR method will
not converge , but the root oscillate or move away from
the actual root! Such problems do not arise in secant
method...Secant method is far safer to use.]
Further since we use computers with a software for
routine work, the rate of convergence is of academic


interest these days...One more iteration is hardly time
consuming or difficult with computer software.

Example 2
Isaac Newton invented the Newton-Raphson method and used
it to solve this equation:
x
3
- 2x -5 =0
in the year 1669.
The root is near 2.0.
Let us solve the problem with secant method using
a= 2.0 and b = 2.1.
Let a = 2 f(a) = 8 - 4-5 = -1
b = 2.1 f(b) = 9.261 - 4.2 -5 = 0.061
Note that f(a) and f(b) are of opposite signs.
Using the equation (3)
x* = [ 2(0.061) - 2.1(-1] / 1.061
= 2.222/1.061 = 2.09425
Let us do one more iteration:

a= 2.094 f(a) = 9.1851449 - 4.188 -5 = -0.0028551


b = 2.1 f(b) = 0.061
x* = [ 2.094 (0.061) - 2.1(-0.0028551)]/0.063855
= [0.127734 + 0.0059957]/0.063855
= 0.1337297/0.063855 = 2.094271396
-----------------------------------------------

Exercises

1 Find the cube root of 9 using the secant method:
f(x) = x
3
-9 =0 .
Hint : use the initial guesses: a =2 b= 2.2
2 Compare secant method with bisection method [given in
another article.]
3 In the year 1225 CE, Fibonacci or Leonardo of Pisa
solved the equation:
x
3
+ 2 x
2
+ 10 x -20 =0 .
Solve this by secant method; the root lies near 1.37.
[Note: we do not know the method used by Fibonacci at
that time.]
4 Solve x.e
x
= 2 . The root lies near x=0.8


5 Solve x.tanx = 1 The root lies near 0.5

6 An environment engineer uses the following equation
for oxygen concentration in a water stream from a river
affected by effluents discharged into the river:
C = 10 -15 [ exp (-0.1x) - exp(0.5x)]
where x is the distance in miles.
Find the distance at which C = 4 .
Hint: Take the initial guesses as x= 8 and x= 12 miles.
-----------------------------------------
References
1 F B Hildebrand--- Intro to Numerical Analysis --Dover
pub
2 R W Hamming ---Numerical methods for scientists and
engineers --Dover pub
[Both these books are classics in this field and a
serious student can learn much from them.]
3 Numerical recipes in C , C++ etc W H Press et
al--Cambridge Uni Press.-- a cook book with simplified
code for software--very useful for practical, applied


math /computer science students.
4 N K Srinivasan Numerical methods for engineering--CBS
publishers, New Delhi.
5 Steven Chapra-- Applied Numerical Analysis with
Matlab.Mc Graw Hill---Easy to follow college level
textbook with Matlab codes...
6 C F Gerald and P O Wheatley --Applied Numerical
Analysis--Pearson pub--[An easy and well explained
standard text book.]

-----------------------------------------

You might also like