Britannica Sources used in this answer

Why is matrix multiplication not always commutative?

Created from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles.

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 (ab=ba) always holds.12

The product of two matrices A and B 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 (BA) 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