UniMaths
Free chapterTry everything here: cards, proofs and practice. Sign up free to save your progress and unlock all 5 chapters.Sign up free
NUM2 · 1

Errors and root finding

9 concepts · 22 questions

Floating-point arithmetic and rounding error, bisection, fixed-point iteration, Newton's method, the secant method and orders of convergence.

Overview 1The plan of this section

Computers approximate real numbers, so every algorithm must control error.

  1. Floating-point numbers and rounding (Def. 1.1); relative error and cancellation (Example 1.2).
  2. Bisection (Prop. 1.3).
  3. Fixed-point iteration and its convergence (Thm 1.4); order of convergence (Def. 1.5).
  4. Newton's method converges quadratically (Thm 1.6); the secant method (Prop. 1.7).

Rounding error; bisection (safe, slow); fixed points (∣g′∣<1|g'| < 1); Newton (quadratic); secant (order ≈ 1.618).

Definition 1.1Floating-point numbers and rounding error

A binary floating-point number has the form ±(1.d1d2…dt)2×2e\pm(1.d_1d_2\dots d_t)_2\times2^e with tt mantissa bits and exponent ee in a range. Rounding to nearest gives fl⁡(x)=x(1+δ)\operatorname{fl}(x) = x(1 + \delta) with ∣δ∣≤u=2−t−1|\delta|\le u = 2^{-t-1}, the unit roundoff (εmach=2−t\varepsilon_{\text{mach}} = 2^{-t}; IEEE double precision has t=52t = 52, u≈1.1×10−16u\approx1.1\times10^{-16}). Each arithmetic operation satisfies fl⁡(a∘b)=(a∘b)(1+δ)\operatorname{fl}(a\circ b) = (a\circ b)(1 + \delta), ∣δ∣≤u|\delta|\le u.

fl⁡(x)=x(1+δ)\operatorname{fl}(x) = x(1 + \delta), ∣δ∣≤u|\delta|\le u; double precision u≈10−16u\approx10^{-16}: about 16 significant digits.

Example 1.2Catastrophic cancellation

Subtracting nearly equal numbers loses relative accuracy: if a≈ba\approx b carry relative errors uu, then a−ba - b has relative error up to u(∣a∣+∣b∣)∣a−b∣\frac{u(|a| + |b|)}{|a - b|}. Examples and remedies:

  • x+1−x\sqrt{x + 1} - \sqrt x for large xx: use 1x+1+x\frac{1}{\sqrt{x + 1} + \sqrt x}.
  • Roots of x2−bx+cx^2 - bx + c with b2≫∣c∣b^2\gg|c|: compute x1=b+sign⁡(b)b2−4c2x_1 = \frac{b + \operatorname{sign}(b)\sqrt{b^2 - 4c}}{2}, then x2=cx1x_2 = \frac c{x_1}.
  • 1−cos⁡x1 - \cos x for small xx: use 2sin⁡2x22\sin^2\frac x2.

Avoid subtracting nearly equal numbers; rewrite algebraically.

Proposition 1.3The bisection method

If ff is continuous on [a,b][a, b] with f(a)f(b)<0f(a)f(b) < 0, bisection (halve the interval, keep the half with a sign change) produces intervals [an,bn][a_n, b_n] of length b−a2n\frac{b - a}{2^n} containing a root. To guarantee error below ε\varepsilon requires n≥log⁡2b−aεn\ge\log_2\frac{b - a}\varepsilon steps.

Bisection: always converges given a sign change; error halves per step (linear, rate 12\frac12).

Proof

Theorem 1.4Convergence of fixed-point iteration

Let gg map [a,b][a, b] into itself with ∣g′(x)∣≤k<1|g'(x)|\le k < 1 there. Then gg has a unique fixed point x∗∈[a,b]x^*\in[a, b], and xn+1=g(xn)x_{n+1} = g(x_n) converges to it from any x0∈[a,b]x_0\in[a, b], with ∣xn−x∗∣≤kn∣x0−x∗∣|x_n - x^*|\le k^n|x_0 - x^*|. If g′(x∗)≠0g'(x^*)\ne0, then en+1en→g′(x∗)\frac{e_{n+1}}{e_n}\to g'(x^*).

∣g′∣≤k<1|g'|\le k < 1 on an invariant interval ⇒ xn+1=g(xn)x_{n+1} = g(x_n) converges, error shrinking by ≈g′(x∗)\approx g'(x^*) per step.

Proof

Definition 1.5Order of convergence

A sequence xn→x∗x_n\to x^* converges with order p≥1p\ge1 if lim⁡∣en+1∣∣en∣p=C\lim\frac{|e_{n+1}|}{|e_n|^p} = C with 0<C<∞0 < C < \infty (and C<1C < 1 if p=1p = 1). p=1p = 1 is linear, p=2p = 2 quadratic. Fixed-point iteration with g′(x∗)=⋯=g(p−1)(x∗)=0≠g(p)(x∗)g'(x^*) = \dots = g^{(p-1)}(x^*) = 0\ne g^{(p)}(x^*) has order pp.

Order pp: ∣en+1∣≈C∣en∣p|e_{n+1}|\approx C|e_n|^p. Quadratic ⇒ correct digits roughly double each step.

Theorem 1.6Quadratic convergence of Newton's method

Newton's method xn+1=xn−f(xn)f′(xn)x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)} is fixed-point iteration with g(x)=x−ff′g(x) = x - \frac{f}{f'}. If ff is C2C^2 near a simple root x∗x^* (f′(x∗)≠0f'(x^*)\ne0), then for x0x_0 close enough to x∗x^* it converges quadratically:

en+1≈f′′(x∗)2f′(x∗)en2.e_{n+1}\approx\frac{f''(x^*)}{2f'(x^*)}e_n^2.

At a root of multiplicity m>1m > 1 it converges only linearly, with ratio 1−1m1 - \frac1m.

Newton: quadratic near simple roots, en+1≈f′′2f′en2e_{n+1}\approx\frac{f''}{2f'}e_n^2; linear at multiple roots; needs a good start.

Proof

Proposition 1.7The secant method

The secant method replaces f′(xn)f'(x_n) by the slope through the last two iterates: xn+1=xn−f(xn)xn−xn−1f(xn)−f(xn−1)x_{n+1} = x_n - f(x_n)\frac{x_n - x_{n-1}}{f(x_n) - f(x_{n-1})}. Near a simple root, en+1≈f′′(x∗)2f′(x∗)enen−1e_{n+1}\approx\frac{f''(x^*)}{2f'(x^*)}e_ne_{n-1}, giving order ϕ=1+52≈1.618\phi = \frac{1 + \sqrt5}2\approx1.618. It needs one new function value per step and no derivative.

Secant: derivative-free, order ϕ≈1.618\phi\approx1.618; often faster per function evaluation than Newton.

Proof

Check 1.8Check: choosing and testing a root-finder

  • Bracket first (sign change) for safety; then switch to Newton or secant for speed.
  • Estimate the order from successive errors: p≈log⁡∣en+1/en∣log⁡∣en/en−1∣p\approx\frac{\log|e_{n+1}/e_n|}{\log|e_n/e_{n-1}|}.
  • Stopping: ∣xn+1−xn∣|x_{n+1} - x_n| small and ∣f(xn)∣|f(x_n)| small; beware stalls at roundoff level.
  • Multiple roots slow Newton down to linear.

Bracket, then accelerate; estimate the order from errors; two stopping tests; multiple roots are slow.