Maths Town (title)
Maths Town (title)
Home News After Effects Plugins Complex Functions Fractal Articles Fractal Videos

The Mandelbrot Explained Video

The Mandelbrot Explained video is my first attempt at an explainer video. It is published on "The Mathemagicians' Guild" Channel.


Most of the animations in this video were hand coded in c++. I created the animations as a plug-in for Adobe After Effects so it could be more easily animated.


The Mandelbrot set is one of the most beautiful objects in mathematics. In it we find an infinite amount of beautiful shapes and patterns. The detail is literally endless. There are plenty of videos online showing you how it is calculated, but none really explain why we get such interesting detail. Today, we are going to take a different journey. I'd like you to understand what is really happening under the hood of The Mandelbrot Set. Because the more you understand it, the more you will be able to marvel at some of its more interesting properties.

Such explorations are usually part of a post-graduate complex dynamics course, but today we're going to take this journey using only simple mathematics. This will be a mostly visual explanation, so that you can build an intuitive understanding. It should put you on a solid footing to enjoy the fascinating concepts that I'd like to cover in future videos. There are so many amazing aspects of the Mandelbrot set to explore.

The Mandelbrot set is a type of shape known as a fractal. It is calculated in the number system known as the complex numbers. The complex numbers are two-dimensional. The black part is the actual Mandelbrot Set. The coloured area is outside the Mandelbrot Set

However, to begin our explanation we will be restricting ourselves to one dimension. The line right in the center of the Mandelbrot set On this line there is nothing complex. Here we just find our everyday real numbers. Afterwards we will expand our view to the second dimension.

Before we go too deep, I think it will be helpful to step back and talk about chaos.

In the 1970s Edward Lorenz a meteorologist and mathematician was attempting to model weather patterns using computers. His model used variables such as temperature and wind speed. Accidentally, he discovered that if he rounded off the initial conditions just a tiny amount, his model would produce vastly different results. Even simplifying his models he still had the same problem. Lorenz had discovered deterministic chaos. The equations were incredibly sensitive to their initial conditions. This idea is commonly known as the butterfly effect. The question naturally arises; what are the simplest functions that exhibit such interesting dynamics. Well, it turns out the one such equation is Z2 + C.

This simple formula is the equation for both Julia Sets and the Mandelbrot Set, two types of fractals that are very closely related. In fact, you can think of them as two different ways of viewing the same thing. In this video, I'm going to concentrate on the Mandelbrot set. But in my next video we will explore its relationship to the Julia fractals a lot further.

To compute the Mandelbrot set we calculate the result of the equation Z squared plus C, assign it to the value of Z, and then feed it back into the equation again and again. This process is known as iteration. It is illustrative to first understand how to create a set from a very simple function.

Our simple function will be z2. This is a function which doesn't exhibit chaotic behaviour. Let's start with the value z=2. The ball on the number line will show you the value of Z, as we iterate over the function.

Squaring it gives 4, then 16, and you can see that the value of Z quickly raises away towards infinity.

Conversely if we start at the value of 0.5, z gets smaller and smaller and quickly approaches zero.

Now let's adjust our graphic so we can see where all the values of Z go over time.

The top line is the starting value of Z, the bottom line is the value of Z after one iteration. I can then add more iterations.

What you can see is that all the positive values less than one head towards zero. The values greater than one all race away towards infinity. The path that a single line takes is known as its orbit. There are two initial values of Z that will never change 0 & 1.

These are known as fixed points. 0 is an attractive fixed point because the nearby orbits are attracted to it. Conversely, 1 is known as a repelling point because all the nearby orbits move away.

Introducing the negative numbers now. We see that after the first iteration they all become positive, and then follow the same fate as their friends. The ultimate fate of these orbits is an integral part of how the Mandelbrot is calculated. All the values from minus 1 to 1 remain localized. They can never escape from the local area, so we would say that they are part of our set, and we traditionally color them black.

All of the other orbits shoot off towards infinity, we say they are outside the set. We would give that point a color based on how quickly it escaped.

So to recap, our process is to calculate the function many times, feeding the result from each iteration back in. We do this once for each point on our graph. If the value of said remains localized we say that the point is in our set. If z is heading away towards infinity we say that it is not.

So, that brings us to the actual Mandelbrot set. The equation Z = Z2 + C.

When we calculate The Mandelbrot Set we always start with the value Z equals 0. c is assigned the value that we interested in evaluating. We call C the parameter. The Mandelbrot set is actually a map showing the behavior of Z for all possible values of C.

Let's try C = 1. Our ball starts at zero. Then on the first iteration z equals 1 then 2, 5, 26, And it quickly shoots off towards infinity, never to return. Because the orbit heads towards infinity, 1 is not part of the Mandelbrot set

