# What is the best way to explain why Matrix Multiplication is not commutative?

I have a question asking me why matrix multiplication isn't commutative. I'm not exactly sure what's the best way to explain this without simply saying "it's obvious".

$$AB \not= BA$$ because the steps to multiply the values are different going one way and the other way ways. Only in rare circumstances is it commutative.

• matrix multiplication is associative Oct 4, 2020 at 16:14
• This is not very good question this time, take two matrices and check commutativity Oct 4, 2020 at 16:14
• Because matrix multiplication is such that it corresponds to composition of the associated linear maps, and composition of (linear) maps is not commutative.
– Nico
Oct 4, 2020 at 16:19
• I mean if you think of linear transformations geometrically you can come up with examples that make sense I guess. For example, projecting and rotating is not the same as rotating and then projecting, because the image will not coincide. Oct 4, 2020 at 16:20
• Many things are not commutative. Putting on your socks before putting on your shoes does not result in the same outcome as putting on your shoes and then putting on your socks. Unless you can prove a particular scenario is commutative, you should always be ready for the possibility that it is not. Non-commutative scenarios are really quite common. And then, if you want to prove a scenario is non-commutative all it requires is showing one example of some $A$ and $B$ where $AB\neq BA$ of which there are countless examples for matrices. Oct 4, 2020 at 16:20

Although matrix multiplication is not commutative, it is associative in the sense that $$A(BC)=(AB)C$$

for the correct dimensions.

To show matrix multiplication is not commutative we can consider an example. Take $$A=\begin{bmatrix} 1 & 1 \\ 0 & 0\end{bmatrix}$$

$$B=\begin{bmatrix}1 & 0 \\ 0 & 0\end{bmatrix}$$

Then $$AB=\begin{bmatrix} 1 & 1 \\ 0 & 0\end{bmatrix}\begin{bmatrix}1 & 0 \\ 0 & 0\end{bmatrix}=\begin{bmatrix} 1 & 0 \\ 0 & 0\end{bmatrix}$$ $$\text{and}$$ $$BA=\begin{bmatrix}1 & 0 \\ 0 & 0\end{bmatrix}\begin{bmatrix} 1 & 1 \\ 0 & 0\end{bmatrix}=\begin{bmatrix} 1 & 1 \\ 0 & 0\end{bmatrix}$$ Thus $$AB\neq BA$$.

See this for when is matrix multiplication commutative.

• you already know wut im gonna say. thank you so much ares <3333 Oct 4, 2020 at 16:41

Geometrically, you can realise both rotations and reflections by matrix multiplication. But, in general, the result of a reflection followed by a rotation is different from the rotation (same angle, same axis) followed by the reflection (same mirror). [The dihedral groups, for example, are non-abelian because they combine non-commuting rotations and reflections].

$$\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix} = \begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix}.$$

$$\begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix} \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} = \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix}.$$

$$\begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix} \neq \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix}.$$

I think it always worth pointing out when introducing matrix multiplication that $$AB$$ and $$BA$$ are not necessarily even both defined. For example, if $$A$$ is a $$5\times2$$ matrix and $$B$$ is a $$2\times 4$$ matrix, then $$AB$$ is defined but $$BA$$ isn't.

Even when both products are defined, it can still be obvious that they are unequal. If $$A$$ is $$1\times4$$ and $$B$$ is $$4\times1$$ then $$AB$$ is $$1\times1$$ while $$BA$$ is $$4\times4$$.

This last example suggests an easy way to see that even for square matrices the two products are not necessarily the same. Let $$A=\begin{bmatrix}1 & 2 & 3 & 6\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 \end{bmatrix}\quad\text{and}\quad B=\begin{bmatrix}4 & 0 & 0 & 0\\ 5 & 0 & 0 & 0\\ 1 & 0 & 0 & 0\\ 2 & 0 & 0 & 0 \end{bmatrix}.$$ In this example, $$AB$$ has only a single nonzero element, whereas all $$16$$ elements of $$BA$$ are nonzero. The matrix $$A$$ can be thought of as a $$1\times4$$ matrix that has been padded with zero rows to make it square. Likewise, the matrix $$B$$ can be thought of as a $$4\times1$$ matrix that has been padded with zero columns to make it square. From this point of view, the structure of the resulting products is not surprising.

Assuming one has to explain matrix multiplication to someone who has not seen much of linear algebra, a matrix is introduced as a collection of vectors. For example, for two $$3\times3$$ matrices $$A$$ and $$B$$, $$A=\begin{bmatrix} \quad r_{A1} \quad \\ \quad r_{A2} \quad \\ \quad r_{A3} \quad \end{bmatrix} = \Biggl[ \begin{matrix} c_{A1} \quad & \quad c_{A2} \quad & \quad c_{A3} \end{matrix} \Biggr]$$

where $$r_{Ai}$$, $$c_{Aj}$$ are called row and column vectors respectively.

Similarly, $$B=\begin{bmatrix} \quad r_{B1} \quad \\ \quad r_{B2} \quad \\ \quad r_{B3} \quad \end{bmatrix} = \Biggl[ \begin{matrix} c_{B1} \quad & \quad c_{B2} \quad & \quad c_{B3} \end{matrix} \Biggr]$$

By rules of matrix multiplication, $$AB=\begin{bmatrix} r_{A1}\cdot c_{B1} & r_{A1}\cdot c_{B2} & r_{A1}\cdot c_{B3} \\ r_{A2}\cdot c_{B1} & r_{A2}\cdot c_{B2} & r_{A2}\cdot c_{B3} \\ r_{A3}\cdot c_{B1} & r_{A3}\cdot c_{B2} & r_{A3}\cdot c_{B3} \end{bmatrix}$$ where $$r_{A1}\cdot c_{B1}$$ stands for dot product of vectors $$r_{A1}$$ and $$c_{B1}$$.

Similarly, $$BA=\begin{bmatrix} r_{B1}\cdot c_{A1} & r_{B1}\cdot c_{A2} & r_{B1}\cdot c_{A3} \\ r_{B2}\cdot c_{A1} & r_{B2}\cdot c_{A2} & r_{B2}\cdot c_{A3} \\ r_{B3}\cdot c_{A1} & r_{B3}\cdot c_{A2} & r_{B3}\cdot c_{A3} \end{bmatrix}$$

Clearly, the two results are different.