Secant Method

Back to Programming


The secant method is also a root-finding method which is very much similar to the regula falsi method but the only difference is the condition that is the value at the initial point of the function and the final point of the function has the opposite signs


It uses the succession of roots. It can be thought of as a finite difference approximation of newton’s method. But the geometric representation of the two methods is the same. The convergence and error relation is the same as in regula falsi method.



If [x0, x1]be the initial interval in which the root of the function lies, then the equation of  the chord joining the points (x0, f(x0)),(x1, f(x1)) is:

This chord intersects the x-axis at the point x2 (say) and y = 0 gives:

Repeating the process, the (n + 1)-th iteration is:





A function  3x – sin x − 1



An isolated root of the equation.



Step 1: Create a function “float f(float x)”

Step 1.1:  Return (3x – sin x − 1)

		[End of the function “float  f (float x)”]

Step 2: Create the function “void main()”

[‘a’ and ‘b’ are two float type variables and initially a = 0.0 and b = 1.0]

Step 2.1: While (f(a)*f(b) > 0) then repeat Step 2.2 and Step 2.3

	Step 2.2: Set  a ← a − 1.0

	Step 2.3: Set   b ← b + 1.0 

              		[End of  Step 2.1 ‘While’ loop]

Step 2.4: Display the two integer values ‘a’ and ‘b’ in which the root lies i.e.                                                                                

          print “a,b”.

Step 2.5: Take the value of Error in a float type variable ‘err’.

Step 2.6: If (f(a) > 0)  then

Step 2.7: Set  a ← a + b

Step 2.8: Set  b ← a − b

Step 2.9: Set  a ← a − b

 [End  of  ‘If’]

Step 2.10: Do Step 2.11 to Step to Step 2.18

Step2.11: Set  y ← x

Step 2.12: Set  x ← b − ((f(b) / (f(b) − f(a))) × (b − a))

Step 2.13:  If(f(x) < 0)  then

	Step 2.14: Set  a ← x

    [End of  ‘If’]

Step 2.15: Else

Step 2.16: Set  b ← x

    [End of ‘Else’]

Step 2.17: Print “a, b, f(a), f(b), x, f(x)” 

Step 2.18: While(fabs(x - y) > err) then go to Step 2.10 repeatedly

Step 2.19: Display the value of the root correct up to 4 decimal places  i.e. print “x”

    [End of the function “void main()”]

Step 3: Stop



1. The convergence is more rapid than regula falsi if it converges.

2. It is not needed to check always whether f(xi).f(xi-1) < 0 or > 0

3. The method is easy and simple to calculate.

4. There is no need to calculate the derivatives of the function.



1. If at any stage f(xn) = f(xn-1) then the method fails.

2. It may not converge whereas regula falsi always converges.

3. This method does not know when to stop. It has to be performed several times until the f of the current guess is very small.



1. Designing a multi-storey building.

2. It is one of the analytical procedures to predict the earthquake performance of structures.