[Math] Why composite transformations are multiplied to the right side

linear algebramatricestransformation

I have seen that many composite transformations have the later transformation multiplied to the right side of the matrix. Say I have matrix an existing transformation matrix $\mathbf{M}$ and then other transformation matrices $S$ for scaling, $T$ for translation, $R$ for rotation. I want to do a rotation first then translation then scaling, I have to do this: $\mathbf{M}(R)(T)(S)=\mathbf{M'}$. Now the final matrix $\mathbf{M'}$ has the composite transformations in the sequence that I could use it to transform vectors with $\mathbf{M'}\vec{x}=\vec{x'}$.

But the question is why are transformations multiplied to the right side of the matrices and how can I prove that it has to be multiplied to the right side? What would the meaning be if I had multiplied them to the left side instead as $(S)(T)(R)\mathbf{M}=\mathbf{M'}$?

Sometimes, I have this tendency to multiply to the left because in row elementary operations, the matrices are multiplied to the left.

Best Answer

Sometime one has to left-multiply, sometimes one has to right-multiply. This really depends.

Prerequisites:

You are performing scaling, rotation, and translation. So let us assume we have linear point transformation of the general form:

$$\mathtt T = \left[ \begin{array}{cc} s\mathtt R & \mathbf t \\ \mathtt O& 1\end{array} \right]$$ which first rotates a point by $\mathtt R$ , then scales it by $s$ and then adds the translation $\mathbf t$:

$$\mathtt T \cdot \left( \begin{array}{c} \mathbf x \\ 1\end{array} \right) = \left[ \begin{array}{c} s(\mathtt R\cdot \mathbf x) + \mathbf t \\ 1\end{array} \right]$$

(Note that rotation and scaling commutes: $s(\mathtt R\cdot \mathbf x)=\mathtt R(s\cdot \mathbf x)$)

From now on we will assume that all points $\mathbf y$ are homogenous points ($\mathbf y= (\mathbf x, 1)^\top $).

Mind the reference frames: In order to make it clear whether you need a left or right multiplication, it is important to highlight in which reference frame your points are!

Let us assume, we have points $\mathbf y_a$ in reference frame $a$, and you want to transform them into reference frame $b$, you do

$$ \mathbf y_b = \mathtt T_{ba} \mathbf y_a$$ where $\mathtt T_{ba}$ is a transformation to $b$ from $a$. Note that the indices must match!

Now, let us look at a more complicated example. One might be interested in:

$$\mathbf y_a = \mathtt T_{ab}\mathtt T_{bc}\mathtt T_{cd}\mathbf y_d$$

Further, let's assume that we receive the poses in order (First $\mathtt T_{ab}$, then $\mathtt T_{bc}$...).

We would calculate in an algorithm:

$\mathtt T_{ai} := \mathtt T_{ab}$

(thus, $i=b$)

$\mathtt T_{ai} := \mathtt T_{ai}\cdot \mathtt T_{bc}$

(now, $i=c$)

$\mathtt T_{ai} := \mathtt T_{ai}\cdot \mathtt T_{cd}$

($i=d$)

Thus, we right-multiplied and $\mathtt T_{ai}$ means now $\mathtt T_{ad}$, the transformation from $d$ to $a$. Finally, we can transform our points:

$$\mathbf y_a := \mathtt T_{ad} \mathbf y_d $$

However, if one really wants to left-multiply, this is possible too! Note that $\mathtt T_{ia}=\mathtt T_{ai}^{-1}.$ Thus, we can do:

$\mathtt T_{ia} := \mathtt T_{ab}^{-1}$

($i=b$)

$\mathtt T_{ia} := \mathtt T_{bc}^{-1} \mathtt T_{ia}$

($i=c$)

$\mathtt T_{ia} := \mathtt T_{cd}^{-1}\mathtt T_{ia}$

($i=d$)

Thus, we have $\mathtt T_{ia} = \mathtt T_{da}$, and therefore we can transfrom the point from $d$ to $a$ using the inverse:

$$\mathbf y_a := \mathtt T_{da}^{-1} \mathbf y_d $$

Related Question