Section C.4 The secant method
¶Let \(f(x)\) be a continuous function. The secant method is a variant of Newton's method that avoids the use of the derivative of \(f(x)\) — which can be very helpful when dealing with the derivative is not easy. It avoids the use of the derivative by approximating \(f'(x)\) by \(\frac{f(x+h)-f(x)}{h}\) for some \(h\text{.}\) That is, it approximates the tangent line to \(f\) at \(x\) by a secant line for \(f\) that passes through \(x\text{.}\) To limit the number of evaluations of \(f(x)\) required, it uses \(x=x_{n-1}\) and \(x+h=x_n\text{.}\) Here is how it works.
Suppose that we have already found \(x_n\text{.}\) Then we denote by \(y=F(x)\) the equation of the (secant) line that passes through \(\big(x_{n-1}, f(x_{n-1})\big)\) and \(\big(x_n,f(x_n)\big)\) and we choose \(x_{n+1}\) to be the value of \(x\) where \(F(x)=0\text{.}\)
The equation of the secant line is
so that \(x_{n+1}\) is determined by
or, simplifying,
Of course, to get started with \(n=1\text{,}\) we need two initial guesses, \(x_0\) and \(x_1\text{,}\) for the root.
Example C.4.2 Approximating \(\sqrt{2}\text{,}\) again
In this example we compute, approximately, the square root of two by applying the secant method to the equation
and we'll compare the secant method results with the corresponding Newton's method results. (See Example C.1.2.)
Since \(f'(x)=2x\text{,}\) (C.1.1) says that, under Newton's method, we should iteratively apply
while (C.4.1) says that, under the secant method, we should iteratively apply (after a little simplifying algebra)
Here are the results, starting Newton's method with \(x_1=4\) and starting the secant method with \(x_0=4\text{,}\) \(x_1=3\text{.}\) (So we are giving the secant method a bit of a head start.)
For comparison purposes, the square root of \(2\text{,}\) to 15 decimal places, is \(1.414213562373095\text{.}\) So the secant method \(x_7\) is accurate to 7 decimal places and the Newton's method \(x_7\) is accurate to at least 15 decimal places.
The advantage that the secant method has over Newton's method is that it does not use the derivative of \(f\text{.}\) This can be a substantial advantage, for example when evaluation of the derivative is computationally difficult or expensive. On the other hand, the above example suggests that the secant method is not as fast as Newton's method. The following subsection shows that this is indeed the case.