<p><strong>TL;DR</strong></p>

<p>Let $M=\Biggl[\begin{matrix} Rx &amp; Ux &amp; Fx\\ Ry &amp; Uy &amp; Fy\\ Rz &amp; Uz &amp; Fz\\ \end{matrix}\Biggl], V = \Biggl(\begin{matrix}Vx\\ Vy\\ Vz \end{matrix}\Biggl)$</p>

<p>The correct multiplication is:
$V' = M V$ or $V'^T = V^TM^T$</p>

<p>Now to the proper explanation:</p>

<p>Whenever we define a coordinate in $R^{3}$ space that coordinate must be in respect to a basis. When one state that an arbitrary point in $R^{3}$ is $(x, y, z)$ it is implicit that this is in respect to the standard basis. Let's call $\vec{r}, \vec{u}, \vec{f}$ the axes that define an arbitrary basic $B$ in $R^{3}$. An arbitrary point $P$ can be defined as 
$$P = x * \vec{r} + y * \vec{u} + z * \vec{f}$$</p>

<p>Expanding we have:</p>

<p>$$P_x = x * \vec{r_x} + y * \vec{u_x} + z * \vec{f_x}$$
$$P_y = x * \vec{r_y} + y * \vec{u_y} + z * \vec{f_y}$$
$$P_z = x * \vec{r_z} + y * \vec{u_z} + z * \vec{f_z}$$</p>

<p>In matrix form we can write that as:
$$\Biggl(\begin{matrix}P_x\\ 
  P_y\\ 
  P_z\\ 
\end{matrix}\Biggl)=\Biggl[\begin{matrix} 
  \vec{r_x} &amp; \vec{u_x} &amp; \vec{f_x}\\ 
  \vec{r_y} &amp; \vec{u_y} &amp; \vec{f_y}\\ 
  \vec{r_z} &amp; \vec{u_z} &amp; \vec{f_z}\\ 
\end{matrix}\Biggl]\Biggl(\begin{matrix} 
  x\\ 
  y\\ 
  z\\ 
\end{matrix}\Biggl)$$</p>

<p>Another easy way to check this is to think about what is a rotation matrix. The matrix 
$$R_z = \Biggl[\begin{matrix} cos(\theta) &amp; -sin(\theta) &amp; 0\\ sin(\theta) &amp; cos(\theta) &amp; 0\\ 0 &amp; 0 &amp; 1\\ \end{matrix}\Biggl]$$ rotates a vector $\vec{v}$ by $\theta^{\circ}$ around $z$ axis or, to think in another way, represents $\vec{v}$ in a basis that is rotated $\theta^{\circ}$ from the standard basis. If you compute the axes of this new rotated basis you'll see that the new $\vec{r}, \vec{u}, \vec{f}$ of this rotated matrix are the columns of $R_z$ matrix.</p>

CC BY-SA 3.0
2017-06-19T18:28:43.440Z
Great answer, and thanks for a thorough explanation. I believe this is exactly what I'm looking for, though I'll need to reread your answer several more times to get it through in my head haha. But please fix your original M matrix to include z. Thank you again, good sir!
Matthew L
CC BY-SA 3.0
2017-06-20T15:54:23.963Z
Thanks @MatthewL for noticing that error. Just fixed it now!
Felipe Lira
CC BY-SA 3.0
2017-06-18T11:55:14.240Z
2017-06-20T15:53:08.717Z
2017-06-20T15:53:08.717Z
Felipe Lira
<p>Okay let us start by pointing out that a colmun major matrix is the same as a transposed row major matrix. So:</p>

<p>$$
{M_{cm}}^{T} = M_{rm} \tag{1}
$$</p>

<p>Then notice that matrixes have following properties. Matrix multiplication is associative (2a) and that the distribution of transpose reverses computation order (2b).</p>

