The Mandelbrot set: infinity from z² + c
In fractal art and zoom videos, and as a classic way to test how fast a computer or graphics card is
What problem does it solve?
What happens if you square a number, add a constant, and repeat forever, and how do you draw that?
The big idea
Every pixel is a complex number c, a point in the plane. Start at z = 0 and keep applying z → z² + c. Squaring a complex number squares its distance from 0 and doubles its angle, so the point spins and stretches. Some c's stay trapped forever (black, in the set); others escape to infinity, coloured by how fast they escape. Once |z| passes 2 it's proven to escape, which gives a simple stopping rule. The boundary is infinitely detailed: zoom anywhere and new spirals, seahorses and tiny copies of the whole set appear.
How it works, step by step
- 1. For each pixel, set c = x + yi from its position.
- 2. Start with z = 0.
- 3. Repeat z → z² + c, up to a maximum number of steps (say 500).
- 4. If |z| ever exceeds 2, stop and colour the pixel by the step count.
- 5. If it never escapes, colour it black.
The key formula
- the complex number for this pixel: x + yi
- square: distance from 0 squared, angle doubled (Euler's circle in action)
- the escape test: once outside radius 2, it is guaranteed to fly off to infinity
How fast is it?
Each pixel needs up to hundreds of iterations, and deep zooms need thousands plus extra-precise numbers, because ordinary 64-bit numbers run out of digits after zooming in about 10¹³ times. Every pixel is independent, so graphics cards compute millions at once.
Try it yourself
- By hand, try c = −1: 0 → −1 → 0 → −1… In or out? Now c = 1: 0 → 1 → 2 → 5 → 26…
- Try c = i: 0 → i → −1 + i → −i → −1 + i… It cycles, so it's in the set.
Fun fact
Benoit Mandelbrot's computer pictures of it, made at IBM around 1980, made it famous (Robert Brooks and Peter Matelski had printed a rough one in 1978). Its area is about 1.5066, but nobody knows a formula for it, and its boundary is so wiggly that its fractal dimension is 2, as 'thick' as a filled area (proved by Mitsuhiro Shishikura in 1998).