Why do diagonal matrices commute under multiplication?
In general, matrix multiplication is not commutative, meaning that for two arbitrary matrices and , does not necessarily equal . However, diagonal matrices—square matrices where all elements are zero except when —are a notable exception to this rule.1
Diagonal matrices commute because their multiplication effectively reduces to the independent multiplication of their corresponding diagonal elements. If and are diagonal matrices, the element in the th row and th column of their product is the product of the th diagonal element of and the th diagonal element of only when ; otherwise, the product is zero. Because the multiplication of these individual diagonal elements (which are ordinary numbers) is commutative, the resulting matrices and are identical.1