Matrix Commutator
Edit two real 2x2 matrices to compare AB and BA, visualize their action on one vector and distinguish a zero commutator from its always-zero trace.
Free theory articleEdit two real 2x2 matrices to compare AB and BA, visualize their action on one vector and distinguish a zero commutator from its always-zero trace.
Concept & interpretation
Matrix multiplication is generally not commutative. Applying transformation B then A can yield a different result than applying A then B. The matrix commutator C = AB − BA measures this difference. If C is the zero matrix, the matrices commute. This experiment lets you compare the action of AB and BA on a vector, and observe the resulting difference vector.
Experimenting with the commutator
Open Matrix Commutator. You can select presets or edit individual matrix and vector entries to observe their effects.
- Select the "Diagonal and swap" preset. The commutator matrix C becomes [[0, -1], [1, 0]]. With v = (1, 1), you can see Cv = (-1, 1).
- Click "Swap A and B". Observe that the entries of C are all negated, becoming [[0, 1], [-1, 0]], and the vector Cv reverses direction.
- Change the preset to "Identity". Because the identity matrix commutes with any matrix, C becomes the zero matrix, and trace(C) is 0. Both ABv and BAv coincide on the canvas.
- Edit the vector to (0, 0). All transformation vectors collapse to the origin, regardless of whether the matrices commute.