[Math] What does multiplication of two quaternions give

quaternions

I'm using quaternions as a means to rotate an object in the application I'm developing. If one quaternion represents a rotation and the second quaternion represents another rotation, what does their multiplication represent? Many web sites talk about formulas and matrices, but I want to know what exactly are we doing multiplication for?

Best Answer

The multiplication of quaternions represents composing the two rotations: perform one rotation and then perform the other one. It's clear that this should represent a rotation (imagine rotating, say, a bowling ball in place). What's not necessarily immediately clear — and this is what in some sense 'motivates' the quaternion representation of a rotation — is the fact that that every rotation in three dimensions can be written as a rotation by some amount about a single axis: for instance, the combination of a rotation by $\frac\pi4$ about the $x$-axis followed by a rotation by $\frac\pi3$ about the axis $(1,1,1)$ can still be written as a single rotation about some axis.

As pointed out in the comments, composition of rotations isn't necessarily commutative (and thus the multiplication of quaternions can't be); for instance, imagine labeling the six faces of a cube $\pm X, \pm Y, \pm Z$ according to which way they're facing, and then looking at the $+X$ face with the $+Y$ axis to your right and the $+Z$ axis up. Now, perform two (clockwise, $90^\circ$) rotations: one about the $+Z$ axis and one about the $+Y$ axis. Doing the rotation about $Z$ first will bring the $+Y$ face of the cube to face you, with the $+Z$ face still up; then rotating about $Y$ will bring the $-Z$ face of the cube facing you, with $+Y$ on top. By contrast, if you rotate about the $+Y$ face first then $-Z$ will be facing you, with $+X$ up and $+Y$ to the right; then rotating about the $+Z$ axis will have $+Y$ facing you with $+X$ up.

Also, you need to be a little careful about 'mixing metaphors' with your representations: quaternions represent rotations and multiplication of quaternions represents composition of those represented rotations, but — for instance — if $q$ is some rotation and $v$ is a vector, then multiplying $qv$ (representing $v$ via the 'fully imaginary' quaternion $v_x{\bf i}+v_y{\bf j}+v_z{\bf k}$) does not represent the rotation of that vector according to the given rotation (it's hard to see how it could, since generally such a multiplication would have a non-zero real component); instead, the result of rotating by the specified quaternion is calculated by $v_{\rm{rot}} = q^{-1}vq$ (and it can be shown that this value is also purely imaginary, so it can be converted 'back' to a three-vector consistently).