
Commutators, [x̂, p̂] = iħ, and compatibility
Order matters by exactly iħ for position and momentum.
Operators are instructions, and the same two instructions in the other order usually give something else. This lesson makes that difference routine to compute: act on a test function, reduce every new commutator to [x̂, p̂] = iħ with a few identities, and use a zero commutator to find the eigenfunctions two operators share.
Build the model
Act in both orders and subtract: the remainder decides which eigenfunctions can be shared.
1The big idea
Differentiation acts on everything to its right, so two operators applied in opposite orders generally disagree, and the commutator [Â, B̂] = ÂB̂ − B̂Â is the operator that records by how much. The safe way to find it is to let both orderings act on an arbitrary test function f. For x̂ and p̂ = −iħ d/dx the product rule leaves one term behind, [x̂, p̂]f = iħf, a constant times f whatever f is. That constant is where ħ enters the operator algebra: it vanishes as ħ → 0, where x and p commute like classical numbers, and it is iħ times the classical Poisson bracket of x with p, which is 1. After that, algebra replaces calculus. The identity [Â, B̂Ĉ] = [Â, B̂]Ĉ + B̂[Â, Ĉ] turns [x̂, p̂ⁿ] into iħnp̂ⁿ⁻¹ and [x̂, Ĥ] into iħp̂/m, Hamilton's dx/dt = p/m in operator form. The commutator also answers a structural question: Hermitian operators that commute admit a complete set of common eigenfunctions, found inside a degenerate level by diagonalising one of them there, while a commutator equal to a nonzero constant, as for x̂ and p̂, rules out even one. The algebra has edges. Every product must stay in the operators' domain, which x̂ breaks on a ring, where xf is not periodic, and no finite matrices obey [x̂, p̂] = iħ at all, as UQMI-04.05 shows.
2In one sentence
The commutator [Â, B̂] = ÂB̂ − B̂Â is the operator that measures how much the order of two operators matters, found by applying both orders to an arbitrary test function f and subtracting.
Example. On f = e(ikx) with k = 5.0 nm⁻¹, at x = 0.40 nm, x̂p̂f = ħkx f = (2.11 × 10⁻³⁴ J s) f but p̂x̂f = (2.11 × 10⁻³⁴ J s − iħ) f. The difference is iħf, with ħ = 1.05 × 10⁻³⁴ J s, for every k and every x.
3A commutator is an operator, so give it a function to act on
Operators compose right to left: ÂB̂f means B̂ acts on f first and  acts on the result. Reversing the order usually changes the answer, and [Â, B̂] = ÂB̂ − B̂ is the operator that records the change. Because it is an operator, the safe way to find it is to apply both orderings to an arbitrary differentiable test function f, simplify, and read off what multiplies f only at the end. The test function makes every derivative act on everything to its right. Try [d/dx, g(x)]: (gf)′ − gf′ = g′f, so [d/dx, g(x)] = g′(x), a multiplication operator, where writing d/dx g − g d/dx = 0 treats both as numbers. Some pairs do commute: x̂ with any V(x̂), since both only multiply, and p̂ with p̂². Two checks cost nothing. The commutator carries the units of  times those of B̂. And it is linear, so f need not be normalised: doubling f doubles both orderings, and an answer that depends on the size of f is wrong.
4The product rule leaves iħ behind
Apply both orderings of x̂ and p̂ = −iħ d/dx to f. With p̂ first, x̂(p̂f) = −iħxf′. With x̂ first, p̂(x̂f) = −iħ(xf)′ = −iħf − iħxf′, the extra term appearing because d/dx lands on x. The xf′ terms cancel and [x̂, p̂]f = iħf. Nothing about f survived except f itself, so [x̂, p̂] = iħ times the identity: a constant in J s, the same on every function and at every point. The cancelled term is the classical product xp, and the survivor is pure ordering. That is why classical mechanics never notices it. A 1.0 g bead moving at 1.0 m s⁻¹, 1.0 cm from the origin, has xp = 1.0 × 10⁻⁵ J s, and ħ/xp ≈ 10⁻²⁹; as ħ → 0 the two orderings agree exactly and x and p commute like numbers. For an electron a fraction of a nanometre from the origin, ħ is comparable with xp itself.
5Three identities do the differentiating for you
Commutators are linear in each slot and antisymmetric, [B̂, Â] = −[Â, B̂], so [Â, Â] = 0. The workhorse is the product rule [Â, B̂Ĉ] = [Â, B̂]Ĉ + B̂[Â, Ĉ], proved by adding and subtracting B̂ÂĈ; B̂ stays on the left because operators keep their order. Applied once, [x̂, p̂²] = iħp̂ + p̂(iħ) = 2iħp̂, which a test function confirms, −ħ²[xf″ − (xf)″] = 2ħ²f′ = 2iħ(p̂f). By induction [x̂, p̂ⁿ] = iħnp̂ⁿ⁻¹, and the mirror result is [V(x̂), p̂] = iħV′(x̂): inside a commutator x̂ differentiates functions of p̂, and p̂ differentiates functions of x̂. That is the classical correspondence: the Poisson brackets of x with pⁿ and of V(x) with p are npⁿ⁻¹ and V′, and each commutator is iħ times its bracket. One more check is free. For Hermitian  and B̂, i[Â, B̂] is Hermitian, because moving a product across an integral reverses its order; so a commutator of two observables must be i times an observable, and a real result such as ħ for [x̂, p̂] is wrong on sight.
6Commutators with Ĥ carry Hamilton's equations
With Ĥ = p̂²/2m + V(x̂), two lines finish the job. x̂ commutes with V, so [x̂, Ĥ] = [x̂, p̂²]/2m = iħp̂/m; p̂ commutes with p̂², so [p̂, Ĥ] = [p̂, V(x̂)] = −iħV′(x̂). Units agree: m × J on the left, J s × kg m s⁻¹ ÷ kg = J m on the right. The classical dx/dt = p/m and dp/dt = −V′ sit inside them, and as m → ∞ at fixed p, [x̂, Ĥ] → 0, as a very heavy particle barely moves. They pay out at once. In a normalisable eigenfunction ψ of Ĥ, ∫ψ*[Â, Ĥ]ψ dx = E⟨A⟩ − E⟨A⟩ = 0 for any  that keeps Âψ inside the domain where Ĥ is Hermitian, because Ĥ can then move across onto ψ*. With  = x̂ this gives ⟨p⟩ = 0 in every bound stationary state, and for a smooth V,  = p̂ gives ⟨V′⟩ = 0: the mean force vanishes, as it does over a classical bound orbit. Between two eigenfunctions the same sandwich gives (Eₙ − Eₖ)∫ψₖ*xψₙ dx = (iħ/m)∫ψₖ*(p̂ψₙ) dx, a momentum integral for the price of a position integral, which the Hard example uses.
7Commuting operators can share a basis of eigenfunctions
Let [Â, B̂] = 0 and Âψ = aψ. Then Â(B̂ψ) = B̂(Âψ) = a(B̂ψ), so B̂ψ is either zero or another eigenfunction of  with the same eigenvalue. If a is non-degenerate, B̂ψ must be a multiple of ψ, B̂ψ = bψ, and ψ is an eigenfunction of both. If a is g-fold degenerate, B̂ only maps that level into itself. Within it, on orthonormal ψᵢ spanning the level, B̂ becomes a g × g Hermitian matrix of integrals ∫ψᵢ*(B̂ψⱼ) dx, and its eigenvectors pick out the combinations that are common eigenfunctions. Doing this level by level gives a complete common eigenbasis. The converse takes one line: if every ψₙ of a complete set is an eigenfunction of both, [Â, B̂]ψₙ = (aₙbₙ − bₙaₙ)ψₙ = 0, and completeness extends that to every f. In a box from x = −a/2 to x = a/2, of width a = 0.50 nm, parity Π̂f(x) = f(−x) commutes with Ĥ and every level is non-degenerate, so each ψₙ carries two labels: (1.50 eV, +1), (6.02 eV, −1), (13.5 eV, +1). UQMI-09.07 puts that to work, and UQMI-04.06 says what such a compatible pair means for measurement.
8A constant commutator forbids even one shared eigenfunction
Suppose some ψ ≠ 0 had x̂ψ = aψ and p̂ψ = bψ. Then [x̂, p̂]ψ = x̂(bψ) − p̂(aψ) = (ab − ba)ψ = 0, but [x̂, p̂]ψ = iħψ, which is not zero. So x̂ and p̂ share no eigenfunction at all, not merely no complete set, and no relaxing of normalisation rescues one: the spike of sharp position is never the plane wave of sharp momentum. The argument is general. A common eigenfunction of  and B̂ must be annihilated by [Â, B̂], and a nonzero multiple of the identity annihilates nothing. A commutator that is an operator rather than a constant can spare a few functions. On a ring of circumference L, parity and p̂ anticommute, Π̂p̂ = −p̂Π̂, so [Π̂, p̂] = 2Π̂p̂ ≠ 0, yet it annihilates the constant 1/√L, which has p = 0 and parity +1. One shared function is not a shared basis: every other level of the ring makes them choose. The commutator says whether two spreads can vanish together; how large they must be when they cannot is the business of UQMI-04.07.
Key equations
What each relation says, and the units it is written in.
Commutator, defined on a test function
[Â, B̂]f = Â(B̂f) − B̂(Âf), for every allowed f
Keep f to the end so each derivative acts on everything to its right; the operator is whatever multiplies f once it factors out.
f is any differentiable function in the domain, normalised or not. [Â, B̂] carries the units of  times those of B̂.
The canonical commutator
[x̂, p̂] = iħ, with p̂ = −iħ d/dx
The extra term the product rule leaves when p̂ differentiates xf. It is the same on every f and at every x, and it seeds every other x–p commutator.
x̂ in m and p̂ in kg m s⁻¹, so iħ is in J s, with ħ = 1.055 × 10⁻³⁴ J s. The right side is iħ times the identity.
Product rule for commutators
[Â, B̂Ĉ] = [Â, B̂]Ĉ + B̂[Â, Ĉ]
Proved by adding and subtracting B̂ÂĈ. It reduces a commutator with any product to commutators with the factors, with no test function at all.
Order is kept: B̂ stays to the left of [Â, Ĉ]. With [B̂, Â] = −[Â, B̂] it also handles a product in the first slot.
Commutator with a power of momentum
[x̂, p̂ⁿ] = iħ n p̂ⁿ⁻¹, for n = 1, 2, 3, …
Inside a commutator x̂ differentiates with respect to p. For n = 2 it gives [x̂, p̂²/2m] = iħp̂/m, the operator form of dx/dt = p/m.
Both sides in J s × (kg m s⁻¹)ⁿ⁻¹. Induction on n with the product rule, starting from [x̂, p̂] = iħ.
Commutator with a function of position
[p̂, V(x̂)] = −iħ V′(x̂)
Inside a commutator p̂ differentiates with respect to x. −V′ is the classical force, so this is dp/dt = −dV/dx in operator form.
V in J and V′ = dV/dx in N, so both sides carry J s × N. Since p̂ commutes with p̂², this is also [p̂, Ĥ].
Commuting operators share an eigenbasis
[Â, B̂] = 0 ⇔ a complete set ψₙ with Âψₙ = aₙψₙ and B̂ψₙ = bₙψₙ
Where a level of  is degenerate, not every eigenfunction of  qualifies: diagonalise B̂ inside that level to find the ones that do.
 and B̂ Hermitian with discrete spectra; aₙ and bₙ are real, in the units of  and B̂, and label each ψₙ as a pair.
