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.
AB
BA
[A,B]
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.
- TextbookNielsen & Chuang, §2.1.9 (Exercises)Pauli commutation relations and their role in the stabilizer formalism used much later in the book.
- ArticleWikipedia — Canonical commutation relationThe position-momentum [x,p]=iℏ relation referenced above, and its history.
- ToolNumPy docs — allcloseReference for the floating-point comparison used in Fig. 6.2.