**Secant method** is also a recursive method for finding the root for the polynomials by successive approximation. It’s similar to the** Regular-falsi **method but here we don’t need to check **f(x _{1})f(x_{2})<0** again and again after every approximation. In this method, the neighbourhoods roots are approximated by secant line or chord to the function

**f(x)**. It’s also advantageous of this method that we don’t need to differentiate the given function

**f(x)**, as we do in

**Newton-raphson**method.

**Figure –**Secant Method

Now, we’ll derive the formula for secant method. The equation of Secant line passing through two points is :

Here, m=slope

So, apply for **(x _{1}, f(x_{1})) **and

**(x**

_{0}, f(x_{0}))Y - f(x_{1}) = [f(x_{0})-f(x_{1})/(x_{0}-x_{1})] (x-x_{1})Equation (1)

As we’re finding root of function f(x) so, Y=f(x)=0 in Equation (1) and the point where the secant line cut the x-axis is,

x= x_{1 -}[(x_{0}- x_{1})/ (f(x_{0}) - f(x_{1})]f(x_{1}) .

We use the above result for successive approximation for the root of function f(x). Let’s say the first approximation is **x=x _{2}:**

x_{2}= x_{1}- [(x_{0 }- x_{1})/ (f(x_{0})-f(x_{1}))]f(x_{1})

Similarly, the second approximation would be **x =x _{3}**:

x_{3}= x_{2}- [(x_{1}-x_{2})/ (f(x_{1})-f(x_{2}))]f(x_{2})

And so on, **till k ^{th} iteration,**,

x_{k+1}= x_{k}- [(x_{k-1 }- x_{k}) / (f(x_{k-1}) - f(x_{k}))]f(x_{k})

** Note: **To start the solution of the function f(x) two initial guesses are required such that

**f(x**and

_{0})<0**f(x**Usually it hasn’t been asked to find, that root of the polynomial f(x) at which

_{1})>0.**f(x) =0.**Mostly You would only be asked by the problem to find the root of the

**f(x)**till two decimal places or three decimal places or four etc.

**Example-1 :**

Compute the root of the equation x^{2}e^{–x/2} = 1 in the interval [0, 2] using the secant method. The root should be correct to three decimal places.

**Solution –**

x_{0} = 1.42, x_{1} = 1.43, f(x_{0}) = – 0.0086, f(x_{1}) = 0.00034.

Apply,** secant method,** The first approximation is,

x_{2 }= x_{1 }– [( x_{0} – x_{1}) / (f(x_{0}) – f(x_{1})]f(x_{1})

= 1.43 – [( 1.42 – 1.43) / (0.00034 – (– 0.0086))](0.00034)

= 1.4296

f(x_{2}) = – 0.000011 (–ve)

The second approximation is,

x_{3} = x_{2} – [( x_{1} – x_{2}) / (f(x_{1}) – f(x_{2}))]f(x_{2})

= 1.4296 – [( 1.42 – 1.4296) / (0.00034 – (– 0.000011](– 0.000011)

= 1.4292

Since, **x _{2}** and

**x**matching up to

_{3}**three decimal places,**the required root is

**1.429**.

**Example-2 :**

A real root of the equation f(x) = x^{3} – 5x + 1 = 0 lies in the interval (0, 1). Perform four iterations of the secant method.

**Solution –**

We have, x_{0} = 0, x_{1} = 1, f(x_{0}) = 1, f(x_{1}) = – 3

x_{2} = x_{1} – [( x_{0} – x_{1}) / (f(x_{0}) – f(x_{1}))]f(x_{1})

= 1 – [ (0 – 1) / ((1-(-3))](-3)

= 0.25.

f(x_{2}) = – 0.234375

The second approximation is,

x_{3} = x_{2} – [( x_{1} – x_{2}) / (f(x_{1}) – f(x_{2}))]f(x_{2})

=(– 0.234375) – [(1 – 0.25)/(–3 – (– 0.234375))](– 0.234375)

= 0.186441

f(x_{34} = x_{3} – [( x_{2} – x_{3}) / (f(x_{2}) – f(x_{3}))]f(x_{3})

= 0.186441 – [( 0.25 – 0.186441) / ( – 0.234375) **– (0.074276) ](– 0.234375)= 0.201736.**

f(x_{4}) = – 0.000470

The fourth approximation is,

x_{5 }= x_{4} – [( x_{3} – x_{4}) / (f(x_{3}) – f(x_{4}))]f(x_{4})

= 0.201736 – [( 0.186441 – 0.201736) / (0.074276 – (– 0.000470)](– 0.000470)

= 0.201640

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the **CS Theory Course** at a student-friendly price and become industry ready.