Newton's method, run on every pixel
Newton's method finds a root of a function f by repeatedly following the tangent line down to where it crosses zero: starting from a guess z, the next guess is z - f(z)/f'(z). For a real function this converges fast near a root and can misbehave far from one. Run the same iteration with complex starting guesses z = x + iy, colour each starting pixel by which root its iteration converges to, and you get a Newton fractal - a picture of the basins of attraction of every root, with all the ordinary convergence guarantees breaking down in spectacular fashion along the basin boundaries.
The iteration and a concrete polynomial
For the simplest interesting case, f(z) = zⁿ - 1, whose n roots are the n-th roots of unity evenly spaced on the unit circle, Newton's update simplifies to:
z_(k+1) = z_k - (z_kⁿ - 1) / (n·z_kⁿ⁻¹)
= ((n-1)·z_kⁿ + 1) / (n·z_kⁿ⁻¹)
Every pixel of the plane is an independent starting value z0. Iterate a fixed number of times (typically 30-60, enough for convergence almost everywhere except right on a boundary), check which of the n roots the final value is closest to, and paint the pixel that root's colour. Shading by the iteration count to convergence, rather than a flat colour, turns the flat basins into banded contour rings that reveal the fractal structure hiding inside what looks like a solid-coloured region.
Why the boundaries are fractal
Near a root, Newton's method converges quadratically - the number of correct digits roughly doubles every step - so deep inside a basin the picture is smooth and boring. The interesting structure lives entirely on the boundary between basins. Because the iteration function z - f(z)/f'(z) is a rational map of the Riemann sphere, its Julia set (the boundary where nearby starting points diverge to different attractors) has the self-similar, infinitely detailed structure typical of complex dynamics: zoom into any boundary point and you find smaller copies of the same three-or-more-basin tangle, forever.
This is a special case of a much older surprising fact from complex dynamics: the boundary between basins of attraction for any rational map with three or more distinct attracting fixed points is either connected or has infinitely many components, and in the Newton's-method case for a generic cubic, the three basins famously all share the same boundary - every boundary point is arbitrarily close to all three basins at once, not just two of them, a genuinely three-dimensional-feeling pathology living in a 2D picture.
Where Newton's method fails to converge at all
Not every starting point settles down. If the derivative f'(z) is ever exactly zero during the iteration the update blows up; more commonly a starting point can fall into a periodic cycle that never reaches any root - for z³ - 2z + 2, the real starting value z0 = 0 famously cycles forever between 1 and 0 without ever converging, a textbook counterexample to naive convergence claims. The fractal image marks such points (or points that fail to converge within the iteration budget) with a distinct 'no convergence' colour, usually black, and these points are exactly where the basin boundaries are thickest and most tangled.
Relaxed Newton and switching polynomials
A damping (relaxation) factor λ changes the update to z_(k+1) = z_k - λ·f(z)/f'(z). At λ=1 you get standard Newton; smaller λ slows convergence but can shrink or reshape the fractal boundary, and complex λ rotates the basin colouring entirely, since it changes the direction each step is allowed to move relative to the tangent line. Switching the polynomial from zⁿ-1 to something asymmetric like z³-2z+2 removes the rotational symmetry of the roots-of-unity case and produces a visibly different, less symmetric tangle of basins - the demo lets you flip between both and re-render live.
Frequently asked questions
Why do the basin boundaries look fractal instead of smooth curves?
Newton's method is a rational map on the complex plane, and the boundary between two or more basins of attraction for such a map is a Julia set - a set with the self-similar, infinitely fine structure typical of complex dynamics. Zooming into any boundary point reveals the same tangle of colours at every scale.
What happens at points where Newton's method never converges?
Some starting points fall into a cycle that revisits the same values forever without approaching any root, or land exactly where the derivative is zero and the update is undefined. These points are marked with a separate colour (often black) in the fractal and cluster densely on the basin boundaries.
Does changing the polynomial change the fractal's symmetry?
Yes. For zⁿ-1, the n roots sit symmetrically on the unit circle, so the fractal inherits an n-fold rotational symmetry. Switching to an asymmetric polynomial like z³-2z+2 places the roots irregularly and produces a basin structure with no such symmetry.
Try it live
Everything above runs in your browser — open Newton's Method Fractal and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Newton's Method Fractal simulation