Quaternions for Rotating, Scaling, and Translating Space June 11th, 2009
Patrick Stein

In earlier posts, I described how complex numbers can be used to rotate, scale, and translate the plane, how Clifford algebras can be used to rotate, scale, and translate the plane, and why I resorted to an awkward trick for the Clifford algebra rotations of the plane. In this post, I am going to explain what the quaternions are and describe how they can be used to represent a rotation in three-dimensional space.

What are the quaternions

Okay, remember how we got the complex numbers? We needed something that was the square root of negative one.

Now, imagine that you are Sir William Rowan Hamilton. The year is 1843. It is springtime. You know how to use the complex numbers to represent points in the plane. And, you know that when you do that, you can use complex numbers to rotate, scale, and translate the points. That’s all well and good, but you don’t live in a two-dimensional world. How are you going to do the same sort of thing with three-dimensional space? How are you going to multiply triples?

You spend months on this. If only you could say, How about I let there be another number that is different from i (and from -i) that has the same property that its square is negative one? You fight with this for months. You try to represent a point with coordinates (x,y,z) as x + yi + zj. But, nothing you come up with makes any sense.

Your kids are harassing you, Daddy, did you figure out how to multiply triples yet? You have to answer them every morning with a polite, No, not yet.

Then, you’re walking along the Royal Canal in Dublin. It’s mid-October already. My, how the year has flown by. Bam, it hits you. If you add a third number like i and j which is equal to i\cdot j, everything works out. You get so excited, that you carve your equations into a stone bridge over the canal:

i^2 = j^2 = k^2 = ijk = -1

Read the rest of this entry ⇒

What Was Up With That Rotation Trick? June 10th, 2009
Patrick Stein

In my prior post about using Clifford algebras to do plane rotations, I finished with a non-intuitive step at the end. Rather than multiplying on the right by an element representing a rotation of angle \theta, I multiplied on the left by an element representing a rotation of angle \frac{\theta}{2} and multiplied on the right by an element representing a rotation of angle -\frac{\theta}{2}.

Why did I do this? Well, I mentioned it would be awkward for the two-dimensional case, but that it will be important when we get to three or more dimensions. Well, work for a moment with \frac{\theta}{2} being a quarter rotation (ninety degrees, \frac{\pi}{2} radians). This means our total rotation is going to be a half turn (180 degrees, \pi radians).

For that \frac{\theta}{2}, r = e_1e_2 and so \overline{r} = -e_1e_2. Let’s just look at what it does to our unit vectors e_1 and e_2 to multiply on the left by r and on the right by \overline{r}.

For e_1, we get -e_1e_2e_1e_1e_2 = -e_1e_2e_2 = -e_1. Similarly, for e_2, we get -e_1e_2e_2e_1e_2 = -e_2.

So far, we were only working in two dimensions. As such, there wasn’t any e_3 to worry about. But, what if there were? What happens to the z-coordinate of something if you rotate things parallel to the xy-plane? It remains unchanged.

Well, what would happen if we multiplied e_3 on the right by \cos\theta + \sin\theta e_1e_2? We would end up with \cos\theta e_3 + \sin\theta e_3e_1e_2 = \cos\theta e_3 + \sin\theta e_1e_2e_3. We’ve ended up scaling e_3 and adding in a trivector e_1e_2e_3. We’ve made a mess.

Let’s try it instead with our trick. We’re going to start with -e_1e_2e_3e_1e_2. Every time we transpose elements with different subscripts, we flip the sign. Every time we get two elements next to each other with the same subscript, they cancel out. So, switching the e_3 with the second e_1, we get e_1e_2e_1e_3e_2. From there, we can switch the first two elements to get -e_2e_1e_1e_3e_2 which is just -e_2e_3e_2. We can switch the e_3 with the second e_2 to get: e_2e_2e_3 which is just e_3. So, our trick leaves e_3 unchanged.

In the above, there is nothing special about the subscript three. It would work for any subscript except one or two. So, the trick allows us to break the rotation up into two parts that still do what we want with e_1 and e_2 but leave our other directions unchanged (or, maybe it’s easier to think of them as changing them and then changing them right back).

A First Look at Relation Algebras by Games June 8th, 2009
Patrick Stein

On Saturday, I got Relation Algebras by Games by Hirsch and Hodkinson via Inter-Library Loan. I am still debating whether to use this book for a Study With Me blog series. I’ve only gotten through the preliminaries so far, so we’ll see.

From the title of the book, I was expecting the authors to take various games and use them to derive relation algebras. Instead, the authors are going to take several variants of one particular game and use them to show thing about pre-existing relation algebras or classes thereof. The approach sounds very much like Zero-knowledge proofs. I think I may have titled the book An Information Theoretic Approach To Relation Algebras.

The basic idea of the game is that there are two players: Abelard and Eloise. Eloise’s goal is to prove that her model of a relation algebra is complete. Abelard’s goal is to stump Eloise. On Abelard’s turn, he asks a question about Eloise’s model of the algebra. On Eloise’s turn, she adds whatever is needed to the model she’s presented thus far so that she can answer Abelard’s question. Abelard wins if he stumps Eloise. Eloise wins if she can answer every infinite series of questions Abelard poses.

This is an interesting concept. The two major variants seem to be: limiting the game to a certain number of rounds or limiting the blackboard space upon which the model is presented. In the prior, there are apparently situations where you can prove things like: If Eloise can win every game of length n, then she can win the infinite game. In the latter case, there may be turns where Eloise has to erase stuff from the board and put other stuff there. At any given time in the latter case, Eloise can only depend on what is on the board to answer Abelard’s question.

At the moment, I’m still trying to get my head around what kinds of things Abelard might ask and what kinds of things Eloise might answer. I’m also trying to think of what other sorts of open questions might benefit from this sort of reasoning. The Riemann hypothesis? The Goldbach conjecture?

Clifford Algebras for Rotating, Scaling, and Translating the Plane June 8th, 2009
Patrick Stein

In my previous post, I reviewed how the complex numbers can be used to represent coordinates in the plane and how, once you’ve done that, complex arithmetic leads naturally to rotations, scalings, and translations of the plane. Today, we’re going to do the same with the Clifford algebra \mathcal{C}\ell_2.

What are Clifford Algebras

In our previous post, we used two different ways to represent coordinates in the plane. We used an ordered pair of real numbers like (3,5) and we used the real and imaginary parts of a complex number like 3 + 5i. Another way we could have written the coordinates in the plane is as a vector. Typically, to express a vector, we pick an axis (say, the x-axis) and then pick a second axis perpendicular to it (say, the y-axis). Most physics books would call these \hat{i} and \hat{j}. I am going to use e_1 and e_2 instead so that there is no confusion with i = \sqrt{-1} and because it is a notation that we will continue throughout Clifford algebras. We could then express (3,5) as 3e_1 + 5e_2. Here, e_1 and e_2 are called unit vectors. We assume they have length one so that when we take three of them, we get something with length three (for arbitrary values of three).

Having done that, we can easily multiply any vector by a real number using the normal distributive law: s \cdot \left(xe_1 + ye_2\right) = (sx)e_1 + (sy)e_2. And, we can add vectors just like we added complex numbers: summing like parts. So, (ae_1 + be_2) + (ce_1 + de_2) = (a+c)e_1 + (b+d)e_2. Of course, subtraction goes the same way: (ae_1 + be_2) - (ce_1 + de_2) = (a-c)e_1 + (b-d)e_2.

Read the rest of this entry ⇒

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!

Read the rest of this entry ⇒

Updates In Email

Email:

l