Inside Out
6 min read

Inside Out

A not-so-deep dive into the Mandelbrot set.
Inside Out

If you've spent any time at all on the math-y side of the internet, you've probably seen something that looks like this:

Source

Accompanied by the glorious infinity zooming psychedelic imagery is usually an eloquent description of how this flowering fractal provides indisputable proof of the existence of a supernatural creator of the grand design.

Source

Then the name drops: "The Mandelbrot Set."

Pure Enlightenment.

But wait a second. Set? As is, a set theory set? You know, back in my day, sets looked more this:

Source

Yep. Despite all the flashy colors and trippy graphics, the Mandelbrot set is just that– a good ol' fashion set.

But to the aspiring mathematician still stuck in high-school, there's still probably a lot of murky water out there.

For starters, if the Mandelbrot set is a set, what is it a set of? What does it contain? How is it defined? And why in the world does it look like something you'd get when you throw lightning bolts, snowflakes, and burnt onions into a smoothie machine?

What the chef actually threw into the smoothie machine

So clear lets something up. The Mandelbrot set is a set of complex numbers. That's it. Nothing too fancy.

It's a set of numbers of the form $ a+bi $ where $ a, b \in \mathbb{R}$ and $ i^2 = -1$.

The reason you're able to look at it on your computer (or phone, who am I to judge) screen is that you are looking at the complex plane.

All the points that lie in the Mandelbrot set are black. That's the big cardioid shape with the circles around it.

The point that lies outside the Mandelbrot set are colored in ways that make you actually want to look at the thing without yawning your face out.

I'll go into how exactly we color the points that are outside the set a bit later. But for now, remember that the black points are the in-the-set points.

A DIY guide to building your own Mandelbrot set

So how do we decide which point's go in, and which go out?

There's a simple rule: a complex number $c$ is in the Mandelbrot set if $|z_n|$ does not diverge as $n$ approaches infinity, where

$$ z_n = {(z_{n-1})}^2 + c$$

In English, a complex number $c$ is in the set if, when you start with that number and keep hitting $ans^2 + c$ on your calculator, your calculator doesn't spit out an overflow error and burn to a crisp.

Source

Does this actually work?

As a test case, consider $c = 1$

$$ \implies z_1 = 1^2 + 1 = 2$$
$$ \implies z_2 = 2^2 + 1 = 5$$
$$ \implies z_3 = 5^2 + 1 = 26$$

So let's just spare the poor computer some RAM space and conclude that 1 isn't in the Mandelbrot set..

By the way, if you haven't noticed, I'm using $\mathbb{M}$ to represent the Mandelbrot set, since it just looks so cool.

Source

Technically, it's not a requirement that the sequence converges, only that it doesn't diverge. For example, it's entirely possible (and this actually does happen) that $z_n$ keeps oscillating between 2 numbers.

You know what? Let's actually try that out.

Start with $c = -1$, which I'm just going to tell you is in the Mandelbrot set.

$$ z_n = {z_{n-1}}^2 +c $$
$$\implies z_1 = (-1)^2 -1 = 0 $$
$$\implies z_2 = (0)^2 -1 = -1 $$
$$\implies z_3 = (-1)^2 -1 = 0 $$

So using a starting point of $c = -1$, the iterations become bugs bunny between $0$ and $-1$.

Source

The Best Mandelbrot Set Spotting Sites For Tourists

Here's something fundamental about the Mandelbrot set that's also extremely obvious– you can see the whole thing. Why is this detail important? Take a look at it again:

Source

It looks like we could theoretically draw a circle around this thing. A circle that contains the entire Mandelbrot set. So what would the radius of this circle be?

In other words, I'm asking you to find a number $r$ such that $\forall c \in \mathbb{M}, |c| \leq r $

The answer is 2.

Why 2? Well, think about how we iterate the sequence, we square the previous value and add a constant.

Let's say you start at the origin of the complex plane and go to the point corresponding to the complex number $c$.

Squaring a complex number squares its magnitude (by DeMoivre's theorem). So to get to the next point, you'd have to square your magnitude (distance from origin) and move in the direction of $c$.

In the most extreme case, let's say that $ z_1 = {c}^2 - c$. This means that you're stepping forward in the direction of ${c}^2$ and stepping backward in the direction of $c$.

If $|c|>2$, squaring $c$ would result in more than doubling the magnitude of $c$, since $x^2 > 2x \forall x>2$ (because 2 squared is 4).

So in a sense, $c$ wouldn't be strong enough to pull $c^2$ back if it was outside the disk centered at the origin with radius 2.

Of course, pushing, pulling, and stepping backward aren't things you do in math, so I'd encourage anyone reading this article to check out a formal proof/derivation of the "radius of escape" of the Mandelbrot set (if you're into that kind of stuff).

Unleash your inner 3 year old

If you've read this far, I'm assuming that you're waiting for the point where I just tell you how you're supposed to get this:

Source

Oh well. I did try to convince you that the math is more beautiful than the picture. But I guess numbers and powers just can't hold their own against neons and pixels.

The coloring is done by assigning different colors to each complex number on the plane depending on how fast they explode to infinity.

Since most of this stuff is done by a computer anyways, you'd have to consider the pixel coordinate as a point on the complex plane, and start iterating that point with the sequence $z_n = {z_{n-1}}^2 + c$, just like we've done a few times above.

Remember, since the Mandelbrot set contains points with magnitude less than 2, if at any point during our iteration, the magnitude of the number we calculate exceeds 2, we throw it away, saving computing time.

The number of iterations we do before throwing away a number (before it reaches 2) is used to set colors, say 2 iterations for blue, 3 iterations for dark blue, and so on.

Conclusion

I think that at the heart of the Mandelbrot lies a fundamental misunderstanding.

We assume that it's all about the infinite. Infinite zooming, infinite fractal, infinite points.

But the very definition of the Mandelbrot set suggests that it's not about the infinite at all. It's about the finite.

It's not about the numbers that explode off to infinity, never to be seen again. It's about the numbers that stay within their tightly knit community of the circle with radius 2.

It's not about the flashy colors that show you everything outside the Mandelbrot set. It's about the darkness inside.

And the beauty lies not in the shiny graphics that make it look like a mystery beyond comprehension. The true beauty of the Mandelbrot set lies in the fact that we can understand it. In one simple equation:

$$ z_{n+1} = {z_n}^2 +c $$

It's not about what's on the outside, it's the inside that counts.

Enjoying these posts? Subscribe for more