Complex Numbers for Rotating, Translating, and Scaling the Plane June 7th, 2009
Patrick Stein

A good friend of mine recently discovered some of the fun things you can do with complex numbers if you’re using them to represent points in the plane. Yesterday, I re-read a passage by Tony Smith about why one should be interested in Clifford algebras. Tony Smith’s passage included all of the fun one can have with the complex plane and extends it to three, four, five, and more dimensions. I thought, I should segue from the complex numbers in the plane to Clifford algebras to quaternions in 3-space to Clifford algebras again in a series of posts here.

What are Complex Numbers

Say you’re playing around with polynomials. You start playing with the equation z^2 - 1 = 0. WIth a little fiddling, you find this is equivalent to z^2 = 1. Then, you take the square root of both sides to find that z = \pm \sqrt{1} = \pm 1. We started with a polynomial equation in one variable in which the highest exponent was two and we found two answers.

Pounding your chest and sounding your barbaric yawp, you move on to z^2 + 1 = 0. This should be easy, right? With the same fiddling, we find z^2 = -1 and then z = \pm \sqrt{-1}.

Uh-oh. What do we do now? We can’t think of any number that when multiplied by itself gives us a negative number. If we start with zero, we end with zero. If we multiply a positive number by itself, we get a positive number. If we multiply a negative number by itself, we get a positive number. Again!

So, how do we get around this? We pull an ace out of our sleeve. We just run with the idea that there is such a number and see where it takes us. We say, There is a number i such that i^2 = -1. Everything else is going to stay the same.

Where does this take us? It turns out, it takes us very, very far. For starters, our equation z^2 + 1 = 0, a polynomial equation in one variable where the highest exponent is two, now has two answers: z = \pm i.

What about z^2 + 4 = 0? It is a polynomial equation in one variable where the highest exponent is two. It’d be pretty spiffy if there were two answers. With the same manipulation as before, we find that z = \pm \sqrt{-4}.

Now, we need to remember that if a and b are positive numbers, then \sqrt{a\cdot{b}} = \sqrt{a}\cdot\sqrt{b}. Let’s see what happens if we extend this to allow our new number i. If we said that \sqrt{-4} = \sqrt{4}\cdot\sqrt{-1}, then \sqrt{-4} = 2i. What happens if we multiply 2i\cdot2i? When we multiply real number a, b, and c, we can do it in any order. We could do a\cdot b\cdot c or a \cdot c \cdot b or c \cdot a \cdot b (or three other orders). Well, let’s assume for now that when we multiply i by a real number, we can do it in either order. Then 2i\cdot2i = 2\cdot2\cdot i\cdot i = 4 \cdot -1 = -4. That’s exactly what we were hoping it would be.

Good. Our equation z^2 + 4 = 0 is a polynomial equation in one variable where the highest exponent is two and it has two solutions z = \pm 2i.

As it turns out, by adding in i (and real number multiples of i) to our real numbers, we have the complex numbers. These complex numbers are an algebraic completion of the real numbers. That’s just a fancy way of saying that if you make a polynomial equation in one variable where all of the coefficients are real numbers and the highest exponent is n, then there will be n solutions to the equation all in the complex numbers.

[It turns out that the complex numbers are algebraically complete themselves. If you make a polynomial equation in one variable where all of the coefficients are complex numbers and the highest exponent is n, then there will be n solutions to the equation in the complex numbers.]

A Quick Review of Complex Arithmetic

Above, we decided to say that \sqrt{-1} is i and go from there. We also used the idea that \sqrt{a\cdot b} = \sqrt{a}\cdot\sqrt{b} to find square roots of all negative numbers. And, we already played around a little bit with multiplying some numbers together. Let’s take a step back for a moment though and just add.

We still want the rest of our algebra to work. Because of that, we don’t have much choice for how imaginary numbers add together. If we take any number z and add it to itself, we get z + z = (1 + 1) z = 2z. We still want that to be true when z = i or z = 5i. In general, then, we will need az + bz = (a + b)z for any numbers a, b, and z.

Earlier, we multiplied 2i\cdot2i. What if we add one to i? Well, we can definitely write this as 1 + i just like we can add one to two by just writing 1 + 2. In the latter case, we already have a name for 1 + 2. We could instead write 3.

We don’t already have a name for 1 + i. How do we know? Well, let us assume that 1 + i is some real number or some real number times i. If it is some real number, we should get a positive real number when we square it. If it is a real number times i, we should get a negative real number when we square it. But, if we multiply (1 + i) \cdot (1 + i) (using the old Firsts, Outers, Inners, Lasts method), we get 1 + i + i + i^2 = 1 + 2i -1 = 2i which is not a positive real number or a negative real number.

