Part I · Chapter 6

Commutation Relations

Read ~18 min Prerequisites Ch. 1, Ch. 4 Tools live commutator calculator, code cell Live

Ordinary numbers don't care which order you multiply them in: 3×5 and 5×3 are both 15. Matrices are not so polite. AB and BA can be completely different matrices — and the gap between them turns out to be one of the most physically important quantities in all of quantum mechanics.

Order matters

Take A = [[1,1],[0,1]] and B = [[1,0],[1,1]] — two matrices you can build right now in Ch. 1's Fig. 1.2. Multiply them one way: AB = [[2,1],[1,1]]. Multiply them the other way: BA = [[1,1],[1,2]]. Same two matrices, different answers depending on the order. This isn't a special case — it's the default. Two matrices that do happen to give the same answer either way are the exception, not the rule.

The commutator

The quantity that measures exactly how much order matters is the commutator:

[A,B] = AB − BA

If [A,B] = 0 (the zero matrix), A and B commute — order genuinely doesn't matter for these two. If [A,B] ≠ 0, they don't, and the commutator itself tells you precisely how they fail to.

Fig. 6.1 — edit A and B, or pick a presetcomputes AB, BA, [A,B]
A
+i
+i
+i
+i
B
+i
+i
+i
+i
Commute: —

AB

BA

[A,B]

The default preset is [X,Y] — the single most-quoted commutator in quantum computing. Try [X,X] (anything commutes with itself) and [I,X] (identity commutes with everything) to see the trivially-zero cases, then [H,Z] for a non-Pauli pair that still fails to commute.

The famous result: [X,Y] = 2iZ

Run the default preset above and you'll get exactly [[2i,0],[0,−2i]] — which is 2i times Z. This isn't a coincidence specific to this one pair: the three Pauli matrices satisfy [X,Y]=2iZ, [Y,Z]=2iX, [Z,X]=2iY, a cyclic pattern that is the algebraic signature of spin and angular momentum throughout physics. You don't need to memorize the pattern — the point worth keeping is that the commutator of two non-commuting Hermitian operators isn't garbage; it's a third operator, related to both, that turns up constantly once you start looking for it.

Why this matters: simultaneous measurability

Ch. 1 introduced eigenvectors as the special directions a matrix doesn't rotate. Here's the connection that makes commutators physically important: two operators share a complete set of common eigenvectors if and only if they commute. A shared eigenvector means both operators assign that state a definite, well-defined value at the same time.

So when [A,B] = 0, both observables can have simultaneously sharp, well-defined values. When [A,B] ≠ 0, there is no state where both have a perfectly definite value at once — pinning one down necessarily blurs the other. This is the actual mathematical content behind the Heisenberg uncertainty principle: position and momentum satisfy [x,p] = iℏ, which is never zero, which is precisely why no quantum state can have both an exactly known position and an exactly known momentum. The popular description ("you can't know both") is a consequence; the commutator being nonzero is the cause.

For qubits specifically: X and Z don't commute (try it in Fig. 6.1), which means there's no qubit state with a perfectly definite value for both "spin along x" and "spin along z" simultaneously. This is the same fact Ch. 3's Bloch sphere showed geometrically — a state can sit exactly on the z-axis or exactly on the x-axis, but never be a sharp eigenstate of both at once, because those axes correspond to non-commuting operators.

Fig. 6.2 — code, runs in your browser
np.allclose handles the floating-point comparison cleanly — exactly what Fig. 6.1's "Commute: YES/NO" tag does internally with a small tolerance.
Check your understanding

If [A,B] = 0, what does that tell you about AB versus BA?

They're equal — AB = BA. A zero commutator is exactly the definition of A and B commuting.

Check your understanding

What is [A,A] for any matrix A, and why?

Always zero — [A,A] = AA − AA = 0. Any matrix trivially commutes with itself.

Check your understanding

What is [X,Y] for the Pauli matrices, exactly?

2iZ — verified directly in Fig. 6.1 and Fig. 6.2. Part of the cyclic pattern [X,Y]=2iZ, [Y,Z]=2iX, [Z,X]=2iY.

Check your understanding

What does it mean, physically, for two observables to commute?

They share a common set of eigenvectors, so there exist states where both observables have a simultaneously well-defined, sharp value. If they don't commute, no state can give both a perfectly definite value at once.

Check your understanding

How does [x,p] = iℏ explain the Heisenberg uncertainty principle, in terms of this chapter's ideas?

Since the commutator is nonzero, position and momentum don't share common eigenvectors — there's no quantum state with both an exactly defined position and an exactly defined momentum simultaneously. The nonzero commutator is the underlying cause; "you can't know both precisely" is the consequence people usually hear first.

Review queue

Scroll back to a chapter's quiz cards to review them once they're due — a full cross-chapter queue view is a planned upgrade.