We are about to show that you can get incredible structure from the simplest of algorithms when we use complex numbers.

The equation we are going to look at is an iterative equation:

$z_{i+1}=z_i^2+C$

with $z_0=0$. You simply get the next $z_i$ from plugging in the previous one, squaring it and adding a number $C$. I’m going to give you a value for $C$, then you’re going to iterate this equation and see what happens. For instance, if I give you the number $C=3$:

$\left( \begin{array}{ccc} i & z_i^2+C & \left| z_{i+1}\right| \\ 1 & 0^2+3 & 3 \\ 2 & 3^2+3 & 12 \\ 3 & 12^2+3 & 147 \\ 4 & 147^2+3 & 21612 \\ \end{array} \right)$

You can see that this number is just going to keep on increasing without end if we keep applying the algorithm. How about a smaller number, let’s say $C=0.1$:

$\left( \begin{array}{ccc} i & z_i^2+C & \left| z_{i+1}\right| \\ 1 & 0^2+0.1 & 0.1 \\ 2 & 0.1^2+0.1 & 0.1121 \\ 3 & 0.1121^2+0.1 & 0.112566 \\ 4 & 0.112566^2+0.1 & 0.112671 \\ \end{array} \right)$

It looks like this is tending to some value. In fact it has come to a fixed point where $z=z^2+0.1$. There are actually two solutions to this equation but one of them is 0.112702 which is where we are tending towards. I can clearly perform this procedure with $C$ being any number and I can ask whether the $z_i$ diverges as $i\rightarrow \infty$, or whether it always stays small. In fact I can be a bit more strict. I can ask whether the magnitude of the $z_i$ always stays less than $2$ or whether it becomes greater than $2$. Let’s ask this for all numbers which are real.

It turns out that this is a pretty easy problem. If $-2 then the magnitude of $z$ always stays below 2 and if it’s outside this range, then it blows up. As an example Let’s look at the value of the $z_i$ as we iterate for numbers just below and just above $C=0.25$. This is shown in the figure below}

Values of $|z_i|$ for $C=0.249$ (blue points) and $C=0.251$ (red points). We see that for the blue points the value of $|z_i|$ converges to 0.5, whereas for $C=0.251$ it diverges. It is true that for all points between -2 and 0.25 $z_i$ converges and for all points outside of this set of numbers, it diverges.

But we’ve only looked at values of $C$ on the real line, and frankly the results were not very interesting. Why should it be any more interesting if we let $C$ be any complex number? It turns out that the answer is both surprising and beautiful.

We’ll work out what is the set of complex numbers for which $z_i$ always stays below 2 using a technique of picking numbers in the complex plane at random and testing them – ie. plugging them into the iterative algorithm and seeing what happens to $z_i$. We’re only going to run the iterative algorithm for a maximum number of times, but if during that time the magnitude of $z$ goes above 2 we will quite the algorithm and say that that value of $C$ that we used is not in the set that we are interested in. In fact to get the set accurately we would have to be more sophisticated than this and run the algorithm in a more intelligent way so that we’re not including points in the set which should not be there. For instance, in the figure above had we only run the algorithm 50 times, we would have thoughts that 0.251 was in the set, whereas we see that eventually, the magnitude gets above 2 and so it’s not in the set. However, for the purposes of this explanation, running the algorithm 100 times will be sufficient to see the complexity emerge.

Let’s try with a random complex number. Let’s take $C=\frac{1+i}{4}$. This, together with $C=\frac{1+i}{2.5}$ is shown in the figure here:

Values of $|z_i|$ for $C=\frac{1+i}{4}$ (blue points) and $C=\frac{1+i}{2.5}$ (red points). For the blue points the values fluctuation but get closer and closer to a fixed value which is less than 2, whereas for the red points, they quickly diverge.

We can see immediately that the behaviour looks somewhat different. For real numbers the numbers either converged, or diverged fairly obviously, but for complex numbers they seem to oscillate before they converge or diverge and it’s not altogether clear what will happen if you look at the values at any particular $i$.