Let's try the point 0.1. The Orbit quickly gets stuck at about 0.11. It can't escape no matter how many times we iterate, the orbit will always remain in the local area. So 0.1 is part of the Mandelbrot set

Now, here is where things get a little bit more interesting. Let's try a negative number such as negative one. As you can see the value of z bounces between zero and negative one. Its motion becomes periodic. It is periodically stable and it never escapes the region so it is part of the Mandelbrot set.

When C is a negative number the complexity of the orbits increase. There is now a tussle between the two terms. Z squared taking the ball to the right, and the plus C term taking the ball to the left. It is this interplay between the two terms that creates interesting dynamics for the orbits.

The case of -1.9 is even more unusual The ball, or the value of Z, is now moving in a way that is quite unpredictable. However I can tell you that it never escapes, and -1.9 is part of The Mandelbrot Set.

In the case of Z squared, things were relatively boring and easy to predict but now with the plus C term we have entered a whole new world of dynamic behavior.

So let's try plotting these orbits together The top line is the value of C. It also happens to be the value of Z on the first iteration. On the lower line we plot the next iteration. You can see that almost all of the orbits are moving to the right. When I add another iteration, you can see
that many of the orbits jump back to the left.

With ten additional orbits things get quite complicated. We start to see some features emerge here.

It looks like the periodic orbit are staying between -2 and +2. This is actually a proven fact. Anytime the value of the orbit goes beyond an absolute value of two, it is guaranteed to hit towards infinity.

If I wind it up to 500 iterations you can see that the orbits are contained within the area -2 to positive +2. This is actually an important fact when writing computer code and generating colors. Any point that has an orbit that escapes from the radius to boundary is known to be outside the Mandelbrot set.

But which points escape and which stay bounded? Looking at the first 20 iterations of the positive values, we can see that the values above 0.25 quickly escape and those below do not. All the positive values from 0 to 0.25, and including those values a part of the Mandelbrot Set

For negative values we need to look a little closer. We know that the values below -2 are outside the Mandelbrot set,and we can see this graphically. The values from -2 to 0 are bounded and they form part of the Mandelbrot Set.

So, on the real number line the Mandelbrot set includes all the values from -2 to 0.25 inclusive. These values we traditionally color black.

We can see that something quite interesting is happening with the negative numbers. Zooming in closer it looks like there is some periodic activity developing, but in fact as we add more iterations, we can see that each orbit actually settles down to a stable point. So they have a period of one. This period one behavior extends all the way to -0.75. This region corresponds exactly to the cardioid shape in the Mandelbrot Set.

Going further left, things change. Looking closely at the values either side of -0.75. At first things look quite similar but as I add many iterations we can see a divergence. To see it clearly I will show only the final result. As I increase the iteration count by one, you can see that the values below -0.75 jump from left to right in a periodic motion. The values between -1.25 and -0.75 are period two orbits, and correspond exactly to the main circle in the main Mandelbrot Set.

Below -1.25 we can find regions with periods covering many values, potentially with periods in the thousands. Take for example the orbit originating at -1.9. It's hard to make out any discernible pattern here.

If I add a near by point to the graph you can see that the orbits are quite different. In this region the orbit is very sensitive to the value of C. The behavior of this function becomes quite chaotic. This sensitivity to the value of Si is really quite an important concept. We could zoom very far into parts of the number line, and see that very nearby values of C can have quite divergent behavior. On our real number line, in one dimension, this is a mere mathematical curiosity. However, once we expand the concept to 2 dimensions the human mind can see patterns and beauty. It's this seemingly chaotic behavior of the orbits that produces this result.

So let's recap where we are at.

We have investigated the behavior of a small part of the Mandelbrot Set. The real number line at the center of the image. On this line the Mandelbrot set exists between -2 and +0.25. Those are the values of C that under iteration are unable to escape towards infinity We also discovered that if our orbits ever have an absolute value greater than 2, they are guaranteed to escape.

As you know, the Mandelbrot set is actually a two dimensional object. To add a second dimension we turn to the complex numbers, extending the picture above and below the real number line. The formula and process is exactly the same. But instead of just real numbers, the initial value of C could also be a complex number. You may be familiar with complex numbers, but just in case you're not, I'm going to give you a quick review now.

When you were doing algebra there is a very natural extension to the normal numbers. We call them the complex numbers. To create a complex number we introduced the constant "i". We let I be the square root of -1. Now, the square root of -1 is an imaginary number. No ordinary number squared gives -1. But introducing the concept can really help out with mathematics. It turns out that algebra is not complete without the imaginary numbers.

