I want to have an intuition for why AB in matrix multiplication is not same as BA. It's clear from definition that they are not and there are arguments here (Fast(est) and intuitive ways to look at matrix multiplication?) that explain that this is in order to maintain certain compositional properties. Example:

(column vector)

$A = \left( \begin{array}{c} 1\\ 2\\ 3 \end{array} \right)$

(row vector)

$B = \left(1, 5, 0\right)$

If we view a matrix as a linear combination of columns, then I read this from right to left as saying "take 1 times" of column 1 of left matrix, then "take 5 times" of column 2 of left matrix, then "take 0 times" of column 3 of left matrix. Intuitively this means the $B$ vector is the set of weights for the linear combination and the columns of $A$ are the ones being combined. This yields:

$AB = \left( \begin{array}{c} 1 & 5 & 0\\ 2 & 10 & 0\\ 3 & 15 & 0 \end{array} \right)$

1st question: is this a valid way to think of the operation? It gives the right answer here, but more generally is it correct?

2nd question: how can we apply this (or a better) intuition to the case of mutiplying $BA$? We have:

$BA = \left((1\times1) + (5\times2) + (3\times0)\right) = \left(11\right)$

not sure how to think of that intuitively.

one intuition that has been proposed is matrix multiplication as linear composition of functions. I'm open to that but usually I don't think of matrices like $A$ and $B$ as individually representing functions.

  • $\begingroup$ I like to simply not have intuition on this, and take for granted that in general, composition of functions will not be commutative ; since matrices are essentially linear functions, we don't expect anything better from them either. That's just a comment though, I don't believe it answers your question. $\endgroup$ Feb 17, 2014 at 2:44
  • 1
    $\begingroup$ @user9576: note that your way to calculate BA is wrong, it should be $1\times1+5\times2+4\times0=11$. $\endgroup$ Feb 17, 2014 at 2:46
  • 4
    $\begingroup$ You should think of matrices as representing functions; a lot of properties become clearer that way. For example, function composition is associative, so matrix multiplication is associative; function composition is not commutative, so we shouldn't expect matrix multiplication to be commutative, either. $\endgroup$
    – Ted
    Feb 17, 2014 at 2:59
  • $\begingroup$ @Ted: Can you point to a reference that elaborates on the connection, and makes it obvious that matrices are linear functions? $\endgroup$
    – user9576
    Feb 17, 2014 at 3:06
  • 1
    $\begingroup$ Any linear algebra textbook will do this. The entire reason for defining matrix multiplication in the way we do, is to make matrix multiplication correspond to composition of linear functions. $\endgroup$
    – Ted
    Feb 17, 2014 at 3:39

2 Answers 2


Regarding your first question, if you write $$ A=\begin{bmatrix}\mathbf r_1\\\mathbf r_2\\\vdots\\\mathbf r_m\end{bmatrix}, \ \ B=[\mathbf c_1\ \mathbf c_2\ \cdots\ \mathbf c_n], $$ then $$ AB=\begin{bmatrix} \mathbf r_1\cdot\mathbf c_1&\mathbf r_1\cdot\mathbf c_2&\cdots&\mathbf r_1\cdot\mathbf c_n\\\mathbf r_2\cdot\mathbf c_1&\mathbf r_2\cdot\mathbf c_2&\cdots&\mathbf r_2\cdot\mathbf c_n\\ \vdots&&\cdots&\vdots\\ \mathbf r_m\cdot\mathbf c_1&\mathbf r_m\cdot\mathbf c_2&\cdots&\mathbf r_m\cdot\mathbf c_n\\ \end{bmatrix} $$ so the idea works in general. You can also write this as $$ AB=\begin{bmatrix}\mathbf r_1B\\\mathbf r_2B\\\vdots\\\mathbf r_mB\end{bmatrix}=[\mathbf Ac_1\ \mathbf Ac_2\ \cdots\ \mathbf Ac_n] $$

In the second case, for BA, what happens is that you are reduced to the "minimal" case, which is when there is a single dot product to be calculated.

  • $\begingroup$ thanks, but how does my formulation of linear combinations work when you have $row \times column$ instead of $column \times row$? $\endgroup$
    – user9576
    Feb 17, 2014 at 3:00
  • 1
    $\begingroup$ I don't think you can say a lot more. See the edit. In the end, you cannot avoid calculating dot products "row$\times$column" to calculate a product of matrix. You first example is the easiest because your dot products are just products of numbers; but that only happens that particular case. $\endgroup$ Feb 17, 2014 at 3:15

I know this was awhile ago, but I think I have a nice answer. Remember that matrices are linear transformations, so we can rephrase the question: "Is $AB$ the same as $BA$?" as "Does the order of two linear transformations matter?"

The answer is clearly yes. To see why, consider two transformations of the $xy$-plane. Transformation $A$ only scales the $x$ coordinates and transformation $B$ rotates the plane by 45 degrees clockwise. Now, imagine applying both of these transformations to the standard bases.

If we scale the $x$ coordinate first, then only the length of $\hat{i}$ changes. If we scale the $x$ coordinates after rotation though, then both rotated versions of $\hat{i}$ and $\hat{j}$ will be scaled.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .