Leave lesson

Pure · Numerical methods

1 / 10

Iterative methods (x = g(x))

Solving f(x) = 0 by rearranging it into x = g(x) and iterating x_(n+1) = g(x_n) from a starting value — why some rearrangements converge and others diverge, and reading staircase and cobweb diagrams.

Pure · Numerical methods

Iterative methods (x = g(x))

Solving f(x) = 0 by rearranging it into x = g(x) and iterating x_(n+1) = g(x_n) from a starting value — why some rearrangements converge and others diverge, and reading staircase and cobweb diagrams.

Why it works

A change of sign traps a root; an iteration hunts it down to many decimal places. The trick is to rewrite f(x)=0f(x) = 0 in the form x=g(x).x = g(x). A solution of this is a value that comes out the same as it went in — a fixed point. The idea: guess a starting value x0x_0 near the root, feed it through gg to get x1=g(x0)x_1 = g(x_0), feed that back to get x2=g(x1)x_2 = g(x_1), and keep going: xn+1=g(xn).x_{n+1} = g(x_n). If this sequence settles down to a limit LL, then L=g(L)L = g(L), so LL is a root of the original equation. You stop when successive values agree to the accuracy you need.

The rearrangement matters — a lot. The same equation can be written x=g(x)x = g(x) in many ways, and they don't all work. From x32x5=0x^3 - 2x - 5 = 0:
  • x3=2x+5x=2x+53x^3 = 2x + 5 \Rightarrow x = \sqrt[3]{2x + 5} — this one converges.
  • 2x=x35x=x3522x = x^3 - 5 \Rightarrow x = \dfrac{x^3 - 5}{2} — this one diverges, flying away
from the root.

What separates them is the steepness of gg at the root: the iteration converges when g(root)<1|g'(\text{root})| < 1 and diverges when g(root)>1|g'(\text{root})| > 1. A gently sloped gg pulls successive values inward; a steep one flings them out.

Staircase and cobweb diagrams show the iteration on the graph of y=g(x)y = g(x) together with the line y=xy = x (the root is where they meet). From xnx_n you go vertically to the curve to find g(xn)=xn+1g(x_n) = x_{n+1}, then horizontally to the line y=xy = x to carry that value back onto the xx-axis as the next input — and repeat.
  • If 0<g(root)<10 < g'(\text{root}) < 1 the steps march in from one side: a staircase.
  • If 1<g(root)<0-1 < g'(\text{root}) < 0 the steps alternate sides, spiralling in: a cobweb.
0.811.21.41.61.822.22.40.811.21.41.61.822.22.4xyIn practice: write the iteration formula, list successive values keeping plenty of decimals, stop when they agree to the required accuracy — then confirm the root with a sign change over a suitable interval, since the iteration only suggests the answer.