Mathematics/Lessons/Numerical Methods/Iteration & Staircase/Cobweb Diagrams
Pure · Numerical Methods · Year 2

Iteration & Staircase/Cobweb Diagrams

Turn an equation into a self-updating rule, and watch each guess refine the last.

10 min read 4 worked examples

Rewriting an equation as x = g(x)

Most equations $f(x)=0$ that come from real models can't be solved by any algebraic method — no factorising, no formula, no clever substitution gets $x$ on its own. Fixed-point iteration sidesteps this by rearranging $f(x)=0$ into a different form, $x=g(x)$, where $x$ appears (at least once) isolated on the left. For example, $x^3-6x-2=0$ can be rearranged by isolating the $x^3$ term and cube-rooting both sides: $x^3=6x+2$, so $x=\sqrt[3]{6x+2}$ — giving $g(x)=\sqrt[3]{6x+2}$.

Because this rearrangement is just algebra done in reverse, any value of $x$ satisfying $x=g(x)$ automatically satisfies the original $f(x)=0$ too. The rearrangement hasn't changed the roots — only the form of the equation.

Generating the sequence of iterates

Pick a starting value $x_0$, then repeatedly feed each output back in as the next input:

$x_{n+1}=g(x_n)$

This produces a sequence $x_0,x_1,x_2,\dots$ If the sequence converges — settles toward a fixed value rather than running off or oscillating forever — call that limit $\alpha$. Since $\alpha=g(\alpha)$ in the limit, $\alpha$ is a root of $x=g(x)$, and therefore a root of the original equation $f(x)=0$ too.

The rearrangement you choose matters

The same equation $f(x)=0$ can be rearranged into several different $x=g(x)$ forms, and they don't all behave the same way. One rearrangement might converge quickly, another might converge slowly, and another might not converge at all — running off to $\pm\infty$ instead of settling near the root. Whether a given rearrangement converges is a genuine question you need to check, not something you can assume.

Reading a staircase or cobweb diagram

Plot $y=x$ and $y=g(x)$ on the same axes, and the iteration becomes visible as a path between them. Starting at $x_0$ on the horizontal axis, move vertically up (or down) to the curve $y=g(x)$ — this height is $x_1$. Move horizontally across to the line $y=x$ to carry that value back onto the axis, then vertically again to $y=g(x)$ for $x_2$, and so on.

Animated diagram: axes with the straight line y = x and the curve y = the cube root of 6x plus 2, both drawn. Starting from x0 on the horizontal axis, a path of alternating vertical and horizontal orange steps draws itself in, climbing down between the curve and the line, converging on the point where the curve crosses the line, labelled root alpha.
A staircase diagram for Example 1: starting from x₀ = 3, alternating vertical steps to y = g(x) and horizontal steps to y = x trace a path that homes in on the root α ≈ 2.602, where the curve crosses y = x.
Staircase vs cobweb — and when it fails entirely

Near the root, the shape of the path depends on the sign of $g'(x)$. When $0<g'(x)<1$, every iterate lands on the same side of the root as the last, producing a monotonic staircase that climbs (or descends) steadily inward. When $-1<g'(x)<0$, each iterate overshoots to the opposite side, producing a cobweb that spirals in around the root. Either way, convergence needs $|g'(x)|<1$ near $\alpha$ — once $|g'(x)|>1$, the same staircase or cobweb pattern spirals outward instead, and the iteration diverges.

Worked example 1

Rearranging and generating a staircase
Show that $f(x)=x^3-6x-2=0$ has a root between $x=2$ and $x=3$. Rearrange the equation into the form $x=\sqrt[3]{6x+2}$, then use $x_0=3$ to find $x_1$, $x_2$ and $x_3$, each correct to 4 decimal places.
MethodLocate by sign change, then rearrange and iterate
1
$f(2)=8-12-2=-6$ and $f(3)=27-18-2=7$.
Evaluate f at each endpoint of the interval.
2
$f(2)<0$ and $f(3)>0$ — a sign change, so (since $f$ is continuous) a root lies in $(2,3)$.
A sign change over a continuous function guarantees a root between the two values.
3
$x^3-6x-2=0 \Rightarrow x^3=6x+2 \Rightarrow x=\sqrt[3]{6x+2}$.
Isolate the x³ term, then cube-root both sides.
4
$x_1=\sqrt[3]{6(3)+2}=\sqrt[3]{20}=2.7144$.
Substitute x₀ = 3 into g(x) = ∛(6x + 2).
5
$x_2=\sqrt[3]{6(2.7144)+2}=\sqrt[3]{18.2867}=2.6346$.
Substitute x₁ into g.
6
$x_3=\sqrt[3]{6(2.6346)+2}=\sqrt[3]{17.8076}=2.6114$.
Substitute x₂ into g.
▪ solved
A staircase, not a cobweb

The values $3, 2.7144, 2.6346, 2.6114,\dots$ decrease steadily, each landing above the last but on the same side of the root — the signature of a staircase pattern, consistent with $g'(x)>0$ near $\alpha$.