<p>$$
A(BC)  =  (AB)C \tag{2a}
$$
$$
(AB)^T  =  B^TA^T \tag{2b}
$$</p>

<p>From these follow that the chain of multiplication events can be as long as one likes and all transpose does is inverse the computation. So given that we can conclude </p>

<p>$$
{T_1}\ {T_2}\ \ldots\ {T_n}\ \vec{v} = \vec v\,^T\ {T_n}^T\ \ldots\ {T_2}^T\ {T_1}^T, \tag{3}
$$</p>

<p>so calculating in column major order <strong>is the same calculation</strong> as calculating in row major orientation. The difference is that the order of computation is reversed. An interpretation of this is that the difference is the same as looking at the object from the outside or looking at the situation from the object out.</p>

<p>Formula 3 should provide you the insight. Just one more thing a column vector is the same as a transpose of a row vector.</p>

<p><strong>Note</strong>: You are allowed to mix and match the computations as much as you like. All you have do is remember is that the other approach is just transposed.</p>

CC BY-SA 3.0
2017-06-13T19:43:24.940Z
Thank you so much for sharing your knowledge. Please read my clarification edit. Thanks again.
Matthew L
CC BY-SA 3.0
2017-06-13T09:03:37.640Z
2017-06-13T10:22:32.700Z
2017-06-13T10:22:32.700Z
joojaa
<p>For column-major rotation matrices (right up forward in columns) do you right-multiply (post-multiply?) a row vector or left-multiply (pre-multiply) a column vector to result in a correct/valid transformation? Or are both "valid" but just transform different spaces?</p>

<p>In case I'm getting my terminology wrong, suppose we have 3x3 column-major matrix R. Is it R * V for column-major matrix, where V is 3x1? Or is it V * R for column-major matrix, where V is 1x3? What about for row-major?</p>

<p>Thanks so much for the help!</p>

<p>Edit: I believe my question needs further clarification. I am more confused about whether a vector, regardless if it's a row or column, is multiplied to the left or right of a <strong>row specific majored matrix</strong>. And vice versa for column-majored matrix, but it would be implied by answering either which one. I do understand the concept that transposing a matrix will just mean you have to transpose the vector and flip the order of multiplication, which will result in the same thing because you're multiplying the same elements the other way around. That is not the concern of my question (though thanks for those who answered that part). When I say row specific (or column), I'm talking about the way the <strong>right up forward vectors</strong> are positioned in the matrix. Though at this point, I think I already have figured out my answer just by typing this, but will leave it open for answers.</p>

