# The Mandelbrot Set

The Mandelbrot set produces one of the most amazing mathematical visualizations ever created.

The Mandelbrot set is simply a set of numbers. Because they are complex numbers, they exist as coordinates on the complex plane. Images like the one above are produced by zooming in on the boundary between what is and is not in the Mandelbrot set.

### Imaginary and Complex Numbers

The square root of negative one may not seem to exist. One times one equals one, and negative one times negative one also equals one. So an “imaginary” number had to be created such that i squared equals negative one.

The imaginary numbers, like i, 2i, 3i and so on, exist on an axis perpendicular to the real number axis, which creates the complex plane, like so:

Complex numbers such as 3 + 2i populate the complex plane. They can be added, subtracted, divided and multiplied, just like real numbers.

### Defining the Mandelbrot Set

To define the Mandelbrot set, we start with a simple function. For any complex number c, we apply the function z2 + c, starting with z equal to 0. The result becomes the new z and then the function is applied again. This process repeats, and one of two things happens: either the number becomes very large and will go to infinity, or the result of the function is bounded and stays within 2 of zero. The numbers that are bounded are in the Mandelbrot set, and the numbers that go to infinity are outside of it. The basic shape of the set is this:

The interesting thing is what happens at the border. By coloring the Mandelbrot set black, numbers outside of it blue, and numbers near the border different shades according to how long it takes them to go to infinity, a computer can be programmed to zoom in to the border, revealing amazing fractal type shapes.

For more on the Mandelbrot set, here is a delightful video explanation:

Coding the Mandelbrot set yourself is simpler than you might think. If you would like to experiment, here is a great explanation video:

Finally, here is another zoom view of the set: