TL;DR
For two matrices and , the product usually differs from . The commutator is the difference between the two orders. It is zero exactly when and commute, and it is nonzero when the order of operations changes the result.
Where you'll see it: in quantum mechanics, where is the reason position and momentum cannot both be known exactly, and in robotics and 3D graphics, where rotations applied in different orders give different orientations.
Intuition
Think about getting dressed. Putting on socks and then shoes gives a different result from putting on shoes and then socks. Both sequences start from the same bare feet and end with the same two items, but the outcomes differ. Operations that act on a state are often like this. The order is part of the answer.
Matrices are operations on vectors (see Linear Transformation). A matrix moves a vector, and moves it too. Applying first and then is the product , while applying first and then is . The commutator asks how far apart those two results are:
flowchart LR
S[Start vector] --> X1[Apply A first]
X1 --> Y1[Then apply B]
Y1 --> P[Result: BA times start]
S --> X2[Apply B first]
X2 --> Y2[Then apply A]
Y2 --> Q[Result: AB times start]
P --> D[Difference is commutator applied to start]
Q --> D
If the two paths end at the same place for every starting vector, the operations commute and the commutator is zero. If they end at different places, the commutator is the nonzero matrix that describes the gap.
Why does this idea exist? Many problems involve several operations whose order is fixed by the physics or by the geometry. A rotation, a stretch and a shift do not commute. Quantum mechanics goes further: the act of measuring one quantity can change another, and the commutator is the exact measure of how much the order matters. Without a name for this gap, every calculation with non-commuting operators would have to carry the order around by hand.
The math
For two matrices and , the commutator is the matrix
Here is the matrix product from Matrix Multiplication, is the size of the square matrices, and is itself an matrix. The matrices and commute when , that is when .
Basic properties
For all square matrices , , of the same size, and scalars :
- Antisymmetry. . Swapping the two matrices flips the sign, since .
- Linearity. and . Both follow by expanding the product term by term.
- Self-commutator. .
- Jacobi identity.
Expanding each term gives four products, so there are twelve in all. Writing them out, , , and . Adding the three lines, every product cancels against one with the opposite sign. This identity is what makes the commutator a Lie bracket, which is why the term appears in the aliases.
The trace of a commutator is zero
The trace of a square matrix is the sum of its diagonal entries, . For any two matrices, , because
Subtracting, . A useful consequence: no commutator of matrices can equal the identity matrix , because .
Commuting matrices share eigenvectors
This is the main reason commutation matters in linear algebra. Recall from Eigenvalues and Eigenvectors that an eigenvector of satisfies . Suppose . Then
So is also an eigenvector of with the same eigenvalue . If that eigenspace has dimension one, must be a multiple of , which means is an eigenvector of too. Commuting matrices that are each diagonalisable can therefore be diagonalised in a common basis.
The canonical commutator in quantum mechanics
In quantum mechanics, position and momentum are operators on functions. Acting on a function of , they are and , where is the reduced Planck constant. Compute both orders:
Subtracting gives
so . The commutator is a nonzero constant, and that is the origin of the uncertainty principle. The general bound for two observables is , where denotes standard deviation. With , this gives .
Worked examples
Let
- Compute . Row 1 of is . Times column 1 of , , gives . Times column 2, , gives . Row 2 of is , which gives and . So .
- Compute . Row 1 of is , which gives . Row 2 of is , which gives . So .
- Subtract entry by entry: .
- The commutator is nonzero, so and do not commute. Its trace is , as the trace property predicts.
Interpretation: applying and then leaves the vector in a different place from applying and then . The gap is the matrix above.
Rotations are used to orient a robot arm or a camera. Let be a rotation by about the -axis and a rotation by about the -axis. With and , the standard rotation matrices are
- Compute . Row 1 of is , which picks row 1 of : . Row 2 of is , which gives minus row 3 of : . Row 3 of is , which picks row 2 of : . So .
- Compute . Row 1 of is , which picks row 3 of : . Row 2 of is , which picks row 2 of : . Row 3 of is , which gives minus row 1 of : . So .
- Subtract: .
- The two orders give different orientations. Take . Applying first and then is . Applying first and then is . The two results differ, and their difference is the first column of the commutator.
Interpretation: a robot that rotates about then ends up pointing somewhere other than one that rotates about then . Software that treats rotations as commuting will be wrong by an amount that depends on the commutator.
Tradeoffs and failure modes
| Situation | What goes wrong | Better choice |
|---|---|---|
| Assuming for rotations, robot joints or 3D orientation | Results depend on the order, so the computed pose is wrong | Keep the order explicit, or use quaternions with their own multiplication rules |
| Simultaneous diagonalisation of and | Requires ; otherwise a common eigenbasis may not exist | Check the commutator first; if it is nonzero, diagonalise one operator and treat the other in that basis |
| Splitting a time evolution into | The splitting error is driven by commutators, so it is exact only when | Use a higher-order splitting, which cancels leading commutator terms |
| Reading quantum measurements as order-independent | Measuring then differs from then | Use the commutator to decide which quantities can be known together |
The commutator is not a flaw to be avoided. In many systems it is the physics. The practical rule is to compute it when order might matter and to use commuting shortcuts only when is zero.
History
Arthur Cayley introduced matrix algebra as a systematic subject in the late 1850s, and he noted that matrix multiplication is generally not commutative. Hamilton's quaternions, from 1843, had a multiplication that was non-commutative, so the phenomenon was known early. Sophus Lie, in the late nineteenth century, studied continuous groups of transformations through their infinitesimal generators, and the commutator of those generators became the bracket of what are now called Lie algebras.
The idea became central in physics in 1925. Werner Heisenberg developed matrix mechanics, in which observables are matrices, and Max Born and Pascual Jordan showed that the canonical relation between position and momentum corresponds to a commutator with the value . Paul Dirac later made this algebraic structure the foundation of quantum theory. The commutator caught on because it turned a physical statement, that some quantities cannot be measured together, into a short algebraic condition.
Check yourself
QuestionWhat does it mean for two matrices and to commute, and what is the value of in that case?Show answer
They commute when . Then , the zero matrix. Commuting means the order in which the operations are applied does not change the result.
QuestionLet and . Compute .Show answer
and . Subtracting entry by entry gives . Its trace is , as it must be.
QuestionShow that for any two square matrices of the same size. Why does this mean no commutator can equal the identity matrix?Show answer
The trace is linear, so . The trace satisfies , as the double sum over entries shows, so the difference is zero. The identity matrix of size has trace , which is nonzero for , so it cannot be a commutator.
QuestionA physicist measures the position of a particle and then its momentum, and separately measures momentum and then position. Why can the two results not both be made arbitrarily precise, and what bound follows?Show answer
Position and momentum operators satisfy , which is nonzero. Because the commutator is nonzero, the operators do not share a common eigenbasis, so no state has both sharp position and sharp momentum. The general uncertainty relation follows from the size of this commutator. The two orders of measurement give different statistics, which is exactly what the commutator encodes.
Sources
- Commutator (Wikipedia): https://en.wikipedia.org/wiki/Commutator
- Canonical commutation relation (Wikipedia): https://en.wikipedia.org/wiki/Canonical_commutation_relation
- Gilbert Strang, Introduction to Linear Algebra: https://math.mit.edu/~gs/linearalgebra/