Why is matrix multiplication not always commutative?
In algebra, matrix multiplication is not commutative because the operation depends on the specific order of rows and columns, unlike the multiplication of ordinary numbers where the commutative law () always holds.12
The product of two matrices and is defined by taking the dot product of the rows of the first matrix with the columns of the second. Because this process relies on the specific dimensions and arrangement of elements within each matrix, reversing the order () typically results in a different outcome or may even be undefined if the dimensions do not align correctly. While matrix multiplication is associative and distributive, it does not satisfy the commutative property in general systems.12
An exception exists for diagonal matrices, where multiplication is commutative, but this is a specific case rather than a general rule for all matrices.1