The Mandelbrot set, named after Benoit Mandelbrot, is a
fractal. Fractals are objects that display
self-similarity at various scales. Magnifying a fractal reveals
small-scale details similar to the large-scale characteristics.
Although the Mandelbrot set is self-similar at magnified
scales, the small scale details are not *identical* to
the whole. In fact, the Mandelbrot set is infinitely complex.
Yet the process of generating it is based on an extremely
simple equation involving complex numbers.

## Understanding complex numbers

The Mandelbrot set is a mathematical set, a collection of
numbers. These numbers are different than the real numbers that
you use in everyday life. They are complex numbers.
A complex number consists of a real number plus an
imaginary number. The real number is an ordinary number,
for example, -2. The imaginary number is a real number times a
special number called `i`, for example, 3`i`.
An example of a complex number would be
-2 + 3`i`.

The number `i` was invented because no real number can be
squared (multiplied by itself) and result in a
negative number. This means that you can not take the
square root of a negative number and get a real
number. By definition, when you take the square root of a number, you
find a
number that can be squared to get that number. The number `i`
is
defined to be the square root of -1. This means that `i`
squared
is equal to -1. So when you square an imaginary number you
*can* get a negative number. For example, 3`i`
squared is -9.

Real numbers can be represented on a one dimensional line called the real number line. Negative numbers like -2 are plotted to the left of zero and positive numbers like 2 are plotted to the right of zero. Any real number can be graphed on the real number line.

Since complex numbers
have *two* parts, a real one and an imaginary one, we
need a second dimension to graph them. We simply add a vertical
dimension to the real number line for the imaginary part. Since
our graph is now two-dimensional, it is a plane, the
complex number plane. We can graph any complex
number on this plane. The colored dots on this graph represent
the complex numbers [2 + 1`i`], [-1.5 + 0.5`i`],
[2 - 2`i`],
[-0.5 - 0.5`i`],
[0 + 1`i`], and
[2 + 0`i`].

## Graphing the Mandelbrot set

The Mandelbrot set is a set of complex numbers, so we graph
it on the complex number plane. However, first we have to find
many numbers that are part of the set. To do this we need a
test that will determine if a given number is inside the set or
outside the set. The test is based on the equation
`Z` = `Z`^{2} + `
C`. `C` represents a **constant** number,
meaning that it does not change during the testing process.
`C` is the number we are testing, the point on the
complex plane that will be plotted when testing is complete.
`Z` starts out as zero, but it changes as we
repeatedly **iterate** this equation. With each iteration we
create a new `Z` that is equal to the old `Z`
squared plus the constant `C`. So the number
`Z` keeps changing throughout the test.

We're not really
interested in the actual value of `Z` as it changes,
we just look at its magnitude. The magnitude of a
number is its distance from zero. For example, the number -9 is
a distance of 9 from zero, so it has a magnitude of 9. The
magnitude of a complex number is harder to measure. To
calculate it, we add the square of the number's distance from
the `x`-axis (the horizontal real axis) to
the square of the number's distance from the
`y`-axis (the imaginary vertical axis) and
take the square root of the result. In this illustration,
`a` is the distance from the `y`-axis,
`b` is the distance from the `x`-axis, and
`d` is the magnitude, the distance from zero.

As we iterate our equation, `Z` changes and the
*magnitude* of `Z` also changes. The magnitude
of `Z` will do one of two things. It will either stay
equal to or below 2 forever, or it will eventually surpass two.
Once the magnitude of `Z` surpasses 2, it will
increase forever. In the first case, where the magnitude of
`Z` stays small, the number we are testing is part of
the Mandelbrot set. If the magnitude of `Z` eventually
surpasses 2, the number is not part of the Mandelbrot set.

As we test many complex numbers we can graph the ones that are part of the Mandelbrot set on the complex number plane. If we plot thousands of points, an image of the set will appear:

We can also
add color to the image. The colors are added to the points that
are not inside the set, according to how many iterations were
required before the magnitude of `Z` surpassed two.
Not only do colors enhance the image aesthetically, they help
to highlight parts of the Mandelbrot set that are too small to
show up in the graph.

To make exciting images of tiny parts of the Mandelbrot set, we just zoom in on it. Notice that each image below is a detail of the center of the image preceding it. The final frame is available as a 640 x 480 image (89 KB).

I made
these images using *Fractint*,
available for MS-DOS and Windows. Software like Fractint allows
us to zoom in on the Mandelbrot set by creating a box around an
area that we want to see in greater detail. There is no limit
to how deeply we can zoom, except for our patience. We can zoom
in to the trillionth power in a few hours if we use a small
image size. This is like zooming in on the United States of
America and seeing details that are the size of single cells.
As we zoom in deeply, we can see parts of the Mandelbrot that
no one has seen before!

Here's another image that I made using
*Fractint*. The full image is
147 KB.

The Mandelbrot set is an incredible object. It's really
amazing that the simple iterated equation
`Z` = `Z`^{2} + `
C` can produce such beautiful works of mathematical
art.

If you're interested in learning more about the Mandelbrot set, fractals, and chaos theory I highly recommend reading James Gleick's classic book Chaos: Making a New Science.

If you have questions or comments, please email
me at tiger@ddewey.net.

Please also visit my personal web
page.