<p>My question is simply this:
(sorry, I don't know how to format things here)</p>

<p>I have the following matrix composed of Right Up and Forward vectors:</p>

<p>Rx Ry Rz</p>

<p>Ux Uy Uz</p>

<p>Fx Fy Fz</p>

<p>This is a row-majored, orthonormal rotation matrix. Now I have a vector V as {V1 V2 V3} as either a 3x1 or 1x3 (right side or left side respectively, else the multiplication doesn't even work out). Is it R * V or V * R in this case of a row-major matrix? Again, not asking about 1x3 on left or 3x1 on right, but rather for a row-specific matrix, which way would produce a valid or meaningful transformation?</p>

<p>{V1*Rx + V2*Ry + V3*Rz, V1*Ux + V2*Uy + V3*Uz, V1*Fx + V2*Fy + V3*Fz} ?</p>

<p>OR</p>

<p>{V1*Rx + V2*Ux + V3*Fx, V1*Ry + V2*Uy + V3*Fy, V1*Rz + V2*Uz + V3*Fz} ?</p>

<p>I'm guessing the second, but would like clarification/confirmation. Thank you again!</p>

CC BY-SA 3.0
2017-06-13T19:47:52.683Z
You can actually try it and see if it results in a expected result or not. Note that matrix multiplication is only valid for the column vector comig after the matrix and row coming before due to the way matrix multiplication is defined. But you can allways transpose the vector resulting in the same thing (if the matrix chain is computed first)
joojaa
CC BY-SA 3.0
2017-06-14T05:56:31.980Z
Also note that for a pure rotation matrix the inverse is a transpose.
joojaa
CC BY-SA 3.0
2017-06-14T10:56:24.973Z
Rather than the 3x3 matrix, I think it'd be more instructive to use a 4x4 so as to include a translation part. That way you should get a clearer understanding of ordering etc.
Simon F
<matrix>
row and column majored rotation matrix pre- or post- multiplied
Matthew L
# row and column majored rotation matrix pre- or post- multiplied

(Asked by: username_0 on 2017-06-12)

For column-major rotation matrices (right up forward in columns) do you right-multiply (post-multiply?) a row vector or left-multiply (pre-multiply) a column vector to result in a correct/valid transformation? Or are both "valid" but just transform different spaces?

In case I'm getting my terminology wrong, suppose we have 3x3 column-major matrix R. Is it R \* V for column-major matrix, where V is 3x1? Or is it V \* R for column-major matrix, where V is 1x3? What about for row-major?

Thanks so much for the help!

Edit: I believe my question needs further clarification. I am more confused about whether a vector, regardless if it's a row or column, is multiplied to the left or right of a **row specific majored matrix**. And vice versa for column-majored matrix, but it would be implied by answering either which one. I do understand the concept that transposing a matrix will just mean you have to transpose the vector and flip the order of multiplication, which will result in the same thing because you're multiplying the same elements the other way around. That is not the concern of my question (though thanks for those who answered that part). When I say row specific (or column), I'm talking about the way the **right up forward vectors** are positioned in the matrix. Though at this point, I think I already have figured out my answer just by typing this, but will leave it open for answers.

My question is simply this:
(sorry, I don't know how to format things here)

I have the following matrix composed of Right Up and Forward vectors:

Rx Ry Rz

Ux Uy Uz

Fx Fy Fz

This is a row-majored, orthonormal rotation matrix. Now I have a vector V as {V1 V2 V3} as either a 3x1 or 1x3 (right side or left side respectively, else the multiplication doesn't even work out). Is it R \* V or V \* R in this case of a row-major matrix? Again, not asking about 1x3 on left or 3x1 on right, but rather for a row-specific matrix, which way would produce a valid or meaningful transformation?

{V1\*Rx + V2\*Ry + V3\*Rz, V1\*Ux + V2\*Uy + V3\*Uz, V1\*Fx + V2\*Fy + V3\*Fz} ?

OR

{V1\*Rx + V2\*Ux + V3\*Fx, V1\*Ry + V2\*Uy + V3\*Fy, V1\*Rz + V2\*Uz + V3\*Fz} ?

I'm guessing the second, but would like clarification/confirmation. Thank you again!

**Tags:** matrix

> **Comments:**
> **username_1**: You can actually try it and see if it results in a expected result or not. Note that matrix multiplication is only valid for the column vector comig after the matrix and row coming before due to the way matrix multiplication is defined. But you can allways transpose the vector resulting in the same thing (if the matrix chain is computed first)  
> **username_1**: Also note that for a pure rotation matrix the inverse is a transpose.  
> **username_2**: Rather than the 3x3 matrix, I think it'd be more instructive to use a 4x4 so as to include a translation part. That way you should get a clearer understanding of ordering etc.  

---

## 2 answers

### Answer by username_3 on 2017-06-18. Score: 1 | Accepted answer

**TL;DR**

Let $M=\Biggl[\begin{matrix} Rx & Ux & Fx\\ Ry & Uy & Fy\\ Rz & Uz & Fz\\ \end{matrix}\Biggl], V = \Biggl(\begin{matrix}Vx\\ Vy\\ Vz \end{matrix}\Biggl)$

The correct multiplication is:
$V' = M V$ or $V'^T = V^TM^T$

Now to the proper explanation:

Whenever we define a coordinate in $R^{3}$ space that coordinate must be in respect to a basis. When one state that an arbitrary point in $R^{3}$ is $(x, y, z)$ it is implicit that this is in respect to the standard basis. Let's call $\vec{r}, \vec{u}, \vec{f}$ the axes that define an arbitrary basic $B$ in $R^{3}$. An arbitrary point $P$ can be defined as
$$P = x \* \vec{r} + y \* \vec{u} + z \* \vec{f}$$

Expanding we have:

$$P\_x = x \* \vec{r\_x} + y \* \vec{u\_x} + z \* \vec{f\_x}$$
$$P\_y = x \* \vec{r\_y} + y \* \vec{u\_y} + z \* \vec{f\_y}$$
$$P\_z = x \* \vec{r\_z} + y \* \vec{u\_z} + z \* \vec{f\_z}$$

In matrix form we can write that as:
$$\Biggl(\begin{matrix}P\_x\\
P\_y\\
P\_z\\
\end{matrix}\Biggl)=\Biggl[\begin{matrix}
\vec{r\_x} & \vec{u\_x} & \vec{f\_x}\\
\vec{r\_y} & \vec{u\_y} & \vec{f\_y}\\
\vec{r\_z} & \vec{u\_z} & \vec{f\_z}\\
\end{matrix}\Biggl]\Biggl(\begin{matrix}
x\\
y\\
z\\
\end{matrix}\Biggl)$$

Another easy way to check this is to think about what is a rotation matrix. The matrix
$$R\_z = \Biggl[\begin{matrix} cos(\theta) & -sin(\theta) & 0\\ sin(\theta) & cos(\theta) & 0\\ 0 & 0 & 1\\ \end{matrix}\Biggl]$$ rotates a vector $\vec{v}$ by $\theta^{\circ}$ around $z$ axis or, to think in another way, represents $\vec{v}$ in a basis that is rotated $\theta^{\circ}$ from the standard basis. If you compute the axes of this new rotated basis you'll see that the new $\vec{r}, \vec{u}, \vec{f}$ of this rotated matrix are the columns of $R\_z$ matrix.

> **Comments:**
> **username_0**: Great answer, and thanks for a thorough explanation. I believe this is exactly what I'm looking for, though I'll need to reread your answer several more times to get it through in my head haha. But please fix your original M matrix to include z. Thank you again, good sir!  
> **username_3**: Thanks @username_0 for noticing that error. Just fixed it now!  

---

### Answer by username_1 on 2017-06-13. Score: 3

Okay let us start by pointing out that a colmun major matrix is the same as a transposed row major matrix. So:

$$
{M\_{cm}}^{T} = M\_{rm} \tag{1}
$$

Then notice that matrixes have following properties. Matrix multiplication is associative (2a) and that the distribution of transpose reverses computation order (2b).

$$
A(BC) = (AB)C \tag{2a}
$$
$$
(AB)^T = B^TA^T \tag{2b}
$$

From these follow that the chain of multiplication events can be as long as one likes and all transpose does is inverse the computation. So given that we can conclude

$$
{T\_1}\ {T\_2}\ \ldots\ {T\_n}\ \vec{v} = \vec v\,^T\ {T\_n}^T\ \ldots\ {T\_2}^T\ {T\_1}^T, \tag{3}
$$

so calculating in column major order **is the same calculation** as calculating in row major orientation. The difference is that the order of computation is reversed. An interpretation of this is that the difference is the same as looking at the object from the outside or looking at the situation from the object out.

Formula 3 should provide you the insight. Just one more thing a column vector is the same as a transpose of a row vector.

**Note**: You are allowed to mix and match the computations as much as you like. All you have do is remember is that the other approach is just transposed.

> **Comments:**
> **username_0**: Thank you so much for sharing your knowledge. Please read my clarification edit. Thanks again.  

---

