3

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.

RobPratt
  • 45,619
Si Random
  • 911
  • 3
    matrix multiplication is associative – Asinomás Oct 04 '20 at 16:14
  • 1
    This is not very good question this time, take two matrices and check commutativity – Physor Oct 04 '20 at 16:14
  • 1
    @Physor sorry man. I just don't know how to explain it. – Si Random Oct 04 '20 at 16:16
  • associativity is a good question though – Physor Oct 04 '20 at 16:18
  • 3
    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 04 '20 at 16:19
  • 2
    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. – Asinomás Oct 04 '20 at 16:20
  • 4
    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. – JMoravitz Oct 04 '20 at 16:20

5 Answers5

4

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.

Alessio K
  • 10,599
2

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].

Mark Bennet
  • 100,194
1

$$ \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}. $$

David K
  • 98,388
1

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.

Will Orrick
  • 18,220
1

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.

cosmo5
  • 10,629