# Is matrix multiplication commutative

A binary operation that gives the product of two matrices is matrix multiplication. For the process of matrix multiplication, the total number of columns in the 1st matrix should be = the total number of rows in the 2nd matrix. The product matrix consists of the number of rows of the 1st and the number of columns of the 2nd matrix. The product is denoted as AB.

Consider two matrices A and B. Commutative property of multiplication is defined as AB = BA.

Let’s test this with an example.

$$\begin{array}{l}\begin{bmatrix} 0 &1 \\ 0&0 \end{bmatrix}\begin{bmatrix} 0 &0 \\ 1&0 \end{bmatrix}=\begin{bmatrix} 1 &0 \\ 0&0 \end{bmatrix}\\\end{array}$$

But

$$\begin{array}{l}\begin{bmatrix} 0 &0 \\ 1&0 \end{bmatrix}\begin{bmatrix} 0 &1 \\ 0&0 \end{bmatrix}=\begin{bmatrix} 0 &0 \\ 0&1 \end{bmatrix}\\\end{array}$$

Hence AB ≠ BA.

Therefore, matrix multiplication is not commutative.

Matrix multiplication can be commutative in the following cases:

1] One of the given matrices is an identity matrix.

2] One of the given matrices is a zero matrix.

3] The matrices given are rotation matrices.

4] The matrices given are diagonal matrices.