Last modified: November 02, 2022

This article is written in: πŸ‡ΊπŸ‡Έ

Secant Method

The Secant Method is a root-finding algorithm used in numerical analysis to approximate the zeros of a given function f(x). It can be regarded as a derivative-free variant of Newton's method. Instead of computing the derivative fβ€²(x) at each iteration (as done in Newton’s method), it approximates the derivative by using two previously computed points. This approach allows the Secant Method to be applied even when the function is not easily differentiable, and under suitable conditions, it often converges faster than simpler bracket-based methods (like the bisection method).

Conceptually, the Secant Method constructs a secant line between two points (xnβˆ’1,f(xnβˆ’1)) and (xn,f(xn)) on the graph of f(x). The root approximation is then taken as the x-intercept of this secant line. By iteratively updating these points, the method β€œzeroes in” on a root.

Conceptual Illustration:

Imagine plotting the function f(x):

secant_method

The intersection of the secant line with the x-axis gives the next approximation xn+1. Repeating this procedure leads to progressively better approximations of the root, assuming the method converges.

Mathematical Formulation

Consider a continuous function f(x) for which we want to solve f(x)=0. The Secant Method starts with two initial approximations x0 and x1, and then generates a sequence xn according to:

xn+1=xnβˆ’f(xn)xnβˆ’xnβˆ’1f(xn)βˆ’f(xnβˆ’1)

This formula approximates the derivative fβ€²(xn) by the finite difference:

fβ€²(xn)β‰ˆf(xn)βˆ’f(xnβˆ’1)xnβˆ’xnβˆ’1

By replacing fβ€²(xn) with the above approximation in the Newton's method formula, we arrive at the Secant Method formula.

Derivation

I. Starting from Newton’s Method:

Newton’s method update rule is:

xn+1=xnβˆ’f(xn)fβ€²(xn).

II. Approximating the Derivative:

If the derivative fβ€²(xn) is difficult to compute or unknown, we can use a finite difference approximation based on the two most recent points:

fβ€²(xn)β‰ˆf(xn)βˆ’f(xnβˆ’1)xnβˆ’xnβˆ’1.

III. Substitute into Newton’s Formula:

Replacing fβ€²(xn) with this approximation gives:

xn+1=xnβˆ’f(xn)f(xn)βˆ’f(xnβˆ’1)xnβˆ’xnβˆ’1.

IV. Simplify the Expression:

By rearranging, we get:

xn+1=xnβˆ’f(xn)xnβˆ’xnβˆ’1f(xn)βˆ’f(xnβˆ’1).

This is the Secant Method iteration formula.

Algorithm Steps

Input:

Initialization:

Set n=1 (since we already have x0 and x1).

Iteration:

I. Evaluate f(xn) and f(xnβˆ’1).

II. Compute:

xn+1=xnβˆ’f(xn)xnβˆ’xnβˆ’1f(xn)βˆ’f(xnβˆ’1)

III. Check for convergence:

IV. Update indices: n=n+1 and repeat step I.

Output:

Example

Given Function:

f(x)=x2βˆ’4.

We know the roots are x=Β±2. Suppose we do not know the roots in advance and start with:

x0=0,x1=1

Iteration 1:

Update:

x2=x1βˆ’f(x1)x1βˆ’x0f(x1)βˆ’f(x0)=1βˆ’(βˆ’3)1βˆ’0(βˆ’3)βˆ’(βˆ’4)=1βˆ’(βˆ’3)1βˆ’3+4=1βˆ’(βˆ’3Γ—1)=1+3=4.

Check carefully:

Actually, let's compute step-by-step to avoid confusion:

x2=1βˆ’(βˆ’3)1βˆ’0βˆ’3βˆ’(βˆ’4)=1βˆ’(βˆ’3)1βˆ’3+4=1βˆ’(βˆ’3)11=1+3=4.

Iteration 2:

Now:

Update:

x3=x2βˆ’f(x2)x2βˆ’x1f(x2)βˆ’f(x1)=4βˆ’124βˆ’112βˆ’(βˆ’3)=4βˆ’12315=4βˆ’12Γ—0.2=4βˆ’2.4=1.6.

Iteration 3:

Now:

Update:

x4=x3βˆ’f(x3)x3βˆ’x2f(x3)βˆ’f(x2)=1.6βˆ’(βˆ’1.44)1.6βˆ’4βˆ’1.44βˆ’12

=1.6βˆ’(βˆ’1.44)βˆ’2.4βˆ’13.44

=1.6βˆ’(βˆ’1.44)βˆ’2.4βˆ’13.44

Compute inside:

βˆ’2.4βˆ’13.44=0.1786(approx),(βˆ’1.44)Γ—0.1786=βˆ’0.2572

So:

x4=1.6βˆ’(βˆ’0.2572)=1.6+0.2572=1.8572

Repeating further will bring the sequence closer to x=2.

However, let's simplify by noting that if we start closer to the root, the method converges faster. For example, if we start with x0=0 and x1=1, after the first step we got x2=4, which moved us away initially, but subsequent steps pull the approximation toward x=2. Adjusting initial guesses (e.g., starting with x0=1 and x1=3) might yield quicker convergence to the root x=2.

Advantages

Limitations

Table of Contents

    Secant Method
    1. Mathematical Formulation
    2. Derivation
    3. Algorithm Steps
    4. Example
    5. Advantages
    6. Limitations