In linear algebra, two matrices A {\displaystyle A} and B {\displaystyle B} are said to commute if A B = B A {\displaystyle AB=BA} , or equivalently if their commutator [ A , B ] = A B − B A {\displaystyle [A,B]=AB-BA} is zero. Matrices A {\displaystyle A} that commute with matrix B {\displaystyle B} are called the commutant of matrix B {\displaystyle B} (and vice versa).
A set of matrices A 1 , … , A k {\displaystyle A_{1},\ldots ,A_{k}} is said to commute if they commute pairwise, meaning that every pair of matrices in the set commutes.