2 Root Finding Methods

Numerical Methods · Unit 2

Root Finding Methods

Exam-focused notes for Root Finding Methods (Numerical Methods, BIT203): what the TU syllabus asks and how it has actually been tested, with 8 solved past questions from this unit.

Root Finding Methods in short

Many equations such as $x^3 + 2x - 2 = 0$ cannot be solved by a formula. Root finding methods start from a guess and improve it step by step until $f(x) = 0$ is met to the needed accuracy.

Root Finding Methods: notes

Bisection method derivation and application

The bisection method is based on the intermediate value theorem. If $f(x)$ is continuous on $[a, b]$ and $f(a)f(b) < 0$, then at least one root lies in $[a, b]$.

Derivation. Take the midpoint of the interval.

$$x_m = \frac{a + b}{2}$$

Then check the sign of $f(x_m)$.

  • If $f(a)f(x_m) < 0$, the root is in $[a, x_m]$, so set $b = x_m$.
  • If $f(a)f(x_m) > 0$, the root is in $[x_m, b]$, so set $a = x_m$.
  • If $f(x_m) = 0$, then $x_m$ is the root.

Repeat. The interval halves each time. After $n$ steps its length is $(b - a)/2^n$. To get an error below $\varepsilon$ we need

$$n \ge \frac{\log\left(\frac{b-a}{\varepsilon}\right)}{\log 2}$$

Example. Solve $f(x) = 2x^3 - 2x - 5 = 0$ with $x_0 = 1$ and $x_1 = 2$. Here $f(1) = -5$ and $f(2) = 7$, so a root lies between them.

Iteration$a$$b$$x_m$$f(x_m)$
1121.5-1.2500
21.521.752.2188
31.51.751.6250.3320
41.51.6251.5625-0.4956
51.56251.6251.59375-0.0911
61.593751.6251.6093750.1181

Continuing in the same way, the 10th midpoint is $x_m = 1.6006$ with $f(x_m) = -0.0002$. The root is about $1.6006$.

What this unit covers

  • Bisection method derivation and application
  • Newton Raphson method formula and convergence
  • Secant method formula and derivation
  • Comparison of root finding methods
  • Horner's method for polynomial evaluation
  • Algorithm and implementation of root finding methods

Comparison of root finding methods

2082 · 10 marks

Explain how bisection method differ from secant. Derive the formula for Newton Raphson. Use Newton Raphson method to solve the equation $f(x) = x^3 + 2x - 2$ correct upto three decimal places. [2+4+4]

Show solved answer

Numerical Methods: Bisection vs Secant, Newton-Raphson

Given Data

  • Equation: $f(x) = x^3 + 2x - 2 = 0$
  • Required accuracy: three decimal places
  • Marks split: $2 + 4 + 4$

(a) Bisection Method vs Secant Method

FeatureBisection MethodSecant Method
TypeBracketing (closed) methodOpen method
Initial pointsNeeds $a,b$ with $f(a)\cdot f(b) < 0$Needs any two starting points $x_0, x_1$ (no sign change required)
Formula$x = \dfrac{a+b}{2}$$x_{n+1} = x_n - f(x_n)\dfrac{x_n - x_{n-1}}{f(x_n) - f(x_{n-1})}$
Convergence rateLinear (slow), order 1Superlinear, order $\approx 1.618$
Convergence guaranteeAlways convergesMay diverge
IdeaRepeated halving of intervalChord (secant line) approximation

Key difference: Bisection guarantees convergence by successively halving a bracketed interval but is slow; the secant method uses the line joining two previous points and converges faster but is not guaranteed.


(b) Derivation of Newton-Raphson Formula

Let $x_0$ be an initial approximation and $h$ a small correction so that $x_1 = x_0 + h$ is the root, i.e. $f(x_0 + h) = 0$.

Taylor expansion:

$$f(x_0 + h) = f(x_0) + h,f'(x_0) + \frac{h^2}{2!}f''(x_0) + \cdots$$

Neglecting $h^2$ and higher order terms (since $h$ is small):

$$f(x_0) + h,f'(x_0) = 0 \implies h = -\frac{f(x_0)}{f'(x_0)}$$

Therefore:

