# Why does rotation by a quaternion require multiplying two times?

Given a vector $p$, to rotate it by a quaternion $q$, we use the formula:

$$p' = q p \hat{q}$$

where $\hat{q}$ is the conjugate of $q$. But if we use rotational matrices, then it's just

$$p' = Rp$$

While it's clear why the matrices work this way, I just cannot develop any intuition on quaternion rotation formula. I realise the formula does work, but still my guts feel as if it was “rotate $p$ by $q$ and then compose it with the inverse rotation of $q$”. Maybe there is some simple explanation?

• For instance, $p\mapsto qp$ does not even stabilize pure quaternions. – Captain Lama Apr 22 '16 at 20:44
• Yes, for starters, remember that in one case you're treating $p$ as a vector in $\Bbb R^3$ and in the other you're treating it as a quaternion (i.e., vector in $\Bbb R^4$). – Ted Shifrin Apr 22 '16 at 20:45
• There are very good explanations in math.stackexchange.com/q/302465 – Jean Marie Apr 22 '16 at 21:13

Lets try to develop the formula:

$$p' = q p \hat{q} = \left(\begin{array}{cc} \vec{p'} \\ 0\end{array} \right) = \left(\begin{array}{cc} \vec{u}\sin{\phi\over2} \\ \cos{\phi\over2}\end{array} \right) \otimes \left(\begin{array}{cc} \vec{p} \\ 0\end{array} \right) \otimes \left(\begin{array}{cc}- \vec{u}\sin{\phi\over2} \\ \cos{\phi\over2}\end{array} \right)$$

In which $\vec{u}$ and $\phi$ are the axis and angle of the rotation represented by the quaternion. After various transformation that I will omit for sake of brevity you obtain

$$\vec{p'} = \vec{p}_\perp \cos{\phi} + \left( \vec{u}\times \vec{p}\right)\sin{\phi} + \vec{p_\parallel}$$

That is the 3D vector rotation formula. Moreover, considering both $$p' = q p \hat{q}$$ $$p' = Rp$$

You can derive the result:

$$\left(\hat{q}\right)^\oplus \left(q\right)^+ = \left(\begin{array}{cc}R & 0\\ 0 & 1\end{array}\right)$$

where R is the rotation you were referring to.

• That seems to be correct :), though I am still troubled what is the intuition for this... – ntg Aug 17 '16 at 12:12