In the first post I explained why the mathematical “imaginary” number i is “real” (in more than one sense of the word). That weird number is just a stepping stone to the complex numbers, which are themselves stepping stones to the complex plane.
Which, in turn, is a big stepping stone to a fun fact about the Mandelbrot I want to write about. (But we all have to get there, first.) I think it’s a worthwhile journey — understanding the complex plane opens the door to more than just the Mandelbrot. (For instance, Euler’s beautiful “sonnet” also lives on the complex plane.)
As it turns out, the complex numbers cause this plane to “fly” a little bit differently than the regular X-Y plane does.
The two do have a lot in common, but the magic of i changes the math we do on points. (Mainly the multiplication of complex numbers.)
Recall that a complex number has the form:
a + bi
Where a and b are real numbers and i is the imaginary unit.
Since the two terms aren’t compatible (a plain number and one with an imaginary unit), we can’t carry out the addition. The two parts are forever separate. This makes complex numbers compound numbers.
Note that, if b=0, then the number is essentially the real number a. This is how the complex numbers include the real numbers (and therefore the integers and rationals). They are all values of a with b=0.
That the real and imaginary parts a and bi are incompatible means they are independent of each other, which means we can think of them as axes of a graph:
That’s all the complex plane is, an X-Y graph in which we use a complex number’s real component, a, as x and its imaginary component, bi, as y. This means the familiar real number line is the x-axis of the graph (where y is zero).
In the graph above, the blue points and numbers on the horizontal x-axis call out the integer points on the real number line. The red points and numbers on the vertical y-axis call out the integer multiples of i. The purple points and numbers show some combined real and imaginary values.
The “unit square” at the center separates an important behavior. The value 1.0 tends to be hugely significant in math — it’s the foundation of the integers and, more significantly here, the multiplicative identity. Points inside the square, when multiplied, tend to get closer to the origin (0,0i), and points outside, when multiplied, tend to get further from it.
The same basic behavior occurs with real numbers. Multiplying two numbers, both above 1.0, results in a number larger than either. Multiplying two numbers, both less than 1.0, results in a number smaller than either.
On a graph, smaller usually means closer to the center, and larger usually means further away. A multi-dimension graph provides the notation of magnitude — the distance from the center.
Note that when drawing the graph we ignore i and use only the a and b values. (We don’t ignore i when doing math on graph points. That’s where the magic kicks in.)
Let’s take a look at that math magic.
I’ll start by reversing the order of the real and imaginary components and swapping the letters:
ai + b
This doesn’t change anything. It’s still the same (complex) value. I want the imaginary part first, but I still want the letters to read from left to right just because that’s what we’re used to.
(Remember that what we use for ‘a’ and ‘b’ doesn’t matter. The letters are just placeholders for real numbers. We can use any letters we like.)
The reason for all the swapping is to highlight how the equation looks a lot like a low-order polynomial:
ax + b (= ax1 + bx0)
Which suggests that we treat complex numbers as polynomials when it comes to doing math with them. This is handy, because we already know how to do math that way — it’s basic algebra.
Adding the two complex numbers…
…(where a, b, c & d are all real numbers) is simple: We add the like parts (the two real parts and the two imaginary parts) and end up with a new complex number:
(ai+b)+(ci+d) = (ai+ci)+(b+d) = (a+c)i+(b+d)
The real numbers, a+c and b+d, add together while the i stands outside. Once we do those two additions, we end up with a complex number again.
Multiplying those two complex numbers is where it gets a little more interesting. We’re multiplying polynomials, which uses the inside-outside-left-right protocol from high school algebra class.
It ultimately boils down to this:
(ai+b) × (ci+d) = (bc+ad)i + (ac)i2+bd
And since i2 = -1, we can reduce it to:
(bc+ad)i+(ac(-1)+bd) = (bc+ad)i+(bd–ac)
Again, once we do the math on the real numbers (a, b, c & d), we end up with a new complex number.
If this section made your eyes glaze, that’s okay. The only important part is this:
(ai+b) × (ci+d) = (bc+ad)i+(bd–ac)
Multiplying two complex numbers together results in a certain specific result (which is a new complex number). As it turns out, this multiplication has certain interesting properties I’ll come back to.
Compare this with how we might think to multiply two ordinary X-Y coordinates.
In this case, both x and y are just real numbers, so there’s no need to treat them algebraically. We can just do a pair-wise multiplication:
[x, y] × [u, v] = [xu, yv]
Which is entirely legit. But it obviously delivers different results than we get with complex number multiplication.
To make the comparison apples-to-apples, here is the complex number — treated as a graph coordinate — multiplication result:
[x, yi] × [u, vi] = [(xu–yv), (xv+yu)i]
Note that we’re back to the original (a,bi) form here. The real part (the x-axis value) comes first, and the imaginary part (the y-axis value) comes second. That’s to make it match the [x, y] form of coordinates.
Remember that the i in the equation just helps distinguish the real and imaginary parts and reminds us we’re working with complex numbers.
This different math matters because of what happens when we multiply points on the complex plane. A simple illustration is shown to the left.
The red and blue points are the two points we’re going to multiply. The red point is at [+3.2, +1.2i] and the blue point is at [+2.5, +1.9i].
The black point shows what we get if we multiply them simply as ordinary [x, y] points:
[3.2,1.2] × [2.5, 1.9] = [3.2×2.5, 1.2×1.9] = [8, 2.28]
The purple point shows the complex multiplication result:
[(3.2×2.5)-(1.2×1.9), ((3.2×1.9)+(1.2×2.5))i] = [5.72, 9.08i]
So the points end up in different places, but something a bit more important also happens.
If we look at the lines (vectors) drawn from origin to the points, those lines all have an angle with respect to the x-axis.
What might not be obvious (but is true) is that the angle of the purple line is the sum of the angles of the blue and red lines.
We can say either that the purple point is the result of rotating the blue point by the red point’s angle, or the result of rotating the red point by the blue point’s angle. It amounts to the same thing.
The crucial point is that multiplying complex points results in rotation.
Both the purple and black points are further away from the center because both the red and blue points are outside the unit square (the upper-right quadrant of which is the single square in the lower left).
This rotation aspect gives us a new way to find points on the unit circle.
We start with an easy point, the one at [+1, 0i]. It sits right on the x-axis, so it’s angle is zero. It’s the first point of the unit circle.
Then we decide how many points around the circle we want. The easiest approach is to pick a small angle and find a point for each increment of that angle around the circle. For instance, if we pick an angle of 1° there will be 360 points around the circle.
Now we find the point for that increment angle. That’s simply:
[cos(θ) , sin(θ)] = [cos(1°), sin(1°)] = [+0.9998, +0.0175i]
We could have gotten the first point this way, too:
[cos(0°), sin(0°)] = [+1.00, 0.00i]
But since it’s a “well-known” point, we didn’t bother.
Both of these are points on the unit circle, so by definition their magnitude is 1.0. Therefore, multiplying them will keep that magnitude constant.
If we multiply the first point (call it U for Unit circle) by the second point (R for Rotate), we end up with a new U, which — on this first iteration — will be the same as R.
[Recall how this works: We are either rotating U by R, which rotates it one degree, or we’re rotating R by U, which rotates it zero degrees. Either way, we end up with a point one-degree along the circle, which is where R is.]
Now we multiply U by R again which rotates it one more degree. We have a new U that is two degrees along the circle.
We continue to multiply U by R to give us 360 evenly spaced points along the unit circle.
If we want more points, we pick a smaller angle. A larger angle gives us fewer points. Below is an example that uses 3° as the angle, which results in 120 points around the circle (360/3 = 120).
Included in the diagram is a line (in red) to the R(otation) point illustrating the 3° angle. The original U point is the one directly below it.
As you can see, each point is spaced by that angle. Each time we multiply a given point, the new point is rotated 3° counterclockwise.
That’s enough (possibly, for some, more than) for this time.
But now we finally have the groundwork to explore the heart of the Mandelbrot.
Stay on the plane, my friends!