Guide // Complex numbers
Complex numbers explained: the math behind Mandelbrot
A complex number is a number with two parts, a real part and an imaginary part, written a + bi, where i is defined by i² = −1. That is all the arithmetic you need to follow the Mandelbrot set. This page covers the complex plane, adding, multiplying and squaring, and then does the z² + c steps by hand.
01Two parts in one number
An ordinary number sits on a line. A complex number needs two ordinary numbers, so it has a real part a and an imaginary part b, and it is written a + bi. The symbol i is a number defined by one rule: i times i is −1.
No ordinary number squares to a negative, which is why i was added as a new kind of number. Everything else follows from treating i like any other symbol and replacing i² with −1 whenever it appears.
i² = −1z = a + bi
02The complex plane
Because a complex number has two parts, it is a point on a plane. The real part is the horizontal position and the imaginary part is the vertical position. So 2 + 3i is the point two to the right and three up, and 0 + 0i is the origin.
This is the picture behind every Mandelbrot image. Each pixel is one complex number c, and the picture colours the plane by what happens to that c under one rule.
03Adding is moving
To add two complex numbers, add the real parts and add the imaginary parts separately. On the plane this is a shift: adding c to z moves the point z by the same distance and direction that c lies from the origin.
The "+ c" in z² + c is therefore a shift, and the squaring is where the interesting change happens.
(a + bi) + (c + di) = (a + c) + (b + d)i 04Multiplying and squaring
To multiply, expand the brackets as usual and replace i² with −1. The imaginary-times-imaginary term bd becomes −bd and joins the real part. Squaring is the special case where both numbers are the same.
Writing z = x + yi, the square has a real part x² − y² and an imaginary part 2xy. This is exactly what a program computes for each pixel, using only ordinary multiplication and addition.
(a + bi)(c + di) = (ac − bd) + (ad + bc)i(x + yi)² = (x² − y²) + 2xy·i
05Size and angle
Every point on the plane has a distance from the origin, called its modulus, and an angle measured from the positive real axis. For z = x + yi the modulus is the square root of x² + y², from the Pythagorean theorem.
Multiplication has a clean geometric meaning in these terms: the moduli multiply and the angles add. So squaring a number squares its distance and doubles its angle. A point inside the unit circle is pulled toward the origin, and a point outside it is thrown further out.
|z| = √(x² + y²)|z²| = |z|², angle(z²) = 2 · angle(z)
06Doing z² + c by hand
The Mandelbrot rule starts at z = 0, squares, adds c, and repeats. Take c = 1. The values are 0, 1, 2, 5, 26 and keep growing, so c = 1 is outside the set.
Take c = −1. The values are 0, −1, 0, −1 and repeat forever, so c = −1 is inside. Take c = i. The values are 0, i, −1 + i, −i, then −1 + i and −i again, a cycle that never grows, so c = i is inside too. Three small examples already show the three behaviours the picture is built from: escaping, repeating and settling into a cycle.
Once |z| passes 2 the numbers can never return, which is the escape test from the Mandelbrot set guide. A program applies it to every pixel and counts the steps.
c = 1: 0 → 1 → 2 → 5 → 26 → …c = −1: 0 → −1 → 0 → −1 → …
07From arithmetic to an image
Our Brot poster is the whole set, centred at −0.6986 + 0.0016i, with a window 3.1 units wide. It tests about 1.5 million points with up to 400 steps each. In the data, 15.07 percent of those points never escape, and the mean escape count of the others is 5.9 steps.
Most points leave within a few steps, exactly like c = 1 above. The bright edge is made of points that take much longer to decide.
08Zooming is choosing a smaller window
A zoom picks a new centre c and a smaller width, then repeats the same arithmetic for every pixel. Nothing about the rule changes. Far Out There is a window 0.0035 wide centred at −0.7616 − 0.0848i, rotated −15.1 degrees, about 886 times closer than the full view, with 1,400 steps per pixel.
In this window only 2.22 percent of the points stay inside and the mean escape count is 147.6 steps. The Mandelbrot zoom guide explains why such windows need more steps, and the Julia set guide shows what happens when c is fixed and the starting z varies instead.
09How our posters relate to complex numbers
Each Mandelbrot poster is one window on the complex plane, drawn by a program written in JavaScript that repeats the squaring rule above for every pixel. The product page lists the centre, the width and the step limit, so you can repeat the calculation yourself, and the /play/ page lets you try a related rule with your own numbers.
What you see is exactly the print you get, fine art matte paper.
FAQQuestions
What is a complex number in simple terms?
It is a number of the form a + bi, where a and b are ordinary numbers and i is defined by i² = −1. It can be drawn as a point on a plane.
What is the complex plane?
It is a plane where the horizontal axis holds the real part and the vertical axis holds the imaginary part of a complex number, so each number is one point.
How do you square a complex number?
For x + yi, the square is (x² − y²) + 2xy·i. Geometrically, the distance from the origin is squared and the angle is doubled.
Why does the Mandelbrot set need complex numbers?
The rule z² + c is applied to points of a plane, and complex arithmetic gives every point a square and a sum, so each pixel can be tested with the same two operations.