A complex number has a real and an imaginary part. The real part s just a normal number, and the imaginary part is a normal number multiplied by i. For example 2+3i is a complex number.

We can plot it on our number line, real part on the horizontal axis, and the imaginary part on the vertical axis. For our purposes, we just need to knowhow to add in square numbers. A detailed explanation of complex numbers is really a story for another video.

To add a complex number, just treat i as a constant and perform normal algebra. So, 2+3i plus 1+i, becomes 3+4i Graphically this is the same as vector addition. Start at 2+3i then go one unit to the right and one unit up.

To square a number again we just perform normal algebra. 2+3i squared equals 4+12i + (3i)2 . Now, i2 is equal to -1. So the result is -5+12i

Squaring a number has a very interesting graphical representation. The distance from zero is squared. The angle from the real axis is always
doubled. In this way, squaring a number causes a rotation around the complex plane. If you're interested in getting deep into complex numbers there are plenty of videos online. The important thing to realize here, is that they are two-dimensional. They can be added, multiplied and squared just like normal numbers.

Now we are finally ready to start looking at the full Mandelbrot Set.

I can't show you all the orbits at once because that would take four dimensions and YouTube only gives me two. But, what I can do is show you the orbits one at a time using a series of dots.

Like before our orbit escapes if it exceeds an absolute value of two. We can represent this as a ring. You will notice that if I choose see outside the Mandelbrot set, the orbit will always escape beyond the ring and head off towards infinity somewhere. Sometimes this can take quite a while. For example, if I choose C to be here, you will see that it takes quite some time before it escapes.

Remember, this is how we choose the color of a pixel. We count the number of iterations until Z escapes. We can then use that value to select the color from a list. It is this technique that produces the beautiful patterns. If we zoom in we can see the patterns start to emerge.

Now, although the colors are outside the Mandelbrot set they always surround a portion of it. Within this pattern of very very thin parts of the Mandelbrot set. They're just smaller than a single pixel. That is why we choose to color the outside area. It is a known fact that all parts of the Mandelbrot are connected.

Now we'll take a look inside the set. When the orbit remains localized forever our point is in the Mandelbrot set, the orbit will never go outside the radius 2 ring. If I choose any point in the main cardioid, you can see that the orbits produce some interesting patterns, but they always settle down to a single point. This is the defining feature of the cardioid.

It is the area of the Mandelbrot set that contains all the orbits that have period 1. That is, the orbit settle down to a single point. As I move C into the main circle we enter the period 2 area. Just like we saw before with the real numbers, the orbit bounces back and forward in a periodic manner. This is known as the period 2 circle.

Interestingly, each of the bulbs have an associated period. If I move C into one of these bulbs, you can see that the orbit becomes periodic. Some of the smaller regions have very large periods indeed. These bulbs form some interesting patterns and number sequences that we can explore in a later video.

If I take C close to the edge of the cardioid, you can see that the orbits start vary wildly as I move just a little. This edge of the Mandelbrot set is quite chaotic, the fate of the orbit becomes very sensitive to the value of C.

Tying this all back to our discussion on chaos, I'm sure you can get a sense of what is meant by the butterfly effect. If such a simple formula can produce huge changes over time just by nudging C and minute amount. Imagine how chaotic a real weather system becomes and how difficult it must be to simulate with a computer. So although the Mandelbrot set has virtually no practical uses outside of computer graphics, you are probably getting a sense of why mathematicians are so interested in studying it.

Finally, I'd like to take a look at a mini-Mandelbrot. Sometimes these are known as "minibrots".

Now that you have a good understanding of orbits, you can start to understand how the "minibrots" form. Here we see an almost identical copy of the Mandelbrot Set. It's not a perfect copy though. If I place see in the cardioid and view the overall picture, you can see that the minibrot has a period of 3.

However, if you have a look at the closer view, and view just every third iteration, you will see that the orbits look just like they did in the cardioid of the main set That is how mini-Mandelbrots are formed. The orbit stabilizes at a particular location in a way that almost perfectly mimics the behavior of the original set, but on a much smaller scale. However, it might be only every third iteration that visits this area. There are an infinite amount of many minibrots within the Mandelbrot set. It seems that those with higher periods are smaller. Sometimes they are even quite deformed, let's take a look at one of my favorites.

That's it for this video, I hope this has revealed some new details of the Mandelbrot set for you. Please subscribe, and join me in future videos.

You're now quite well equipped to understand some of its more interesting features. In the next video we're going to take a step back and explore some of the Julia Sets, and then see how they relate to the Mandelbrot set.

Check out the links in the description for more interesting videos.