# what is Mandelbrot set ?

199 views

what is Mandelbrot set ?

In: Mathematics To really understand the Mandelbrot set you’ve got to know a bit about complex arithmetic and complex algebra. The Mandelbrot set is a map of a certain property of how multiplication and addition affect each other in the complex numbers.

Specifically, it asks “If you start with a number and square it, then add the number, then square it, then add the number, then square it, then add it, etc etc etc, what happens?”

First you can consider this question using only the familiar set of “real” numbers. If we suppose our starting number is 0.2, then following this square-and-add process for a few steps, we get:

0.2^2 = 0.04
0.04 + 0.2 = 0.24
0.24^2 = 0.0572
0.0572 + 0.2 = 0.2572

and onward like that. Now, depending on your starting number, a couple of different things can happen. if a number is between 0 and 1, then squaring it gives you a smaller number than you started with. If you chose a very small number, then the squaring step will make the number even smaller, and this shrinking in the squaring step will keep the numbers quite small, *despite* the fact that the adding step makes it a bit bigger each time.

Alternatively, you could choose a bigger starting number like 2. 2 squared is 4, then you add 2 which makes 6, and then 6 squared is 36, and… things blow up fast.

Now, things act a little more strangely when you try using a negative number. -1 squared is 1, then you add -1 and get 0, then you square that and get 0, and then you add -1 and get -1, and you square that and get 1 again, and you’re in a loop!

So those are our options: things converge toward a small number, they blow up into increasingly large numbers, or they end up in a stable cycle.

The Mandelbrot set is what happens when you allow your starting number to be positive, negative, *or complex*. Complex numbers are like 2-dimensional numbers. Where multiplying real numbers can be visualized as stretching or squashing the number line, multiplying complex numbers is like stretching or squashing *and rotating* the coordinate system. This can be pretty hard to visualize but there are a lot of great [videos](https://www.khanacademy.org/math/precalculus/x9e81a4f98389efdf:complex/x9e81a4f98389efdf:complex-mul-div-polar/a/visualizing-complex-multiplication) with animated diagrams that can help. It gets pretty, eheheh, complex. Oh boy!

So, go to your faucet and turn it on just a little bit, so it’s dripping.

Then turn it up just a little, until you get a nice smooth stream.

Then turn it on a bit more, and more, until the stream goes all bubbly and makes a wooshing noise.

There are specific transitions going on – the stream is called “laminar flow”, while the bubbles are called “turbulent flow”.

Laminar flow is an example of “order”, while turbulent flow is called “chaos”.

There are lots of mathematics that explain basically when and where you can expect to see those transitions from order to chaos and back again.

The mandelbrot set is sort of a huge map of most of those systems, and it turns out it’s generated by a really simple equation.

That’s the basics of it. The details are super fascinating too, but they tend to be a bit overwhelming for ELI5. Say you have a tabletop. You pick any spot on the table and you measure how far over your spot is (left to right) and how far up (bottom to top). That gives you two numbers. You “do a math” on these two numbers and that gives you two new numbers, and you can measure to find out where you are now on the tabletop. Then you “turn the crank” by doing the math thing again on the new spot, and so on, to get your next spot, and again, and again.

Depending on where your starting spot is, as you keep “turning the crank”, your sequence of next spots might:

* Quickly end up off the table
* Bounce around somewhat but stay on the table

Most of the time, if you pick two starting spots that are very close to each other, as you “turn the crank” each starting spot leads to a very similar sequence of next spots. But the cool part is that there are some places where even a tiny change in where you place your spot can have a huge change in where you end up. We call those parts “chaotic”.

If you color each spot based on how many times you can turn the crank before the answer flies off the table, you get extremely beautiful color patterns and curls and wiggles around the chaotic parts. And if you could somehow zoom in, it would never get smooth, you would keep seeing ever tinier curls, forever.

And all this beauty comes from some fairly simple looking math (not simple to a 5 year old, but lots of 12 year olds can grasp it). In an orderly system a small change in input causes a small change in output. If you only nudge the gas, your car only accelerates a tiny bit. If you throw your next ball a tiny bit harder it will only go a tiny bit further than the last.

In a chaotic system a tiny change can cause a categorically different outcome. A little nudge can save your pinball and change the outcome of the game entirely. The path of a storm can change based on the turbulence from a butterfly’s wings.

If you map the input zones for different outcomes in an orderly system, the boundaries are simple lines. Think of a [phase diagram for water.](https://i.redd.it/yes94d114ki61.png) There’s an easy, predictable relationship between the temperatures and pressures where ice changes to liquid water.

The Mandelbrot set is the chaotic version of this map. Since tiny changes can have big outcomes, the border between one phase and the other is jagged, and it stays jagged no matter how far you zoom in.