# secant method

The secant method which is similar to the Newton-Raphson method is used to find the extremum  value for a function over an interval for which the defined function has only one extremum. If there is more then one minimum or maximum, then convergence is not guaranteed.

 $x_{k}=x_{k}-f^{\prime}(x_{k})\frac{x_{k}-x_{k-1}}{f^{\prime}(x_{k})-f^{\prime}% (x_{k-1})}$
 $f(x)=x^{2}+1$

taking the derivative yields

 $f^{\prime}(x)=2x$

So for the initial guesses of $x_{0}=3$ and $x_{1}=5$, $x_{2}$, the first iteration evaluates to

 $x_{2}=5-f^{\prime}(x_{1})\left[\frac{5-3}{f^{\prime}(x_{1})-f^{\prime}(x_{0})}\right]$

The derivatives at these two points are

 $f^{\prime}(x_{1})=10$
 $f^{\prime}(x_{0})=6$

giving us the value for the first iteration of

$x_{2}=0$.

To check when we are done iterating, we need one more iteration for comparison, so

 $x_{3}=x_{2}-f^{\prime}(x_{2})\left[\frac{0-5}{f^{\prime}(x_{2})-f^{\prime}(x_{% 1})}\right]$

which is

$x_{3}=0$

Since $x_{3}-x_{2}=0$, we are done and our extremum is $0$.

Not every function is so easy to iterate analytically and we must resort to numerical means. The attached file, \PMlinktofilesecantMethod1.msecantMethod1.m, shows how to iterate using matlab on the more complicated function

 $f(x)=x\sqrt{100-x^{2}}$

One still must be careful when using the secant method since the above function has a maximum and a minimum on the interval of [-10,10] and you will not get convergence if your initial guesses are -2 and 2. However, on the interval of [0,10], there is only one extremum, so choose guesses of 5 and 6. Then the matlab function converges to the extremum of

$5*\sqrt{2}=7.0711$

which is a maximum as the figure below shows