Worked example 2

Iterating to a stated degree of accuracy
Continuing the iteration from Example 1, find $x_4$ and $x_5$, and state the root of $x^3-6x-2=0$ correct to 3 decimal places.
MethodKeep applying g until consecutive iterates agree
1
$x_4=\sqrt[3]{6(2.6114)+2}=\sqrt[3]{17.6685}=2.6045$.
Substitute x₃ into g.
2
$x_5=\sqrt[3]{6(2.6045)+2}=\sqrt[3]{17.6273}=2.6025$.
Substitute x₄ into g.
3
Rounded to 3 d.p.: $x_4=2.605$, $x_5=2.603$ — still shifting slightly, but the trend is clearly settling near $2.602$.
Compare successive iterates at the required precision.
4
A few further iterations confirm the root is $x\approx2.602$ (3 d.p.).
Once consecutive iterates agree to the stated accuracy, that shared value is the answer.
▪ solved

Worked example 3

Recognising a cobweb (oscillating) pattern
The equation $x^3+2x-10=0$ is rearranged as $x=\sqrt[3]{10-2x}$. Using $x_0=2$, find $x_1$, $x_2$ and $x_3$ to 4 decimal places, and describe the pattern of convergence.
MethodApply the iteration and track the pattern
1
$x_1=\sqrt[3]{10-2(2)}=\sqrt[3]{6}=1.8171$.
Substitute x₀ = 2 into g(x) = ∛(10 − 2x).
2
$x_2=\sqrt[3]{10-2(1.8171)}=\sqrt[3]{6.3658}=1.8533$.
Substitute x₁ into g.
3
$x_3=\sqrt[3]{10-2(1.8533)}=\sqrt[3]{6.2934}=1.8463$.
Substitute x₂ into g.
▪ solved
This time, a cobweb

The values $2, 1.8171, 1.8533, 1.8463,\dots$ alternate above and below the root $\alpha\approx1.847$ — each iterate overshoots to the opposite side of the last. This oscillating convergence is the cobweb pattern, and it happens because $g'(x)<0$ near the root for this particular rearrangement (unlike Example 1's staircase, where $g'(x)>0$).

Worked example 4

A rearrangement that diverges
Challenge
The same equation from Example 1, $x^3-6x-2=0$, can also be rearranged as $x=\dfrac{x^3-2}{6}$. Using $x_0=3$, find $x_1$ and $x_2$, and comment on what happens.
MethodApply this alternative rearrangement
1
$x^3-6x-2=0 \Rightarrow 6x=x^3-2 \Rightarrow x=\dfrac{x^3-2}{6}$.
Isolate the linear term 6x instead, and divide by 6.
2
$x_1=\dfrac{(3)^3-2}{6}=\dfrac{25}{6}=4.1667$.
Substitute x₀ = 3 into this new g(x).
3
$x_2=\dfrac{(4.1667)^3-2}{6}=\dfrac{70.34}{6}=11.723$.
Substitute x₁ into g. The values are growing rapidly rather than settling.
▪ diverges
Same equation, same starting value — opposite outcome

Both rearrangements in this lesson came from the exact same equation, $x^3-6x-2=0$, and both iterations started from $x_0=3$ — yet Example 1's $g(x)=\sqrt[3]{6x+2}$ converged smoothly while this one runs away toward infinity. The difference is $g'(x)$ near the root: for this rearrangement $g'(x)=\dfrac{x^2}{2}\approx3.4$ at $x\approx2.6$, well outside $|g'(x)|<1$. Choosing a good rearrangement isn't a formality — it's the difference between a method that works and one that doesn't.

Common mistake

Assuming that because a rearrangement produced a valid-looking sequence of numbers, it must be converging — always check whether successive iterates are actually settling down (or check $|g'(x)|$ near the suspected root) before trusting the result. A diverging sequence can still look "reasonable" for the first step or two.

Check yourself

Show that $x^3-3x-5=0$ has a root between $x=2$ and $x=2.5$. Rearrange the equation into the form $x=\sqrt[3]{3x+5}$, then use $x_0=2$ to find $x_1$ and $x_2$, each correct to 4 decimal places.
(Hint: evaluate f at both endpoints first, then substitute repeatedly into g.)

Method
1
$f(2)=8-6-5=-3$. $f(2.5)=15.625-7.5-5=3.125$.
Evaluate f at both endpoints.
2
$f(2)<0$ and $f(2.5)>0$ — a sign change confirms a root in $(2,2.5)$.
Continuity plus a sign change guarantees a root in between.
3
$x_1=\sqrt[3]{3(2)+5}=\sqrt[3]{11}=2.2240$.
Substitute x₀ = 2 into g(x) = ∛(3x + 5).
4
$x_2=\sqrt[3]{3(2.2240)+5}=\sqrt[3]{11.672}=2.2684$.
Substitute x₁ into g.
▪ solved