# Decomposing rotation into rotation around certain axis and remaining rotation

Let R be a rotation matrix in three-dimensional euclidean space, R ∈ SO(3). Let v be a unit vector in said space.

Is it possible to decompose R into matrices A and B so that following holds?

• AB = R
• A is a rotation around the axis indicated by v

If it is possible, how can it be done?

• $A$ is invertible; so, $B=A^{-1}R$. – Michael Galuza Jul 16 '15 at 12:32
• So in particular, $A = I$ and $B = R$ is a solution – Niklas B. Jul 16 '15 at 12:34
• Do you need explicit formula for rotation around $\vec v$? – Michael Galuza Jul 16 '15 at 12:45
• This seems to be much less constrained than other procedures that are called "decomposition." Basically you can take any rotation around $v$, call it $A$, then write the matrix product $AB=R$. Are you sure there are not any additional properties you want $B$ to have, other than making this equation true? – David K Jul 16 '15 at 12:50
• Indeed, I did not define the problem very well. I could say that I don't want B to have any rotational components around v, but I'm not sure whether that even makes sense. – Emiswelt Jul 16 '15 at 14:22

You already seen that $B = A^{-1} R$, but what is $A$?

Use the rotation $\varphi$ about an axis $\bf v$ formula defined as

$$A = \mathbf{1}+(\sin\varphi) [\mathbf{v}\times] + (1-\cos\varphi) [\mathbf{v}\times][\mathbf{v}\times]$$

where $[\mathbf{v}\times]$ is the 3×3 skew symmetric cross product operator. It follows that

$$A^{-1} = \mathbf{1}-(\sin\varphi) [\mathbf{v}\times] + (1-\cos\varphi) [\mathbf{v}\times][\mathbf{v}\times]$$

So now we have an expression for $B$ in terms of the angle $\varphi$

$$B(\varphi) = R -(\sin\varphi) \mathbf{v}\times R + (1-\cos\varphi) \mathbf{v}\times \mathbf{v}\times R$$

To find $\varphi$ I suggest taking the trace if $B$ and maximizing it. Why? The trace of any 3×3 rotation matrix is: ${\rm trace}(R(\theta))=(1+2\cos\theta)$ with a maximum value at $\theta=0$. By maximizing the trace we are finding rotation $\varphi$ which yields the smallest rotation $B$.

NOTE:

The trace of a combined rotation is $${\rm trace}( {\rm Rot}(\mathbf{u},\varphi){\rm Rot}(\mathbf{v},\theta)) =\\ n^2+\cos\theta (1-n^2)+\cos\varphi(1-n^2+\cos\theta(1+n^2))-2(\sin\varphi\sin\theta) n$$

where $n=\mathbf{v}\cdot\mathbf{u}$ is the dot product of the two axes.

You can solve for $B$ as follows. Let $R$ be the rotation you specified, and $A$ be any rotation around the axis indicated by $v$. Then define $$B = A^{-1}R$$ $A$ has an inverse since all rotations do. Now $$AB = R$$

• How is it possible to get the rotation around the axis indicated by v? Niklas B suggested using a vector w that's orthogonal to v and apply R. However, It's possible that for different w the result is different, for example when we rotate by 90° around the axis orthogonal to v and w, than A will always be I. – Emiswelt Jul 16 '15 at 12:39
• @Emiswelt There are many possible solutions to the problem. You will find a $B$ for each $A$ you choose. – muaddib Jul 16 '15 at 12:41
• Look up the Rodrigue's Rotation Matrix – John Alexiou Jul 16 '15 at 12:56

As the other answers note, $B = A^{-1}R$, or equivalently $BR^{-1} = A^{-1}$.

If you would like the Axis/Angle representations of $A$ and $B$ to be orthogonal (i.e. so that $AA(A) \cdot AA(B) = 0$), it is possible to do this explicitly without solving an optimization problem.

First, if $AA(A) || v$, then choose some vector $w$ s.t. $w \cdot v = 0$.

Now we want to find the matrix $B$ s.t. $BR^{-1} w \cdot v = 0$.

To do this, we first compute a (normalized) projection $p = \frac{R^{-1}w - (R^{-1}w \cdot v)v}{||R^{-1}w - (R^{-1}w \cdot v)v||}$ (Formula to project a vector onto a plane).

Now we compute $B$ to be the matrix that rotates $R^{-1}w \rightarrow p$ (Calculate Rotation Matrix to align Vector A to Vector B in 3d?).

The resulting matrix ($BR^{-1} || RB^{-1} = A$) fixes the axis $v$ by construction, and $B$ must fix an axis orthogonal to $v$.