Multiplication order of rotation matrices

23.2k Views Asked by At

I have three 3D coordinate frames: O, A and B, as shown below.

enter image description here

I want to know the rotation matrix RAB between A and B, that is the rotation that is required, with respect to the frame A, to move from A to B.

Let us imagine that all I know, is the rotation matrix RAO between A and O, and the rotation matrix ROB between O and B. By inspecting the above diagram:

$$ R_{AO} = \left [\begin{array}{ccc} 1 & 0 & 0 \\ 0 & 0 & -1 \\ 0 & 1 & 0 \\ \end{array} \right ]$$

$$ R_{OB} = \left [\begin{array}{ccc} 0 & 0 & 1 \\ -1 & 0 & 0 \\ 0 & -1 & 0 \\ \end{array} \right ]$$

So, what is the correct way to determine RAB? There are two suggestions that come to mind:

(1) RAB = RAO ROB

(2) RAB = ROB RAO

Now, my intuition is that (1) is correct, i.e. post-multiplication. This is because I am multiplying everything with respect to the local coordinate frame (as discussed in http://web.cse.ohio-state.edu/~whmin/courses/cse5542-2013-spring/6-Transformation_II.pdf).

However, when I compute this, I get:

$$ R_{AB} = \left [\begin{array}{ccc} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0 \\ \end{array} \right ]$$

Whereas by inspection of the diagram, it should be:

$$ R_{AB} = \left [\begin{array}{ccc} 0 & 1 & 0 \\ -1 & 0 & 0 \\ 0 & 0 & 1 \\ \end{array} \right ]$$

Which, I have noticed, is equal to the pre-multiplication solution of (2).

Please can somebody explain to me why (2) seems to be correct, rather than (1)? I was under the impression that if all your transformations are with respect to the current local frame, then post-multiplication should be done, i.e. multiply the matrices from left to right as you move between each frame. However, when doing the maths, pre-multiplication gives the expected answer.

3

There are 3 best solutions below

0
On

My sense is that this is due to the fact that you are multiplying matrices on the left. That is, the rotation matrix $R_{AO}$ operates on the vector $(x,y,z)$ by:

$\begin{pmatrix} 1 & 0 & 0 \\ 0 & 0 & -1 \\ 0 & 1 & 0 \end{pmatrix} \cdot \begin{pmatrix} x \\ y \\ z\end{pmatrix}$

and so really, your "post-multiplication" operation is given by (2) rather than (1); that is, post-multiplying the rotation $R_{AO}$ by the rotation $R_{OB}$ is given by the matrix $R_{OB}\cdot R_{AO}$, not $R_{AO} \cdot R_{OB}$. If your multiplication was on the right, it would be given by (1), but then your matrices would change.

In general, this is a group-theoretic law of composition given left multiplication as the group operation.

0
On

It is important to know what is being rotated. $R_{AO}$ is transforming a point in $A$ to a point in $O$, or equivalently rotating frame $O$ to frame $A$.

Therefore, you can first rotate a point $x_A$ from $A$ to $O$ using $R_{AO}$, and then rotate the resulting point $x_O$ from $O$ to $B$ using $R_{OB}$.

$x_B = R_{OB} x_O = R_{OB} R_{AO} x_A$

I prefer a different syntax that focuses on how the frames are rotated with respect to each other instead of the points. That would mean that $R_{AO}$ is rotating frame $A$ to frame $O$, or equivalently, rotating a point from frame $O$ to frame $A$.

0
On

Maybe it's a little more intuitive when you think of this in the representation in the field of Robotics. That's where I learned it in the first place... In robotics, a rotation from $O$ to $A$ is denoted by ${}^{O}_{A}R$, it's the same matrix as $R_{AO}$ you write in your question (rotating by $-90$ degree about $x$-axis).

Then the $R_{OB}$ can be denoted as ${}^{B}_{O}R$, which is first rotate $-90$ degree about $z$-axis and then rotate about $-90$ degree about the new $x$-axis.

Then we have ${}^{B}_{A}R = {}^{B}_{O}R\ {}^{O}_{A}R$.

By the way, I believe this is the post-multiplication in the link you shared.

Hope it helps!