Fractal Mathematics
The Math of the Mandelbrot Set: z²+c, Step by Step
The most complex object in mathematics is built from one short line: z → z² + c. Here is what that formula means, how to run it by hand, and why a five-character rule produces infinite detail.
Almost everything written about the Mandelbrot set reaches for the same astonishing claim: it is, by a reasonable measure, the most complicated object mathematicians have ever drawn. And almost everything written about it then admits the punchline — that all of that infinite, hallucinatory detail is generated by a formula short enough to fit on a stamp:
zn+1 = zn2 + c
Five symbols. No calculus, no trigonometry, nothing you did not meet by the end of high-school algebra. The gap between how simple that rule looks and how rich its output becomes is the whole story of the Mandelbrot set — and the reason it became the emblem of fractal geometry. This guide opens the formula up one piece at a time: what the letters mean, how to run the rule by hand, and why so little produces so much.
Key takeaway: The Mandelbrot set is the collection of complex numbers c for which the sequence z₀ = 0, z₁ = c, z₂ = c² + c, … stays bounded forever instead of racing off to infinity. You test a point by squaring and adding c over and over; if the running value never grows past a magnitude of 2, the point is in the set. That single pass-or-fail test, run for millions of points, draws the entire image.
What does z² + c actually mean?
The formula is an iteration — a rule you feed its own output. You start with a number, apply the rule to get a new number, then apply the rule to that, and so on. Written out, zn+1 = zn2 + c simply says: the next z is the current z squared, plus the fixed number c.
Two pieces carry the meaning:
- c is the point you are testing. It stays the same the whole time. Every pixel of a Mandelbrot image corresponds to one value of c, and the picture answers a single yes/no question about each one.
- z is the running value. It always begins at z0 = 0 and changes at every step. (Some references, like Wolfram MathWorld, equivalently start at z₀ = c; because the first squaring of zero gives zero, both conventions produce the same orbit from the second term on.)
The crucial twist is that z and c are not ordinary numbers on a line — they are complex numbers, points on a two-dimensional plane. A complex number has the form a + bi, where a is the horizontal (real) coordinate, b is the vertical (imaginary) coordinate, and i is the famous square root of −1. That is why the Mandelbrot set is a picture rather than a set of points on a number line: the plane it lives on is the complex plane, exactly as your hero image shows. The deep link between fractals and complex arithmetic is what makes escape-time sets like this one possible at all, as Benoit Mandelbrot recognized when he first visualized the set at IBM on March 1, 1980.
Squaring a complex number
Squaring is the only arithmetic the formula needs, and for complex numbers it follows one rule: multiply it out and remember that i² = −1. For z = a + bi:
z² = (a + bi)² = a² − b² + 2ab·i
Geometrically, squaring a complex number doubles its angle from the positive real axis and squares its distance from the origin. That single fact is the engine of the whole set: points already far from the origin get flung outward explosively, while points near it can circle the origin forever without escaping. The boundary between those two fates is where all the structure lives.
How do you test a point step by step?
The procedure, called the escape-time algorithm, is gloriously mechanical. Pick your c, set z to zero, and iterate, watching the magnitude (the distance from the origin) at each step.
Example 1 — c = 1 (a real point that escapes). Here c sits on the real axis, so the arithmetic stays ordinary:
| Step | Calculation | Value of z | Magnitude |z| |
|---|---|---|---|
| z₀ | start | 0 | 0 |
| z₁ | 0² + 1 | 1 | 1 |
| z₂ | 1² + 1 | 2 | 2 |
| z₃ | 2² + 1 | 5 | 5 |
| z₄ | 5² + 1 | 26 | 26 |
| z₅ | 26² + 1 | 677 | 677 |
The magnitude blows past 2 and keeps doubling-then-some forever. So c = 1 is not in the Mandelbrot set — it escapes to infinity.
Example 2 — c = −1 (a real point that stays trapped). Watch what a single minus sign does:
| Step | Calculation | Value of z |
|---|---|---|
| z₀ | start | 0 |
| z₁ | 0² + (−1) | −1 |
| z₂ | (−1)² + (−1) | 0 |
| z₃ | 0² + (−1) | −1 |
| z₄ | (−1)² + (−1) | 0 |
The orbit locks into a tidy two-step cycle, 0 → −1 → 0 → −1 → …, never escaping. So c = −1 is in the set. It happens to sit inside the round period-2 bulb attached to the left of the main body — a region where every orbit eventually settles into a repeating 2-cycle. Compare that with c = 0, which gives 0 → 0 → 0 forever (trivially bounded, also in the set), and you start to feel how sensitively the outcome depends on c.
The escape test: why the magic number is 2
You do not have to iterate forever to decide a point's fate. There is a clean stopping rule: if the magnitude |z| ever exceeds 2, the orbit is guaranteed to escape to infinity and you can quit. Wikipedia states the criterion exactly: "a point c belongs to the Mandelbrot set if and only if |zn| ≤ 2 for all n ≥ 0." Wolfram MathWorld uses the same escape radius, coloring points "according to the number of steps required to reach rmax = 2." Once you cross that threshold, squaring grows the value faster than adding c can ever pull it back, so escape becomes irreversible.
In practice you also set an iteration cap — say 1,000 passes. If c survives every pass without exceeding magnitude 2, you treat it as inside the set and color it black; if it escapes at step n, you color it by n. That escape count, mapped to a palette, is what produces the famous glowing halos around the set's edge.
Why does such a simple rule create infinite detail?
The honest answer is that the simplicity is on the surface. The rule is short, but it is nonlinear (the squaring) and fed back into itself indefinitely, and that combination is exactly the recipe for what mathematicians call sensitive dependence — the hallmark of fractal geometry and its cousin, chaos theory. Two values of c a millionth of a unit apart can land on opposite sides of the boundary, one trapped and one escaping. Where outcomes flip that violently, the dividing line cannot be smooth; it must be infinitely crinkled.
How crinkled? In 1991, mathematician Mitsuhiro Shishikura proved a result that quantifies it precisely. The boundary of the Mandelbrot set has a fractal dimension of exactly 2 — the maximum possible for a curve drawn in a plane.[^shishikura] An ordinary line has dimension 1; a filled-in shape has dimension 2. The Mandelbrot boundary is technically a curve, yet it wiggles so relentlessly that it is, in the dimensional sense, as space-filling as a solid region. That is the formal statement of what your eye reports when you zoom: the edge never resolves into anything simple. This is also why the set is the textbook illustration of self-similarity — zoom into the boundary and miniature near-copies of the whole set reappear, surrounded by new spirals and seahorse tails that no one designed and no one fully catalogs.
It is worth stressing what is not happening here. The detail is not stored anywhere; the image is not a giant file of hand-placed dots. Every feature is recomputed on demand from the same five-symbol rule. As the pillar guide What Is a Fractal? puts it, this is the defining trick of fractals — a simple rule, repeated at every scale, producing complexity without bound.
The set is one connected piece
A natural worry, looking at the islands that seem to float off the main body, is whether the Mandelbrot set is actually several disconnected blobs. It is not. In the early 1980s, Adrien Douady and John H. Hubbard proved that the Mandelbrot set is connected — every apparent island is in fact joined to the mainland by filaments too thin to see at ordinary resolution.[^douady] The set you can hold in one mathematical hand is a single object, which only deepens the puzzle of how one short formula stitches it all together.
How is this formula related to Julia sets?
The same expression z² + c generates a second, equally famous family of fractals — the Julia sets — by changing one rule of the game. For the Mandelbrot set you fix the starting z at 0 and vary c across the plane. For a Julia set you do the opposite: you fix c at a single chosen value and vary the starting point z across the plane, then ask which starting points stay bounded. The result is that the Mandelbrot set works like an index, or a map of contents, for the infinitely many Julia sets: each point of the Mandelbrot set corresponds to its own Julia set, and a point's location relative to the boundary predicts whether its Julia set will be a single connected piece or scattered dust. If you want to run the formula yourself, see our companion how-to on drawing fractals in Python, where the escape-time loop above turns into about a dozen lines of code.
References
[^shishikura]: Mitsuhiro Shishikura, "The Hausdorff dimension of the boundary of the Mandelbrot set and Julia sets" (preprint submitted April 1991), Annals of Mathematics, vol. 147 (1998), pp. 225–267. Theorem A: the boundary of the Mandelbrot set has Hausdorff dimension 2.
[^douady]: A. Douady and J. H. Hubbard, Étude dynamique des polynômes complexes (the "Orsay Notes," 1982–1985), in which the connectedness of the Mandelbrot set is established; summarized at Wikipedia — Mandelbrot set.
Frequently asked
What is the Mandelbrot set formula?
The Mandelbrot set is generated by the iteration zₙ₊₁ = zₙ² + c, where z and c are complex numbers and z starts at 0. To test a point c, you repeatedly square the current value of z and add c, watching how the magnitude (distance from the origin) behaves. If the magnitude stays bounded forever, c is in the set; if it grows without limit and escapes to infinity, c is outside it. The whole image is just this single pass-or-fail test applied to millions of points c across the complex plane, with each point colored by whether it stayed trapped or how quickly it escaped.
What do z and c mean in z² + c?
In the formula zₙ₊₁ = zₙ² + c, the letter c is the fixed point you are testing — it represents one pixel on the complex plane and never changes during the calculation. The letter z is the running value that updates at every step, and it always begins at z₀ = 0. Both are complex numbers of the form a + bi, meaning they are points on a two-dimensional plane rather than a one-dimensional number line. That is precisely why the Mandelbrot set is a picture: you are sweeping c across an entire plane and recording, for each location, whether the iteration of z stays bounded or runs away to infinity.
How do you calculate the Mandelbrot set by hand?
Pick a value of c, set z = 0, then iterate z → z² + c, recording the magnitude each step. Try c = 1: you get 0, then 1, then 2, then 5, then 26 — the values explode, so c = 1 is not in the set. Now try c = −1: you get 0, then −1, then 0, then −1, cycling forever without escaping, so c = −1 is in the set. The shortcut is the escape test: as soon as the magnitude |z| exceeds 2, the orbit is guaranteed to diverge and you can stop. If a point survives a chosen number of iterations (say 1,000) without ever crossing magnitude 2, you treat it as a member of the set.
Why does the Mandelbrot set use the number 2 as an escape value?
The number 2 is the proven escape radius: once the magnitude of z exceeds 2, the squaring term overwhelms the additive c term so completely that the orbit can never recover and is guaranteed to race off to infinity. Wikipedia states the criterion exactly — a point c belongs to the Mandelbrot set if and only if the magnitude of zₙ stays at or below 2 for every step — and Wolfram MathWorld colors escaping points by how many steps they need to cross that same radius of 2. This makes 2 the natural cutoff for the escape-time algorithm: there is no need to iterate forever, because crossing 2 settles a point's fate permanently.
Why is such a simple formula so complex?
The formula looks simple but it is nonlinear — because of the squaring — and it is fed back into itself indefinitely, and that combination produces extreme sensitivity. Two values of c separated by a millionth of a unit can end up on opposite sides of the boundary, one trapped and one escaping, so the dividing line between them cannot be smooth. Mathematician Mitsuhiro Shishikura proved in 1991 that this boundary has a fractal dimension of exactly 2, the maximum possible for a curve in a plane: it is technically a curve, yet it wiggles so relentlessly it is effectively space-filling. The detail is never stored — it is recomputed on demand from the same five-symbol rule at every level of zoom.
What is the difference between the Mandelbrot set and a Julia set?
Both come from the identical formula z² + c, but they fix and vary different things. For the Mandelbrot set you fix the starting value z at 0 and vary c across the whole complex plane, asking which values of c stay bounded. For a Julia set you fix c at a single chosen value and instead vary the starting point z across the plane, asking which starting points stay bounded. The relationship is that the Mandelbrot set acts as an index for all possible Julia sets: each point of the Mandelbrot set corresponds to its own Julia set, and whether that point lies inside or outside the boundary predicts whether its Julia set will be a single connected piece or scattered dust.