Dot, cross, and quaternion products

This post will show that

quaternion product = cross product − dot product.

First, I’ll explain what quaternions are, then I’ll explain what the equation above means.

The complex numbers are formed by adding to the real numbers a special symbol i with the rule that i2 = −1. The quaternions are similarly formed by adding to the real numbers i, j, and k with the requirement [1] that

i2 = j2 = k2 = ijk = −1.

A quaternion is a formal sum of a real number and real multiples of the symbols i, j, and k. For example,

q = w + xi + yj + zk.

In this example we say w is the real part of q and xi + yj + zk is the vector part of q, analogous to the real and imaginary parts of a complex number.

The quaternion product of two vectors (x, y, z) and (x´, y ´, z´) is the product of q = xi + yj + zk and q‘ = x’i + y’j + z’k as quaternions. The quaternion product qq´ works out to be

− (xx´ + yy´ + zz´) + (yz´ − zy´)i +(zx´− xz´)j + (xy´− yx´)k

The real part is the negative of the dot product of (x, y, z) and (x´, y´, z´) and the vector part is the cross product of (x, y, z) and (x´, y´, z´).

NB: The context here is vectors of length 3 embedded in the quaternions. In general the quaternion product is more complicated. The products are simpler in the special case of the real component being zero. See, for example, this post.

This relationship is an interesting bit of algebra on its own, but it is also historically important. In the 19th century, a debate raged regarding whether quaternions or vectors were the best way to represent things such as electric and magnetic fields. The identity given here shows how the two approaches are related.

Related posts

[1] To multiply two quaternions, you need to know how to multiply i, j, and k by each other. It is not immediately obvious, but you can derive everything from i2 = j2 = k2 =ijk = −1. For example, start with ijk = −1 and multiply both sides on the right by k. So ijk2 = −k, and since k2 = −1, ij = k. Similar manipulations show jk = i and ki = j.

Next, (jk)(ki) = ij, but it also equals jk2i = −ji, so ij = −ji = k. Similarly kj = −jk = −i and ik = −ki = −j and this completes the multiplication table for i, j, and k.

The way to remember these products is to imagine a cycle: i -> j -> k -> i. The product two consecutive symbols is the next symbol in the cycle. And when you traverse the cycle backward, you change the sign.

9 thoughts on “Dot, cross, and quaternion products

  1. Something that I found really interesting in this area is the generalization of these concepts to physics (E&M included) in Geometric Algebra. The papers I read for an introduction (with a nice history that ties in vectors and quaternions) came from the `Handouts’ section here. I highly recommend reading them, as they are quite accessible. Part I is the most relevant to this post.

    To somewhat paraphrase the Geometric Algebra proponents (disclaimer: I am far from an expert on this), both quaternions and vectors are awkward for the things that they are employed to solve. Quaternions aren’t a nicely closed system… as John pointed out in the footnote, binary products of i, j, and k cycle to each other, but squares and triple products degenerate to a scalar, which in most applications, you just have to throw away in the final result when you fully combine objects. Vectors are a bit better, but the cross-product is awkward, and that awkwardness shows up in the complex identities and manipulations that are used. Plus, the cross-product concept works only in 3-D space. You might say, “well, that’s ok, since that is what we live in.” However, Geometric Algebra generalizes the concepts and shows an elegant way of manipulating and interpreting all of the quantities involved, and in generalized spaces, and, imho, even better just restricted to 3-D space.

    I’ll add that I agree with a lot of what they claim. Even just restricted to 3-D, the Geometric Algebra approach makes more sense and, when compared side by side, seems easier to work with on a practical level. Well, it would, but since so much has been invested in the vector approach by a lot of smart people over a long period of time, the vector approach has many established shortcuts and community of knowledge to make vector solutions very doable. I kind of think of it like successful open-source software… even if the software might be “inferior” on many objective criteria, I’ll likely use it if it as an active and helpful community.

    Not to distract you from your E&M studies, but I personally found the Geometric Algebra papers fascinating.

  2. I think it’s odd how often quaternions are introduced using i,j and k, rather than describing them using 2×2 complex matrices of the form [z -wbar ; w zbar]. Students familiar with complex numbers and matrices would immediately know how to multiply, add and invert them.

  3. Geometric Algebra really illustrates this relationship perfectly. Replace the Cross Product with the Wedge Product and it generalizes to N-dimensions, plus it has a simple intuitive interpretation (signed areas of parallelagrams/parallelepipeds [sp?]).

  4. I second the comments about Geometric Algebra. I do quite a lot of geometric optimization in my dissertation. Switching to the mind frame of GA made thinks very much more understandable for me. However as the basics are quite a mouthful I decided to express my theory using dual quaternions and quaternions instead of the full GA package – the main reason is that they are much simpler to introduce in a way similar to how John does in this post.

  5. Vectors are a marvellous tool for many parts of physics. They are perhaps too powerful, because they’ve been applied to things that are not strictly speaking vectors. I mean of rotations and magnetism.

    Let’s say you have a right-handed coordinate system i, j k and a left-handed system i’, j’ and k’. If you express position or speed or force or any of the normal vectors in both of the coordinate systems, the representations will have different coefficients, but the resulting vector will be the same.

    However, if you express e.g. torque in both systems, the axial vector will point to opposite directions, depending on the handedness. This is just bonkers! Representing rotation with the plane of rotation instead of the axis of rotation, as is done in GA, fixes the problem.

    The same applies to magnetism of course. But there we have the even bigger problem that electric and magnetic fields are in fact just components of the EM-field F, which has six degrees of freedom. Currently, we must keep track of both components simultaneously. And they are coupled together in a most non-linear way. Usch!

    I’d love to see something like geometric algebra to emerge from the shadows. Imagine if one day we could just speak of Maxwell’s equation, without resorting to the plural…

  6. Doesn’t it seem obvious that it would be the cross product less the dot product since i^2 = -1 and ij = k, i.e., icdot i = -1 and i times j = k, or said in a different way, hat{x}_i cdot hat{x}_j = -delta_{ij} and hat{x}_i times hat{x}_j = epsilon_{ijk} ?

    I’m really happy you put this up, I’ve been wondering what quaternions are … Looks like a curious but not particularly useful (for physics, that is) way of expressing vector algebra. Please, correct me if I’m wrong.

  7. (Edit that last one a bit… hat{x}_i cdot hat{x} j = -hat{x}_idelta{ij} and hat{i}_i times hat{x}_j = hat{x}_k epsilon_{ijk} )

  8. can you tell me something more about quaternions I’ ve read somewhere that concept of dot and cross product is a consequence of the quaternions, historically?

Comments are closed.