$$x_1 = x_0 - \frac{f(x_0)}{f'(x_0)}$$

The general iterative formula:

$$\boxed{x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}, \quad n = 0,1,2,\ldots}$$

(valid provided $f'(x_n) \neq 0$).


(c) Solve $f(x) = x^3 + 2x - 2 = 0$

$$f(x) = x^3 + 2x - 2, \qquad f'(x) = 3x^2 + 2$$

Bracketing: $f(0) = -2 < 0$, $f(1) = 1 > 0$, so root in $[0,1]$. Take $x_0 = 1$.

$$x_{n+1} = x_n - \frac{x_n^3 + 2x_n - 2}{3x_n^2 + 2}$$

Iteration 1: $x_0 = 1$ $$f(1) = 1,\quad f'(1) = 5$$ $$x_1 = 1 - \frac{1}{5} = 0.800000$$

Iteration 2: $x_1 = 0.8$ $$f(0.8) = 0.512 + 1.6 - 2 = 0.112$$ $$f'(0.8) = 1.92 + 2 = 3.92$$ $$x_2 = 0.8 - \frac{0.112}{3.92} = 0.771429$$

Iteration 3: $x_2 = 0.771429$ $$f(x_2) = 0.771429^3 + 2(0.771429) - 2 = 0.459045 + 1.542857 - 2 = 0.001902$$ $$f'(x_2) = 3(0.595102) + 2 = 1.785306 + 2 = 3.785306$$ $$x_3 = 0.771429 - \frac{0.001902}{3.785306} = 0.771429 - 0.000502 = 0.770926$$

Iteration 4: $x_3 = 0.770926$ $$f(x_3) = 0.770926^3 + 2(0.770926) - 2$$ $$= 0.458148 + 1.541853 - 2 = 0.000001 \approx 0$$

Check: $|x_3 - x_2| = |0.770926 - 0.771429| = 0.000503 < 0.001$ region; one more confirms stability.

Rounded to three decimals:

$$\boxed{x \approx 0.771}$$

Verification: $f(0.771) = 0.458314 + 1.542 - 2 = 0.000314 \approx 0$. ✓

Open this answer on its own page →

Algorithm and implementation of root finding methods

2080 · 10 marks

Write an algorithm and a C-Program to obtain roots of non-linear equation using Newton Raphson Method.[10]

The Newton-Raphson method is an iterative numerical technique used to find roots of a non-linear equation f(x) = 0. Starting from an initial guess x₀, it uses the tangent line at each point to converge to the root. Iterative Formula: $$x{n+1} = xn - \frac{f(xn)}{f'(xn)}$$ where f'(x) is the deriv...

Open this answer on its own page →

Secant method formula and derivation

2080 · 5 marks

Use secant method to estimate the root of the equation $x^2-5x+6=0$, with initial estimate $x_1 = 4$ and $x_2 = 2$ (EPS=0.05). [5]

  • Equation: $f(x) = x^2 - 5x + 6$ - Initial estimates: $x1 = 4$, $x2 = 2$ - Tolerance: $\text{EPS} = 0.05$ Secant formula: $$x{n+1} = xn - f(xn)\cdot\frac{xn - x{n-1}}{f(xn) - f(x{n-1})}$$ Stopping criterion: $$\varepsilon = \left\frac{x{n+1} - xn}{x{n+1}}\right < 0.05$$ $$f(x1) = f(4) = 16 - 20 ...
Open this answer on its own page →

0 · 10 marks

How Secant methods differs from Newton Raphson method? Derive the formula for Secant Method. Solve the equation $\cos x + 2\sin x - x^2 = 0$ using Secant method. Assume error precision is 0.01. [10]

Feature Newton-Raphson Secant --------- Requires $f(x)$ and $f'(x)$ Only $f(x)$ Initial guesses One ($x0$) Two ($x0,x1$) Derivative Exact analytic Finite-difference approximation Convergence order Quadratic ($2$) Superlinear ($\approx 1.618$) Function evaluations/iter 2 ($f,f'$) 1 (reuses previou...

Open this answer on its own page →

Bisection method derivation and application

2079 · 10 marks

Question

Define true error and relative error. Derive the bisection method for solving non-linear equation and using this method solve $2x^3 - 2x - 5$ with initial $x_0 = 1$ and $x_1 = 2$. Calculate upto 10th iteration.[10]

True Error is the difference between the exact (true) value and the approximate value: $$Et = \text{True Value} - \text{Approximate Value}$$ Relative Error is the true error normalized by the true value (often as a percentage): $$\epsilonr = \frac{\text{True Value} - \text{Approximate Value}}{\te...

Open this answer on its own page →

Horner's method for polynomial evaluation

2079 · 5 marks

Write an algorithm for Honer's method. Evaluate the polynomial $f(x) = x^4 + 3x^3 + 5x^2 + 7^x + 9$ at x = 2 by using Honer's method. [5]

Polynomial: $f(x) = x^4 + 3x^3 + 5x^2 + 7x + 9$ (Note: the source text shows "$7^x$", but from the pattern of a standard 4th-degree polynomial this is clearly a typo for the linear term $7x$.) Coefficients (highest to lowest degree): Degree 4 3 2 1 0 ----------------------- $ai$ 1 3 5 7 9 Evaluat...

Open this answer on its own page →

0 · 5 marks

Define the terms true error and relative error? Write down algorithm for Horner' method to evaluate polynomial and use the method to evaluate the polynomial $2x^3 - 3x^2 + 5x - 2$ at x=3. [5]

Show solved answer

True Error, Relative Error, and Horner's Method

Given

  • Polynomial: $P(x) = 2x^3 - 3x^2 + 5x - 2$
  • Coefficients (high to low degree): $a_3 = 2,\ a_2 = -3,\ a_1 = 5,\ a_0 = -2$
  • Evaluation point: $x = 3$

Solution

1. True Error

The true error is the difference between the exact (true) value and the approximate (computed) value.

$$E_t = X_{\text{true}} - X_{\text{approx}}$$

It expresses the actual magnitude of the deviation but does not indicate how significant that deviation is relative to the quantity being measured.

2. Relative Error

The relative error is the true error divided by the true value (often given as a percentage).

$$\epsilon_t = \frac{X_{\text{true}} - X_{\text{approx}}}{X_{\text{true}}} = \frac{E_t}{X_{\text{true}}}$$

$$\epsilon_t(%) = \frac{E_t}{X_{\text{true}}} \times 100%$$

It provides a normalized (scale-independent) measure of accuracy.

3. Horner's Method

Horner's method (nested multiplication / synthetic division) rewrites

$$P(x) = a_n x^n + a_{n-1}x^{n-1} + \cdots + a_1 x + a_0$$

as

$$P(x) = (\cdots((a_n x + a_{n-1})x + a_{n-2})x + \cdots)x + a_0$$

reducing the count to $n$ multiplications and $n$ additions.

Algorithm:

Algorithm Horner(a[0..n], n, x):
  Step 1: result = a[n]
  Step 2: for i = n-1 down to 0:
              result = result * x + a[i]
  Step 3: return result

4. Evaluation of $P(x) = 2x^3 - 3x^2 + 5x - 2$ at $x = 3$

Degree3210
Coeff2-35-2

Step 1: $b_3 = 2$

Step 2: $b_2 = 2 \times 3 + (-3) = 6 - 3 = 3$

Step 3: $b_1 = 3 \times 3 + 5 = 9 + 5 = 14$

Step 4: $b_0 = 14 \times 3 + (-2) = 42 - 2 = 40$

$$\boxed{P(3) = 40}$$

Verification (direct): $$P(3) = 2(27) - 3(9) + 5(3) - 2 = 54 - 27 + 15 - 2 = 40 \checkmark$$

Open this answer on its own page →

Newton Raphson method formula and convergence

2078 · 5 marks

Show that the rate of convergence of Newtons Raphson method is quadratic. [5]

Let $x^$ be the exact root of $f(x) = 0$, and let $xn$ be the $n$-th approximation. Define the error at the $n$-th step as: $$en = xn - x^$$ The Newton-Raphson iteration formula is: $$x{n+1} = xn - \frac{f(xn)}{f'(xn)}$$ --- Expand $f(x^)$ about $xn$ using Taylor's series: $$f(x^) = f(xn) + (x^ -...

Open this answer on its own page →