Let’s now take random points in the complex plane (values of $C$) and if the value of $|z_i|$ converges, we’ll put a blue point there and if it diverges (within 100 iterations of the algorithm) we’ll put a red point there. What will this look like? This is shown in the figure here for 100,000 random points.

Graph of those values of $C$ (in the complex plane) for which the iterative values of $|z_i|$ diverge within 100 iterations (in red) and those for which they don’t (in blue). This is a sample of around 100,000 points.

You can see that it looks rather like a random splotch of paint. In fact it turns out that this really isn’t a very detailed view of the set at all (the word set in ‘Mandelbrot set’ is because we are looking for the set of numbers with a particular behaviour, in this case the blue points are in the set, and the red points are not). In fact it turns out that there is an infinite amount of detail to be see. What does this mean. Well, let’s say that we take a small patch of the previous figure and try and look at it in more detail. Let’s take a region of the complex numbers $C$ with real parts between 0.2 and 0.5 and imaginary parts 0.25 and 0.8. We sample in this smaller region with 100,000 points and find the image here:

We zoom in on a small region of this graph to try and get down to the lowest level of detail. We’ve taken a small part of the previous figure and sampled 100,000 points in that small region.

But it looks like there might be more structure at even smaller levels. Let’s zoom in on an even smaller region here. In the next figure we look at a small region in the previous one. In particular we look at complex numbers $C$ with real parts between 0.3 and 0.325 and imaginary part between 0.55 and 0.62.

We now take a small region of the previous figure and zoom in on that, again sampling a very small area with 100,000 random points.

Again, we zoom in on a tiny region in this figure, again sampling 100,000 points, but this time in the tiny region of $C$ with real part between 0.315 and 0.316 and imaginary part between 0.576 and 0.578. This is shown here:

Sampling a small region in the previous figure with another 100,000 points. We find that we can zoom in further and further and there will always be more detail at every level. This goes on for an infinite number of zooms!

In fact we could keep doing this for every and the images would never become smooth and we would never stop getting more detail. This is a fractal and you can zoom in infinitely far and keep seeing more structure. Think of this like a coastline. If you take a picture of a country from above, you will get a certain detail of the coastline, but as you zoom in more and more you will start to see the structure of individual beaches, then further in you will see structure of individual curves in the beach, then you will start to see structure in the rocks in the beach, then you will start to see structure in the sand, then in smaller and smaller particles. However, you can only zoom in so far because there seems to be a fundamental limit to the scale of the universe. However, a fractal is different. In the mathematical world you can zoom in more and more and always get more detail….always!!! This is a pretty amazing fact for such a simple equation and its because of the wonderful behaviour of complex numbers that we get this complexity!

In fact using a relatively small number of sample points (only 100,000) doesn’t give us a very good picture of the intricacy of the image. In  the figure below there is an image taken from wikipedia which shows in much better detail the mandelbrot set

A much better rendering of the Mandelbrot set, though it’s not as obvious here how it is found as with our discrete sampling technique. Anything in black is in the set, anything in white is not in the set. Each of the nodes can be zoomed into infinitely far and you will never stop seeing new structure. https://en.wikipedia.org/wiki/Mandelbrot_set#/media/File:Mandelset_hires.png

What we have done here is very crude, we have only zoomed in a tiny bit (in fact, what does tiny mean when we can zoom in infinitely far, in theory – isn’t anything tiny compared to that?). Here is a video of a Mandelbrot set over 200 orders of magnitude. Note that the colours are related to those numbers which are not in the set but they can be colour coded by the number of iterations it takes for the algorithm to give you a $z_i$ whose magnitude is greater than 2.

What is truly amazing here is that from a truly simple algorithm we are able to create infinite complexity. We have seen a number of times now how the complex numbers helps us to build a bridge between seemingly unconnected areas, and now we see how it links us to the world of chaos, fractals, and complexity. Sadly in the first year we are only able to skim the surface of what complex numbers can really bring us, but for those who are going to go on and study more mathematics through university, you will see a whole world of possibilities open up to you…

 How clear is this post?