I know that matrix multiplication in general is not commutative. So, in general:

A,B∈Rn×n:A⋅B≠B⋅A

But for some matrices, this equations holds, e.g. A = Identity or A = Null-matrix ∀B∈Rn×n.

I think I remember that a group of special matrices (was it O(n), the group of orthogonal matrices?) exist, for which matrix multiplication is commutative.

For which matrices A,B∈Rn×n is A⋅B=B⋅A?

**Answer**

Two matrices that are simultaneously diagonalizable are always commutative.

Proof: Let A, B be two such n×n matrices over a base field K, v1,…,vn a basis of Eigenvectors for A. Since A and B are simultaneously diagonalizable, such a basis exists and is also a basis of Eigenvectors for B. Denote the corresponding Eigenvalues of A by λ1,…λn and those of B by μ1,…,μn.

Then it is known that there is a matrix T whose columns are v1,…,vn such that T−1AT=:DA and T−1BT=:DB are diagonal matrices. Since DA and DB trivially commute (explicit calculation shows this), we have AB=TDAT−1TDBT−1=TDADBT−1=TDBDAT−1=TDBT−1TDAT−1=BA.

**Attribution***Source : Link , Question Author : Martin Thoma , Answer Author : Community*