Interactive lab
Change one variable. Predict first, then read the result.
Controls
Try this. Set θ = 45° and turn φ to 90°: |ψ|² lies flat on 1/L and σₚ falls to zero, the momentum eigenfunction e(ikx). Take θ to 0° or 90° instead and the parity spread vanishes, a pure cosine or sine. No setting zeroes both: each commutes with Ĥ, but p̂ and parity do not commute.
Live results
- ENERGY E, EVERY θ AND φ
- 1.50 eV
- MEAN MOMENTUM ⟨p⟩
- 4.97 10⁻²⁵ kg m s⁻¹
- MOMENTUM SPREAD σₚ
- 4.38 10⁻²⁵ kg m s⁻¹
- PARITY SPREAD σΠ
- 0.87
Catch the common trap
The mistake this lesson is built to prevent.
Commuting does not mean that every eigenfunction of one operator is an eigenfunction of the other. The theorem promises that a common eigenbasis exists, not that the basis you happen to hold is one. On a ring of circumference L, Ĥ = p̂²/2m commutes with both p̂ and parity, and each level above the lowest is two-fold degenerate. cos(2πx/L) is an honest eigenfunction of Ĥ, yet p̂ turns it into a sine, so it has no definite momentum; e(2πix/L) has p = h/L, but parity turns it into e(−2πix/L), so it has no definite parity. Inside a degenerate level the second operator chooses the basis, and two different partners can choose incompatibly, here because p̂ and parity do not commute with each other. Only a non-degenerate level makes the sharing automatic.
Test it: what changes?
- σₚ falls to zero: ψ becomes e(ikx)
- |ψ|² flattens to 1/L
- Parity spread stays 1
- Energy E unchanged
- Parity spread vanishes: pure cosine or sine
- σₚ equals its largest value, ħk
- Energy E unchanged
Practice & worked examples
Three tiers. Try each before opening the solution.
EasyExample 1
Take the test function f(x) = e(−x²/(2b²)) with b = 0.10 nm. Evaluate x̂²p̂f and p̂x̂²f at x = b, find their difference, and confirm it against the operator identity for [x̂², p̂].
View solution →
- Differentiate first: f′ = −(x/b²)f, so p̂f = −iħf′ = iħ(x/b²)f and x̂²p̂f = iħ(x³/b²)f. At x = b this is iħb f(b).
- Multiply first: p̂(x²f) = −iħ(2xf + x²f′) = −2iħxf + iħ(x³/b²)f. At x = b this is −2iħb f(b) + iħb f(b) = −iħb f(b).
- Subtract: [x̂², p̂]f at x = b is iħb f(b) − (−iħb f(b)) = 2iħb f(b). With f(b) = e(−1/2) = 0.607 and ħb = 1.055 × 10⁻⁴⁴ J s m, the two orderings are +6.40i × 10⁻⁴⁵ and −6.40i × 10⁻⁴⁵ J s m, and their difference is 1.28i × 10⁻⁴⁴ J s m.
- Identity: [x̂², p̂] = x̂[x̂, p̂] + [x̂, p̂]x̂ = 2iħx̂, which on f at x = b gives 2iħb f(b), the same number, with no derivative taken.
- Checks: both orderings carry m² × kg m s⁻¹ = J s m. Limiting cases: at x = 0 the identity gives zero, and both orderings do vanish there; as ħ → 0 the difference vanishes and x² and p commute like numbers. Correspondence: 2iħx̂ is iħ times the classical Poisson bracket of x² with p, which is 2x. Scaling f changes both orderings alike, so the result does not depend on normalising f.
Answer. At x = b, x̂²p̂f = +6.40i × 10⁻⁴⁵ J s m and p̂x̂²f = −6.40i × 10⁻⁴⁵ J s m; their difference, 1.28i × 10⁻⁴⁴ J s m, is 2iħx f there, as [x̂², p̂] = 2iħx̂ requires.
MediumExample 2
A free electron on a ring of circumference L = 1.0 nm, with ψ(x + L) = ψ(x), has the degenerate pair ψc = √(2/L) cos(2πx/L) and ψₛ = √(2/L) sin(2πx/L). Show that p̂ commutes with Ĥ = p̂²/2m but that ψc is not an eigenfunction of p̂, then find the combinations of the pair that are eigenfunctions of both, with their E and p.
View solution →
- [p̂, p̂²] = p̂³ − p̂³ = 0, so p̂ and Ĥ commute. With k = 2π/L = 6.28 nm⁻¹ both functions satisfy Ĥψ = Eψ with E = ħ²k²/2m = (0.0381 eV nm²)(39.5 nm⁻²) = 1.50 eV.
- p̂ψc = −iħ(−k)√(2/L) sin(kx) = iħkψₛ, and p̂ψₛ = −iħkψc. p̂ turns each into the other, so neither is an eigenfunction of p̂, although both are eigenfunctions of Ĥ.
- Inside the level, p̂ becomes the 2 × 2 matrix Pᵢⱼ = ∫ψᵢ*(p̂ψⱼ) dx over one circumference: Pcc = Pₛₛ = 0, Psc = iħk and Pcs = −iħk. It is Hermitian, since Pcs is the conjugate of Psc.
- Eigenvalues: λ² − Pcs Psc = λ² − ħ²k² = 0, so λ = ±ħk. For +ħk the column is (1, i)/√2 and for −ħk it is (1, −i)/√2, giving (ψc ± iψₛ)/√2 = e(±2πix/L)/√L.
- p = ±ħk = ±h/L = ±6.63 × 10⁻²⁵ kg m s⁻¹. Checks: p²/2m = (6.63 × 10⁻²⁵)² ÷ (2 × 9.11 × 10⁻³¹) J = 2.41 × 10⁻¹⁹ J = 1.50 eV, the energy of the level; |e(±ikx)/√L|² = 1/L integrates to 1 over the ring; as L → ∞, p = h/L and E = h²/(2mL²) both fall to zero, the free particle on a line; and classically a free particle with this energy circulates one way or the other with |p| = √(2mE).
Answer. The common eigenfunctions are e(±2πix/L)/√L, both with E = 1.50 eV, with p = +6.63 × 10⁻²⁵ kg m s⁻¹ and −6.63 × 10⁻²⁵ kg m s⁻¹. cos and sin are eigenfunctions of Ĥ only.
HardExample 3
For an electron in a box 0 ≤ x ≤ a with a = 0.50 nm, take as data ψₙ = √(2/a) sin(nπx/a), Eₙ = n²E₁ with E₁ = 1.504 eV, and x₁₂ = ∫ψ₁xψ₂ dx = −16a/(9π²) from UQMI-03.08. Use [x̂, Ĥ] = iħp̂/m to find p₁₂ = ∫ψ₁(p̂ψ₂) dx without differentiating ψ₂, then check it directly and against ⟨x⟩(t) in the state (ψ₁e(−iE₁t/ħ) + ψ₂e(−iE₂t/ħ))/√2.
View solution →
- Sandwich the commutator: ∫ψ₁([x̂, Ĥ]ψ₂) dx = ∫ψ₁x(Ĥψ₂) dx − ∫ψ₁Ĥ(xψ₂) dx. The first term is E₂x₁₂. In the second, move Ĥ onto ψ₁, allowed because xψ₂ vanishes at both walls, giving E₁x₁₂. So (iħ/m)p₁₂ = (E₂ − E₁)x₁₂.
- Hence p₁₂ = −i(m/ħ)(E₂ − E₁)x₁₂. With E₂ − E₁ = 3E₁ = 3π²ħ²/(2ma²) and x₁₂ = −16a/(9π²), everything cancels except ħ/a: p₁₂ = +8iħ/(3a).
- Numbers: ω = (E₂ − E₁)/ħ = 4.51 eV/ħ = 6.86 × 10¹⁵ s⁻¹ and x₁₂ = −0.0901 nm, so p₁₂ = −imωx₁₂ = 5.62i × 10⁻²⁵ kg m s⁻¹, matching 8ħ/(3a) = 5.62 × 10⁻²⁵ kg m s⁻¹ times i.
- Direct check: p̂ψ₂ = −iħ√(2/a)(2π/a) cos(2πx/a), and ∫₀ᵃ sin(πx/a) cos(2πx/a) dx = −2a/(3π), so p₁₂ = −iħ(4π/a²)(−2a/(3π)) = 8iħ/(3a). The commutator gave it without the trigonometric integral.
- Correspondence: the state is normalised, ½ + ½ = 1, and ⟨x⟩ = a/2 + x₁₂ cos ωt, while ⟨p⟩ = Re(p₁₂e(−iωt)) = −mωx₁₂ sin ωt, exactly m d⟨x⟩/dt, the classical p = m dx/dt.
- Further checks: p₂₁ = p₁₂* = −8iħ/(3a), as a Hermitian p̂ requires; J s m⁻¹ = kg m s⁻¹; and as a → ∞, p₁₂ → 0 like 1/a.
Answer. p₁₂ = 8iħ/(3a) = 5.62i × 10⁻²⁵ kg m s⁻¹, by the commutator and by direct integration alike; in the two-term state ⟨p⟩ oscillates with amplitude 5.62 × 10⁻²⁵ kg m s⁻¹, exactly m d⟨x⟩/dt.
Quick check
Choose an answer, then check it. Explain to yourself why the others fail.
Key takeaway
Reduce x–p commutators to [x̂, p̂] = iħ, then judge compatibility.
Find [Â, B̂] by acting on a test function f, or with [Â, B̂Ĉ] = [Â, B̂]Ĉ + B̂[Â, Ĉ]. A zero commutator lets Hermitian operators share a complete eigenbasis, chosen inside degenerate levels; a nonzero constant such as iħ forbids even one shared eigenfunction.
Next: Observables, Hermitian operators, and real eigenvalues →