# Why multiplying those 2 quaternions doesn't give the expected result?

Using a left-handed coordinate system, let

Q = axisAngle({0,0,1}, 1/4*pi) * axisAngle({0,1,0}, 1/4*pi)


be the quaternion representing the rotation "1/8 circle clockwise around the global Z axis, then inclinate 1/8 circle down". Also, let $V$ be the result of rotating $\{1,0,0\}$ by $Q$. By using a calculator, I found that:

$V = \left\{\frac12, \frac12, -\sqrt{\frac12}\right\}$

But I expected $V$ to be:

$V = \left\{\sqrt{\frac13}, \sqrt{\frac13}, -\sqrt{\frac13}\right\}$

After all, if we apply said rotation manually, that's the direction we get. What is wrong with my elaboration?

• It looks like it's an issue of normalization. – Cameron Williams May 30 '15 at 1:44
• I tried normalizing the 3 related quaternions and it still didn't give the expected answer. Weird. Can I assume my expectation was correct? – MaiaVictor May 30 '15 at 1:58
• How did you calculate V? As noted, your resultant vector isn't of unit length, which - given that your original vector was - implies that you've not actually performed a rotation. – Steven Stadnicki May 30 '15 at 2:42
• I calculated V with the following formula: V = Q * (0,Vx,Vy,Vz) * conjugate(Q), where conjugate (Qw,Qx,Qy,Qz) = (Qw,-Qx,-Qy,-Qz). I'm not sure what you mean, both V's are of unit length. – MaiaVictor May 30 '15 at 4:22

## 1 Answer

If you define the rotation of $V$ by $Q=Q_LQ_R$ to be $$(Q_LQ_R)V(Q_LQ_R)^{-1}=Q_L\left(Q_RVQ_R^{-1}\right)Q_L^{-1},$$ then you're rotating by $Q_R$ first and $Q_L$ second. So you're rotating $\{1,0,0\}$ around the Y axis, then the Z axis.

Edit: The above is one problem. Another problem is that all rotations by $\pi/4$ around the global axes are matrices whose elements are rational multiples of $\sqrt2$. There's no way to combine such matrices, in any order, that will generate $\sqrt3$. In order to get that, you'll want a different angle for your second rotation, something like $\pi/6$ or $\pi/3$.