Why does the order of matrix multiplication matter?
In linear algebra, the order of matrix multiplication matters because matrix multiplication is not commutative. Unlike the multiplication of ordinary numbers, where always holds true, the product of two matrices and generally results in different outcomes depending on whether you calculate or .1
The definition of matrix multiplication requires that the number of columns in the first matrix must equal the number of rows in the second. Consequently, if the dimensions of and are not compatible in both directions, one product may be mathematically defined while the other is not. Even when both and are defined—such as with square matrices of the same order—the resulting elements are determined by the sum of products of specific rows and columns, which change entirely when the order of the matrices is swapped.1
While matrix multiplication is associative and distributive, the failure of the commutative law is a fundamental characteristic of matrix algebra.1