Coordinate/matrix multiplication

3.3k Views Asked by At

If I multiply a 3d coordinate (padded with a 1 to make it a 4x1 matrix) with a transformation matrix, I get a 1x4 matrix which contains my new (transformed) 3d coordinate.

Knowing that matrices must be multiplied in a single "direction", ie, AxB is not the same as BxA... and that the columns of the first matrix define the rows of the resulting matrix (and the rows of the second matrix define the columns of the resulting matrix), does this mean that the multiplication must always be this way around...

[X][Y][Z][1] * [.][.][.][.] = [new X]
               [.][.][.][.]   [new Y]
               [.][.][.][.]   [new Z]
               [.][.][.][.]   [.]

...and therefore you ALWAYS multiply a matrix by a coordinate and not a coordinate by a matrix?

...or is it...

[.][.][.][.] * [X] *  = [new X][new Y][new Z][.]
[.][.][.][.]   [Y]               
[.][.][.][.]   [Z]
[.][.][.][.]   [1]

Thanks I hope my babblings make sense.

2

There are 2 best solutions below

0
On BEST ANSWER

All the linear coordinate transformations I'm familiar with look like this:

$$ \left[\begin{array}{cccc} a & b & c & d \\ e & f & g & h \\ i & j & k & l \\ 0 & 0 & 0 & 1 \\ \end{array}\right] \left[\begin{array}{c} x \\ y \\ z \\ 1 \end{array}\right] = \left[\begin{array}{c} \text{new } x \\ \text{new } y \\ \text{new } z \\ 1 \end{array}\right] $$

$\text{new }x = ax + by + cz + d$ and so on.

0
On

You can't do the type of multiplication you've written.

If $A$ is an $m\times n$ matrix and $B$ is $n\times p$ matrix, then $AB$ is an $m\times p$ matrix. You can think of a row vector as a $1\times n$ matrix and a column vector as an $m\times 1$ matrix. So in your first equation above, you have a $1\times 4$ matrix multiplied by an $4\times 4$ matrix on the the left hand side, which would produce an $1\times 4$ matrix, but on the right hand side you have a $4\times 1$ matrix. Since a$1\times 4$ matrix and a $4\times 1$ matrix have different sizes, they cannot be equal.

Your second equation is impossible for a similar reason.

If you wanted to have your vector on the left, as in the first equation, the result would also have to be a $4\times 1$ row vector. There is nothing wrong with doing it this way, but as NovaDenizen suggests, it is by far more conventional to use a column vectors, with the transformation matrix on the left.