Numerical Methods · interactive

Root Finding & Fixed-Point Iteration

How does a computer solve f(x) = 0 when there's no formula? It guesses, then improves — over and over. Watch three classic methods hunt down a root, and discover the surprising truth of fixed-point iteration: the same equation, rearranged two different ways, can either home in on the answer or fly off to infinity.

▶ Play 📖 Learn the theory
Fixed-point: rearrange f(x)=0 into x = g(x), then iterate xₙ₊₁ = g(xₙ).

Cobweb diagram · the staircase to the root

Method

The classic test · x³ − x − 1 = 0

Root ≈ 1.3247. For fixed-point, try each rearrangement and see which converges:

What happened

Press ▶ Run.

The big idea

Most equations can't be solved with a tidy formula, so we solve them iteratively: start with a guess and apply a rule that (hopefully) produces a better guess, again and again, until it stops changing. The art is choosing a rule that actually converges — and converges fast.

Fixed-point iteration & the cobweb

Rewrite f(x) = 0 as x = g(x); a solution is now a fixed point where the curve y = g(x) crosses the line y = x. Iterating xₙ₊₁ = g(xₙ) traces the famous cobweb: go up to the curve, across to the diagonal, repeat. Here's the catch that surprises everyone — it converges only when the curve is flatter than the diagonal at the root:

converges ⟺ |g′(x*)| < 1

That's why x = x³ − 1 explodes (its slope at the root is ≈ 5.3) while the algebraically identical x = (x+1)^(1/3) glides right in (slope ≈ 0.19). Same equation, opposite fate — the rearrangement is everything. The lab computes g′ numerically and tells you which side of 1 you're on.

Newton & secant

Newton's method follows the tangent line down to the axis: xₙ₊₁ = xₙ − f(xₙ)/f′(xₙ). It's blisteringly fast (the error roughly squares each step — quadratic convergence) but needs the derivative and a decent starting guess. The secant method replaces the tangent with a line through the last two points, so it needs no derivative — slightly slower, but cheap and robust. This lab estimates derivatives numerically, so you only type the function.

EngineeringCandy · Numerical Methods · safe expression parser, iterations computed live · type it, break it, learn