Newton’s fractal — three roots and one map
Give each of the three solutions of z³ = 1 a different color. Pick a starting point and apply Newton’s step repeatedly. The color shows which solution the steps reach. Near a basin boundary, moving the starting point a little can send it to a different root.
Which root will the point reach?
Drag the white ring or click or tap anywhere on the map. With the map focused, use the arrow keys to move the point. Hold Shift for smaller steps.
- Starting point
- Re 0.13 · Im 0.64
- Orbit result
- Root 3
- Number of steps
- 8
- Root 1
- Root 2
- Root 3
The color identifies the root. Darker shades indicate more steps.
Video walkthrough
Three roots on the complex plane
We solve z³ = 1 on the complex plane. The horizontal axis shows the real part of a number, and the vertical axis shows its imaginary part. Root 1 is on the right, root 2 is at the upper left, and root 3 is at the lower left. All three are one unit from the origin.
- 1
- −1/2 + i√3/2
- −1/2 − i√3/2
How the orbit is built
For f(z) = z³ − 1, Newton’s step is z → z − f(z)/f′(z). Substituting f′(z) = 3z² gives the shorter expression below. Each step uses the latest value of z and keeps the equation fixed.
z → (2z + 1/z²) / 3
For example, the first step from z = 2 lands at 17/12 ≈ 1.42. The next values approach root 1. Starting at a root requires zero steps. At zero, the denominator is zero and the next step is undefined.
Why nearby starts take different paths
Choose point A and then point B. They are at the same height and only 0.03 units apart horizontally. In this example, A leads to root 3 and B leads to root 1. Drag the marker between them to see how the whole path changes.
A root’s basin of attraction consists of starting points whose orbits converge to that root. We color each basin by its root and use darker shades where convergence takes more steps. Close to the boundary, the basins interleave and reveal more detail when magnified.
Checking one starting point
We count an orbit as reaching a root when its distance from that root is at most 10⁻⁶. We check up to 48 steps after the start. If the check finds no root within that budget, the pixel stays dark. The result is limited to the steps we checked.
With a limit of K steps, checking one point takes O(K) time and O(1) space. A map of W × H pixels can take O(W × H × K) time. The map is precomputed, so dragging only recalculates one orbit. Storing the points along that orbit takes O(K) space.
Show executable code
function newtonRoot(re, im) {
const h = Math.sqrt(3) / 2;
const roots = [[1, 0], [-0.5, h], [-0.5, -h]];
const tolerance = 0.000001;
const limit = 48;
for (let steps = 0; steps <= limit; steps++) {
const r2 = re * re + im * im;
if (!Number.isFinite(r2)) return { kind: "limit", steps };
const root = roots.findIndex(([a, b]) =>
(re - a) ** 2 + (im - b) ** 2 <= tolerance ** 2
);
if (root >= 0) return { kind: "root", root: root + 1, steps };
if (r2 === 0) return { kind: "pole", steps };
if (steps === limit) break;
const u = re / r2;
const v = -im / r2;
re = (2 * re + (u - v) * (u + v)) / 3;
im = (2 * im + 2 * u * v) / 3;
}
return { kind: "limit", steps: limit };
}Further reading
Fractal Basins of Attraction Associated with a Damped Newton’s Method