Iteration: solving equations with x = g(x), cobweb and staircase diagrams

Rearrange an equation to x = g(x), pick a start value and step the iteration one press at a time with a table to six decimal places and a cobweb diagram that shows whether it converges or diverges.

Keep it one tap away for everyday use.

Bookmark Iteration?

Press Ctrl + D now. Your browser opens its own bookmark box, where you choose the name and folder.

Or install fibub as an app: every tool you open then works offline.

  1. g(x)
  2. Step
  3. Cobweb
  4. Quiz
Nothing is uploadedWorks offline once open

Some equations cannot be solved with a formula. Rearrange to x = g(x), guess a start value x₀, then feed each answer back in: x₁ = g(x₀), x₂ = g(x₁), and so on. If the numbers settle down, you have a root.

nxₙg(xₙ) = xₙ₊₁

Try this

  • Pick x³ + 4x − 1 = 0 with x = (1 − x³)/4 and press Step. How many steps until the 6th decimal place stops changing?
  • Now pick the same equation with x = ∛(1 − 4x). Why does it fly away from the root?
  • For x² − 5x + 3 = 0, try both rearrangements. Each finds a different root. Which, and why?
  • Look at the diagram: a staircase means the slope of g is between 0 and 1, a spiral means it is between −1 and 0.

Check yourself

What it does

Many equations, like x³ + 4x − 1 = 0, have no neat formula. Iteration finds an answer by guessing and improving. Rearrange the equation into the form x = g(x), such as x = (1 − x³) ÷ 4. Choose a start value x₀, work out x₁ = g(x₀), then x₂ = g(x₁), and keep going. If the numbers settle, they have found a root, a value where x = g(x) exactly.

Each press of Step adds one row to the table (to six decimal places) and one more step to the diagram. The picture shows the line y = x and the curve y = g(x). The path goes up to the curve, across to the line, up to the curve again. It makes a staircase or a spiral that closes in on the root, or runs away if the rearrangement is no good. To explore more methods and graphs, see numerical methods teacher, graphing calculator and quadratic explorer.

How to use it

  1. Pick an equation and rearrangement, or choose “Type my own g(x)”.
  2. Set the start value x₀, then press Step, or Run 10 for ten steps at once.
  3. Watch the table and the diagram, and read whether it is converging or diverging.
  4. In A-level, read the slope test |g′(root)| and the comparison with Newton–Raphson.
  5. Answer the quiz, which uses new numbers each time.

What each setting does

  • Rearrangement: different forms of the same equation behave very differently.
  • x₀: where you start. Some starts converge to one root and some to another.
  • Step and Run 10: how many iterations to do.
  • Diagram: the orange path is the iteration, the green dot is the root.
  • Newton column (A-level): the same start value, using Newton–Raphson instead.

Worked example

Take x³ + 4x − 1 = 0 written as x = (1 − x³) ÷ 4 with x₀ = 0. Then x₁ = (1 − 0) ÷ 4 = 0.25, x₂ = (1 − 0.015625) ÷ 4 = 0.246094, and after a few more steps the value settles at 0.246263. The slope of g near the root is only about 0.045, so each step makes the error about 20 times smaller. The other rearrangement x = ∛(1 − 4x) has a slope of about −21 at the same root, so it moves away from it.

FAQs

Why does one rearrangement work and another fail? It depends on how steep g is at the root. If |g′| is less than 1, errors shrink. If it is more than 1, they grow.

What do the staircase and the spiral mean? A staircase happens when g slopes up (between 0 and 1), a spiral when it slopes down (between −1 and 0).

Is Newton–Raphson better? Usually much faster, but it needs the derivative. The A-level view compares the number of steps for both.

Where the numbers come from

  • Fixed-point iteration x(n+1) = g(x(n)) and Newton-Raphson are standard numerical methods. Serves GCSE maths (higher tier, iteration), A-level pure maths (numerical methods) and general numerical methods courses; the convergence test |g'(root)| < 1 is the standard fixed-point theorem. Checked against hand-worked values in tests/curr-maths.mjs. Pictures are fibub's own.

Standard scientific values, such as constants, atomic weights and melting points, are facts found in every textbook; we name where ours were checked. If you are an author or publisher and want a value, a credit or a table changed or removed, tell us and we will act quickly.

Last updated 2026-11-16.

Change log for Iteration

  1. Learn: 18 curriculum simulations (#L340-#L357) for Ontario, USA and UK topics Details on GitHub

Every change to fibub

Related tools

Graphing calculator #T369 Plot y = f(x), any equation in x and y, polar r(θ) and parametric (x(t), y(t)) curves together, with sliders, zoom, tap-to-trace, roots, turning points and crossings, plus 3D surfaces z = f(x, y). Download PNG, SVG or CSV. Runs in your browser. Numerical methods teacher #T378 See numerical methods work step by step: root finding by bisection, false position, Newton and secant with iteration tables; integration by the trapezoid, Simpson, Gauss-Legendre and Romberg rules with error plots; and Lagrange, Newton divided-difference and cubic spline interpolation. Checked against scipy. Quadratic explorer #L68 Slide a, b and c and watch the parabola move: vertex, roots and the discriminant update live, completing the square is drawn with tiles, and the middle term is split for you. With fresh practice questions. Pythagoras proof playground #L69 Drag a right triangle and watch the squares on its sides add up. Slide through four visual proofs (rearrangement, Bhaskara, similar triangles, Baudhayana) with your own side lengths, and list Pythagorean triples. Trig ratio explorer #L70 Drag the angle of a right triangle and see sin, cos and tan as ratios of its sides, with the exact values at 0°, 30°, 45°, 60° and 90°, the identities checked live, and the full unit circle for Class 11. Heights and distances #L71 A tower, one or two observers and their lines of sight. Drag the person, set the angles, and get the height, the distance or the angle of elevation with every step of the trigonometry shown.