Question

The secant method is used to find the root of an equation f(x)=0f(x) = 0. It is started from two distinct estimates xax_a and xbx_b for the root. It is an iterative procedure involving linear interpolation to a root. The iteration stops if f(xb)f(x_b) is very small and then xbx_b is the solution. The procedure is given below. Observe that there is an expression which is missing and is marked by ?. Which is the suitable expression that is to be put in place of ? so that it follows all steps of the secant method?

Secant
  Initialize: x_a, x_b, eps, N   // eps = convergence indicator
                                 // N = maximum no. of iterations
  f_b = f(x_b)
  i = 0
  while (i < N and |f_b| > eps) do
    i = i + 1                    // update counter
    x_t = ?                      // missing expression for intermediate value
    x_a = x_b                    // reset x_a
    x_b = x_t                    // reset x_b
    f_b = f(x_b)                 // function value at new x_b
  end while
  if |f_b| > eps then            // loop is terminated with i=N
    write "Non-convergence"
  else
    write "return x_b"
  end if
Choose one option
Official answer and solution
Official answer
C
From
Official GATE 2015 answer key

Solution

Recall the geometric derivation of the secant method linear interpolation formula.

The secant method approximates the tangent of Newton's method with the secant line passing through two points (xa,f(xa))(x_a, f(x_a)) and (xb,fb)(x_b, f_b) where fb=f(xb)f_b = f(x_b).

The equation of the secant line is:

y−fb=fb−f(xa)xb−xa(x−xb).y - f_b = \frac{f_b - f(x_a)}{x_b - x_a} (x - x_b).

Setting y=0y = 0 to find the x-intercept xtx_t:

−fb=fb−f(xa)xb−xa(xt−xb)-f_b = \frac{f_b - f(x_a)}{x_b - x_a} (x_t - x_b)
xt−xb=−(xb−xa)fbfb−f(xa)x_t - x_b = -\frac{(x_b - x_a) f_b}{f_b - f(x_a)}
xt=xb−(xb−xa)fbfb−f(xa).x_t = x_b - \frac{(x_b - x_a) f_b}{f_b - f(x_a)}.

This matches option C.

Final answer

C

Common trap

Inverting the slope fraction (xb−xa)/(fb−f(xa))(x_b - x_a) / (f_b - f(x_a)) in option A.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2015 Computer Science and Information Technology (CS) Session 2
Question
49 of 65, printed as CS Q.39
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.