9
$\begingroup$

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.

  • 0
    @Christian: You are right that I've chosen a bad example. Yes, OpenGL uses column vectors. The multiplication on the right happens in OpenGL because it moves the basis or reference frame of the space whereas multiplying on the right moves the object itself in the space. I think that's why I see these multiplications sometimes on the left and others on the right.2011-09-04

2 Answers 2

0

Like Yoda says, "There is no why." There is no rhyme or reason to it. Mathematics is laced with a hodge-podge accumulation of inconsistent conventions that often make learning and doing higher math as cumbersome as learning and doing arithmentic with Roman numerals!

Somewhere along the line, someone defined matrix multiplication as, $C(i,j)=\sum_{k}A(i,k)B(k,j)$, when it could just as well have been defined as

$C(i,j)=\sum_{k}A(i,k)B(j,k)$,

$C(i,j)=\sum_{k}A(k,i)B(k,j)$,

$C(i,j)=\sum_{k}A(k,i)B(j,k)$,

$C(i,j)=\sum_{k}A(j,k)B(k,i)$,

$C(i,j)=\sum_{k}A(j,k)B(i,k)$,

$C(i,j)=\sum_{k}A(k,j)B(k,i)$, or

$C(i,j)=\sum_{k}A(k,j)B(i,k)$.

Someone else decided that the the composition of $a$ and $b$ should be written as $a*b$. Someone else decided that this was inconsistent and wrote the composition of $a$ and $b$ as $b*a$, when he could just as well have redefined matrix multiplication!

Conventions are not written in stone. If you don't like them, make up your own. That's what I do. For the composition of two permutations $a$ and $b$, expressed as row vectors in APL (A Programming Language), I write $c\leftarrow a$[$b$] and APL assigns the result of the composition to the variable $c$. I just use the same notation, replacing the $\leftarrow$ with an =. It turns out that the ] is actually redundant, so $a$[$b$ is just a rewrite of $a$*$b$.

If $A$, $B$, and $C$ are the corresponding matrices that represent these permutations, I write $C$=$AB$, where $AB$ is just the standard multiplication of $A$ and $B$. Problem solved.

How about an example? Consider two permutations in $S_4$, 2431 and 3214:

2431[3214]=3421

3214[2431]=2413

Let's see what happens when we multiply the corresponding matrices from the irreducible representation of $S_4$. These matrices permute the vertices of a tetrahedron at the $(x,y,z)$ coordinates $(6,4,3)$, $(-6,4,3)$, $(0,-8,3)$, and $(0,0,-9)$ among themselves. Making a matrix with these coordinate as the columns, we get:

$ \begin{array}{rrrr} 6 & -6 & 0 & 0\\ 4 & 4 & -8 & 0\\ 3 & 3 & 3 & -9 & \\ & \\ & \\ & \\ & \end{array} $

Multiplying this matrix from the left by the representation matrix for 2431, we get:

$ \begin{array}{rrrlrrrrlrrrr} -1/2 & -1/4 & -2/3 & & 6 & -6 & 0 & 0 & & -6 & 0 & 0 & 6\\ 1/3 & 5/6 & -4/9 & \times & 4 & 4 & -8 & 0 & = & 4 &0 & 4 & -8\\ 1 & -1/2 & -1/3 & & 3 & 3 & 3 & -9 & & 3 & -9 & 3 & 3\\ & \\ & \\ & \\ & \\ & \end{array} $

Multiplying the same matrix from the left by the representation matrix for 3214, we get:

$ \begin{array}{rrrlrrrrlrrrr} 1/2 & -3/4 & 0 & & 6 & -6 & 0 & 0 & & 0 & -6 & 6 & 0\\ -1 & -1/2 & 0 & \times & 4 & 4 & -8 & 0 & = & -8 & 4 & 4 & 0\\ 0 & 0 & 1 & & 3 & 3 & 3 & -9 & & 3 & 3 & 3 & -9\\ & \\ & \\ & \\ & \\ & \end{array} $

Multipying the representation matrices in the order 2431 $\times $ 3214, we get:

$ \begin{array}{rrrlrrrlrrr} -1/2 & -1/4 & -2/3 & & 1/2 & -3/4 & 0 & & 0 & 1/2 & -2/3 \\ 1/3 & 5/6 & -4/9 & \times & -1 & -1/2 & 0 & & = -2/3 & -2/3 & -4/9 \\ 1 & -1/2 & -1/3 & & 0 & 0 & 0 & & 1 & -1/2 & -1/3 \\ & \\ & \\ & \\ & \\ & \end{array} $

...which is the represntation matrix for the permutation 3421:

$ \begin{array}{rrrlrrrrlrrrr} 0 & -1/2 & -2/3 & & 6 & -6 & 0 & 0 & & 0 & 0 & -6 & 6\\ -2/3 & -2/3 & -4/9 & \times & 4 & 4 & -8 & 0 & = & -8 & 0 & 4 & 4\\ 1 & -1/2 & -1/3 & & 3 & 3 & 3 & -9 & & 3 & -9 & 3 & 3\\ & \\ & \\ & \\ & \\ & \end{array} $

...just as we wanted. You can check for yourself that multiplying the matrices in the opposite order gives you a matrix for the representation of the permutation 2413, as given at the beginning of this example - unless I have made some typing error here; this is VERY tedious!

  • 4
    "There is no rhyme or reason to it." - not even wrong, this one. We use definitions that are *convenient* to use, nothing more. Conventions are indeed not written in stone, but we do use the ones that are (wait for it...) *convenient* to use for further work.2011-09-02
4

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 $

  • 0
    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.2016-10-27