## Explaining Maths

Recently, I was talking to my Dad about fiddling about programming the iPad (which I haven’t got around to yet) but I did mention that I might have a go at something simple just to get my feet wet. Beyond Hello, World there are many simple small-to-medium-size projects of course, and I mentioned I might do something like a Mandelbrot set explorer.

What followed was a bit of a Wikipedia-esque delve into some Mathematics as I tried to explain what the Mandelbrot set is.

Of course, everyone knows what the Mandelbrot set is. It’s the iconic heart-shaped box of springs and wire that is the poster child of fractal art. And as any mathematically-inclined person knows, it’s a colouring of the complex plane. It’s easy for computers to calculate: you take a complex number c, and iterate the equation zn+1 = zn2 + c, starting with z0 = 0. If the result tends to infinity, that number is not in the Mandelbrot set, otherwise it is. Anything in the set is coloured black, and things on the edge get coloured according to how many iterations it takes to pin down their non-membership of the set.

Most of that last paragraph is of course in Martian for many people, so I started explaining complex numbers. Which necessitated a bit of maths history.

To start at the beginning, we have the natural numbers, aka the counting numbers. These are the numbers we all learned as small children, starting at 1 and counting arbitrarily high. The natural numbers are conventionally called ℕ.

Natural numbers are fine for addition, but you get to a problem with subtraction: if you take 5 from 3, you end up with a number that isn’t in ℕ. So the next obvious way to expand is to add the negative integers and 0. Now we have the integer line stretching to infinity in both directions, with 0 in the middle, and this set, the integers, is called ℤ. As you can understand, ℕ is a subset of ℤ.

So far so good. ℤ is closed under addition, subtraction, and multiplication, meaning that if you take any two numbers in ℤ and either add, subtract, or multiply them together, you get a third number also in ℤ. However, what if you divide? You get a fraction – potentially a non-integer! And of course that’s not in ℤ. So the next set is the set of rational numbers (because they are ratios), called ℚ. Once again, ℚ is a superset of ℤ (any integer can be thought of as a ratio of itself over one).

All good, and this was as far as anyone thought for a while. Then a bright spark in Ancient Greece discovered numbers that couldn’t be ratios, and by many accounts, this was quite upsetting to the Greek geometers. Nevertheless, it was true, so Mathematics had to account for the so-called irrational numbers as well as the rational numbers, and taken together these constitute the real numbers ℝ.

At this point there are many fascinating asides involving mathematical efforts to tame infinity and infinitesimality, which meant that basis of much of maths (eg. calculus) was worryingly unstable and not well understood for quite a while, at least until brains like Georg Cantor had a go at it. There is also an aside about transcendental numbers (like π) which are a subset of irrationals that cannot be the root of any polynomials.

Anyway, sweeping all this under the table and assuming that the real numbers ℝ are perfectly well-understood, there remains a final snag for our story. Taking square roots is undefined for negative numbers, which in mathematical terms means that ℝ was not closed under exponentiation. To fix this final problem, we come to the complex numbers ℂ, each of which has a real part and an imaginary part (which is expressed as a multiple of i, the square root of -1).

Because they have two parts, the complex numbers can be thought of as a two-dimensional space: an x-y graph space where x is the real axis and y is the imaginary axis. And this is the complex plane. So finally we’re back to the original explanation with enough context to understand it: the Mandelbrot set is simply a colouring of each value in the complex plane (with suitable limits in x [real] and y [imaginary] parts) according to whether it’s in the set or not, or how fast the iterative process can determine that. Because there are an infinite number of values in the plane, you can zoom in without limit, and the fractal nature of the set means you will discover finer and finer detail.