Mathwords logoMathwords

Commuting Matrices — Definition, Formula & Examples

Commuting matrices are two square matrices AA and BB that satisfy AB=BAAB = BA. Since matrix multiplication is generally not commutative, commuting matrices are a special case where the order of multiplication does not affect the result.

Two n×nn \times n matrices AA and BB are said to commute if their commutator [A,B]=ABBA[A, B] = AB - BA equals the zero matrix OO. Equivalently, AA and BB commute if and only if AB=BAAB = BA.

Key Formula

AB=BAABBA=OAB = BA \quad \Longleftrightarrow \quad AB - BA = O
Where:
  • A,BA, B = Square matrices of the same size
  • OO = The zero matrix of the same size

How It Works

To check whether two matrices commute, compute both products ABAB and BABA separately, then compare. If every corresponding entry is equal, the matrices commute. Notable cases where commutativity always holds: any matrix commutes with the identity matrix II, with the zero matrix OO, with scalar multiples of itself, and with its own inverse (if one exists). Diagonal matrices of the same size also commute with each other.

Worked Example

Problem: Determine whether the matrices A and B commute, where A = [[1, 2], [0, 3]] and B = [[5, 2], [0, 1]].
Compute AB: Multiply A by B using standard matrix multiplication.
AB=[1203][5201]=[5403]AB = \begin{bmatrix} 1 & 2 \\ 0 & 3 \end{bmatrix}\begin{bmatrix} 5 & 2 \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} 5 & 4 \\ 0 & 3 \end{bmatrix}
Compute BA: Multiply B by A in the reversed order.
BA=[5201][1203]=[51603]BA = \begin{bmatrix} 5 & 2 \\ 0 & 1 \end{bmatrix}\begin{bmatrix} 1 & 2 \\ 0 & 3 \end{bmatrix} = \begin{bmatrix} 5 & 16 \\ 0 & 3 \end{bmatrix}
Compare: The (1,2) entries differ: 4 versus 16. Since AB ≠ BA, the matrices do not commute.
ABBA=[01200]OAB - BA = \begin{bmatrix} 0 & -12 \\ 0 & 0 \end{bmatrix} \neq O
Answer: A and B do not commute because ABBAAB \neq BA.

Why It Matters

Commutativity matters when simplifying matrix expressions. For instance, the identity (A+B)2=A2+2AB+B2(A + B)^2 = A^2 + 2AB + B^2 holds only when AA and BB commute. In quantum mechanics and advanced algebra, whether operators (represented as matrices) commute determines whether physical quantities can be simultaneously measured.

Common Mistakes

Mistake: Assuming that if AB = BA for one pair, matrix multiplication is commutative in general.
Correction: Commutativity is a property of a specific pair of matrices, not of matrix multiplication overall. Most pairs of matrices do not commute.