# Quaternion Matrix Multiply

My question is about applying rules of quaternions to quaternion matrices.

I know that for some rotation quaternion q = [w, x, y, z], I can find the rotation of point p1 by p2 = q*p1*conjugate(q). I also know that I can do quaternion multiplication to get the combined rotation of 2 quaternions q1 and q2 by using quaternion multiplication q = q1*q2 as expressed here.

Now suppose I construct a quaternion matrix as described here. Furthermore suppose I do that for three coordinate axes to construct three quaternion matrices Qx Qy and Qz. Could I then get a combined quaternion matrix to achieve the same result by doing Q = Qz*Qy*Qx and then applying that to p1 (i.e. p2 = Q*p1)? Obviously the ordering here matters.

This is somewhat similar to this question, but I am specifically interested in knowing if the method I have shown produces the correct result. This question is also not about whether or not this approach is the preferred way to do it.

This question has some nice references, but I didn't find the answer to what I'm asking at any of the links.

-
What does "the same result" mean here? –  Qiaochu Yuan May 29 '13 at 3:36

First of all, let's note that what you linked to is a quaternion derived rotation matrix of an axis-angle representation. That is, given a vector $\vec{a}$ and an angle $\theta$, you get a rotation matrix $A$ such that $Ap_1=p_2$. The only way quaternions came into play is during the translation between the axis-angle and the rotation matrix.

Therefore the question appearing after the first paragraph is about regular rotation matrices, and the quaternion stuff mentioned in the first paragraph doesn't really come into play.

"Suppose I have a rotation of $\theta$ around axis $\vec{a}$ and I make a rotation matrix $R$ like in the link that produces the rotation for $\vec{a}$ and $\theta$. Further suppose that I have figured out three rotations around the axes which compose to the same rotation, and I find their matrices individually and multiply them together to get another rotation matrix. Is this product matrix the same as $R$?"

The answer, provided you have used a single basis the entire time, is "yes." This is because the $n\times n$ special orthogonal matrices faithfully represent the group of rotations in $\Bbb R^3$ for a fixed basis. That is, each matrix corresponds to exactly one rotation.

As an aside, this can be contrasted with the quaternion case, since for every rotation there are two quaternions that represent it, so the unit quaternions don't faithfully represent the rotations (although they come pretty close.) It turns out that if $q$ represents a certain rotation, then so does $-q$. So, if you come up with two unit quaternions $x$ and $y$ via two different methods, and you know they produce the same rotation, then you can only conclude that $x=\pm y$

-