# Commuting matrices

In linear algebra, two matrices ${\displaystyle A}$ and ${\displaystyle B}$ are said to commute if ${\displaystyle AB=BA}$ and equivalently, their commutator ${\displaystyle [A,B]=AB-BA}$ is zero. A set of matrices ${\displaystyle A_{1},\ldots ,A_{k}}$ is said to commute if they commute pairwise, meaning that every pair of matrices in the set commute with each other.

## Characterization in terms of eigenvectors

Commuting matrices over an algebraically closed field are simultaneously triangularizable, in other words they will be both upper triangular on a same basis. This follows from the fact that commuting matrices preserve each other's eigenspaces. If both matrices are diagonalizable, then they can be simultaneously diagonalized. Moreover, if one of the matrices has the property that its minimal polynomial coincides with its characteristic polynomial (i.e., it has the maximal degree), which happens in particular whenever the characteristic polynomial has only simple roots, then the other matrix can be written as a polynomial of the first.

As a direct consequence of simultaneous triangulizability, the eigenvalues of two commuting matrices complex A, B with their algebraic multiplicities (the multisets of roots of their characteristic polynomials) can be matched up as ${\displaystyle \alpha _{i}\leftrightarrow \beta _{i}}$ in such a way that the multiset of eigenvalues of any polynomial ${\displaystyle P(A,B)}$ in the two matrices is the multiset of the values ${\displaystyle P(\alpha _{i},\beta _{i})}$.

Two Hermitian matrices commute if their eigenspaces coincide. In particular, two Hermitian matrices without multiple eigenvalues commute if they share the same set of eigenvectors. This follows by considering the eigenvalue decompositions of both matrices. Let ${\displaystyle A}$ and ${\displaystyle B}$ be two Hermitian matrices. ${\displaystyle A}$ and ${\displaystyle B}$ have common eigenspaces when they can be written as

${\displaystyle A=U\Lambda _{1}U^{\dagger }}$
${\displaystyle B=U\Lambda _{2}U^{\dagger }}$

It then follows that

${\displaystyle AB=U\Lambda _{1}U^{\dagger }U\Lambda _{2}U^{\dagger }=U\Lambda _{1}\Lambda _{2}U^{\dagger }=U\Lambda _{2}\Lambda _{1}U^{\dagger }=U\Lambda _{2}U^{\dagger }U\Lambda _{1}U^{\dagger }=BA.}$

## Further Properties

The property of two matrices commuting is not transitive: A matrix ${\displaystyle A}$ may commute with both ${\displaystyle B}$ and ${\displaystyle C}$, and still ${\displaystyle B}$ and ${\displaystyle C}$ do not commute with each other. As an example, the unit matrix commutes with all matrices, which between them do not all commute. If the set of matrices considered is restricted to Hermitian matrices without multiple eigenvalues, then commutativity is transitive, as a consequence of the characterization in terms of eigenvectors.

Lie's theorem, which shows that any representation of a solvable Lie algebra is simultaneously upper triangularizable may be viewed as a generalization.

## Examples

• The unit matrix commutes with all matrices.
• Diagonal matrices commute.
• Jordan blocks commute with upper triangular matrices that have the same value along bands.
• If the product of two symmetric matrices is symmetric, then they must commute.

## History

The notion of commuting matrices was introduced by Cayley in his memoir on the theory of matrices, which also provided the first axiomatization of matrices. The first significant results proved on them was the above result of Frobenius in 1878.[1]

## References

1. {{#invoke:citation/CS1|citation |CitationClass=citation }}