As it happens, all of our complex numbers will have the form: a + bi for some real numbers a and b. When we go to add two numbers together, we just add the corresponding pieces: (a + bi) + (c + di) = (a + c) + (b + d)i.

For a complex number a + bi, we call a the real part and b the imaginary part. When we add two complex numbers, we add the real parts together and we add the imaginary parts together. Subtraction, likewise, goes by part. If we want (a + bi) - (c + di), we subtract the real parts and subtract the imaginary parts to obtain (a - c) + (b - d)i.

When we multiply two numbers together, we do it like we did with (1 + i)^2 above with the FOIL method. (a + bi) \cdot (c + di) = ac + adi + bic + bidi. We rearrange the orders of some of the bits as we did with 2i\cdot2i above to get: ac + adi + bci + bdi^2. And since i^2 = -1, we have:

ac + adi + bci - bd = (ac - bd) + (ad + bc)i

Transforming the Plane

You’ll notice above that a complex number is made up of two real numbers (and, of course, i). Every point in the plane has two real numbers as coordinates. We can co-opt the real numbers in the complex number to use as coordinates for points in the plane. If our points are: (x_1,y_1), (x_2,y_2), \ldots, (x_k,y_k), then we can represent them as complex numbers with z_1 = x_1 + y_1i, z_2 = x_2 + y_2i, \ldots, z_k = x_k + y_ki.

We can plot these just as we would their normal coordinates if we put the real part on the x-axis and the imaginary part on the y-axis. This is called an Argand Diagram.

Suppose now we want to translate all of our points by five units along the x-axis and negative two units along the y-axis. We can simply let t = 5 - 2i and then add this to each of our points so that z_j^\prime = z_j + t.

Imagine instead that we want to scale the plane radially out from the origin by a factor of three. We can simply multiply each of our points by s = 3 + 0i so that z_j^\prime = s \cdot z_j. If we want to scale outward from (5,2) instead, we could translate by -t, scale by s, and then translate t back.

z_j^\prime = s \cdot \left( z_j - t \right) + t = s \cdot z_j + (1 - s) \cdot t

Suppose now that we’d like to rotate the plane by some angle \theta around the origin. For that rotation, a point (x,y) should get rotated to the point (x\cos\theta - y\sin\theta, x\sin\theta + y\cos\theta). That is to say: the complex number x + yi should get rotated to the complex number (x\cos\theta - y\sin\theta) + (x\sin\theta + y\cos\theta)i.

Let’s look back to our equation for multiplying two complex numbers:

(a + bi) \cdot (c + di) = (ac - bd) + (ad + bc)i

We can see the similarity to the rotation. If we take (x + yi) \cdot (\cos\theta + i \sin\theta), then we get precisely: (x\cos\theta - y\sin\theta) + (x\sin\theta + y\cos\theta)i.

The points (\cos\theta,\sin\theta) are the points on the unit circle centered at the origin. So, if we want to rotate all of our points by an angle \theta around the origin, we simply have to multiply them by the point on the unit circle that is at angle \theta around the origin from the x-axis: r = \cos\theta + i \sin\theta so that z_j^\prime = z_j \cdot r. Again, if we want to rotate around the point t, we simply translate by -t, rotate by r, and translate t back again.

z_j^\prime = r \cdot \left( z_j - t \right) + t = r \cdot z_j + (1 - r) \cdot t

So, now we can translate points in the plane with complex addition (or subtraction). We can scale points in the plane by multiplying by a real number. We can rotate the plane by multiplying by a complex number.

Conformal maps

There are some other transformations that naturally arise from complex arithmetic. A conformal transform is one that keeps angles constant. All of the transformations we’ve done above are conformal. If you translate the whole plane, the angles between lines are unchanged. If you scale the whole plane, the angles between lines are unchanged. If you rotate the whole plane, the angles between lines are unchanged.

As it happens, a transformation of the complex plane is a conformal map if and only if the transformation has a (complex) derivative everywhere and that derivative is non-zero everywhere. Without getting into complex derivatives here, suffice it to say, they’re pretty much just like real derivatives for simple polynomials. Let’s look at our cases above. The derivative of translating by t is 1 which exists everywhere and is non-zero everywhere. The derivative of multiplying by s (or r) is s (or r). This exists everywhere and is non-zero everywhere (if anywhere).

Another conformal transformation of the complex plane is the Möbius transformation. The Möbius transformations preserve angles where lines meet, but they generally turn lines into curves. The Möbius transformations are of the form: z_j^\prime = \frac{a z_j + b}{c z_j + d} for complex numbers a, b, c, and d (so long as ad - bc \neq 0). You can see the Möbius transform in action on YouTube.

What’s next

Next, we’re going to see how Clifford algebras can represent all we have done here. But, that is for another day.