# Why composite transformations are multiplied to the right side?

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.

• Transformations are usually applied to points (vectors). Whichever of the orders is appropriate depends on whether the system is using row or column vectors... Sep 1, 2011 at 15:39
• In our usual system that we use when 'writing on paper', in which order do we usually use for composite transformations? So can I say that multiplying the transformations on the right side means that the system is using column vectors? Sep 1, 2011 at 15:48
• Transformations are not "multiplied"; transformations are applied. Usually, we write functions on the left of the argument (not always, and in some branches of math it is more common to write them on the right), so transformations are written down the same way we write any function: on the left, e.g., $T(\mathbf{x})$. However, in the case of vector spaces there is a natural identification of transformations with matrices which makes "apply the transformation" correspond to "multiply by the matrix". If you want the latter to be written like functions, you need to use column vectors. Sep 1, 2011 at 16:01
• If, say, I had some point $\mathbf p$ and wanted to rotate (with, say, the rotation matrix $\mathbf Q$) and then scale (with, say, the rotation matrix $\mathbf D$): if $\mathbf p$ was represented as a column, the sequence is $\mathbf D\mathbf Q\mathbf p$, and if $\mathbf p$ was a row, then I should be doing $\mathbf p\mathbf Q\mathbf D$. (Remember that $(\mathbf A \mathbf B)^T=\mathbf B^T \mathbf A^T$.) Sep 1, 2011 at 16:05
• Just to reiterate, so the natural way when written on paper for $T(\vec{x})$, if I wanted Rotation->Translation->Scale, it is $(S)(T)(R)M\vec{x}=M^'\vec{x}$ , is this right? And in this case, I'm using the column vectors as what J.M. mentions. If a particular system uses row vectors instead, say in OpenGL, then it'll have to take the transpose of the equation to become $((S)(T)(R)M\vec{x})^T=(M^{'}\vec{x})^T \Rightarrow \vec{x}^TM^T(R)^T(T)^T(S)^T=\vec{x}^T(M^{'})^T$, am I right? But this wouldn't be $T(\vec{x})$ any more since the now $\vec{x}$ is on the left side of $(M^{'})^T$. Sep 1, 2011 at 16:38

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$$

• If T_ba is a transformation from b -> a, it makes no sense to apply T_ad, a transformation from a to d, to y_d. Oct 27, 2016 at 20:37