In linear algebra, two matrices A{\displaystyle A} and B{\displaystyle B} are said to commute if AB=BA{\displaystyle AB=BA} and equivalently, their commutator [A,B]=AB−BA{\displaystyle [A,B]=AB-BA} is zero. A set of matrices A1,…,Ak{\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.