Skip to content

Symbolic operator algebra manipulates ordered products subject to declared relations. It keeps track of the order and coefficients of many terms. Its main danger is silently replacing a noncommutative problem with ordinary scalar algebra, or using identities outside the domain or representation in which they hold.

Required background. Commutators supplies the algebraic identities; array representations supports finite-matrix cross-checks.

Represent a polynomial as a sum of coefficients multiplying ordered words in operator symbols. Scalars may commute with the operators only when declared to do so. For a bosonic pair with [a,a†]=I[a,a^\dagger]=I, normal ordering moves every a†a^\dagger to the left using

aa†⟶a†a+I.aa^\dagger\longrightarrow a^\dagger a+I.

For example,

a(a†)2=(a†a+I)a†=(a†)2a+2a†.\begin{aligned} a(a^\dagger)^2 &=(a^\dagger a+I)a^\dagger\\ &=(a^\dagger)^2a+2a^\dagger. \end{aligned}

A safe implementation expands sums, applies an oriented rule to an out-of-order adjacent pair, and collects identical ordered words. Applying both directions of the identity indiscriminately creates an infinite rewrite loop. With several modes, specify cross-mode commutators; for fermions, use anticommutators and include the signs generated by exchanges.

A computer algebra system’s generic simplifier does not know the physical algebra unless those relations are encoded. Nor does a declaration that symbols do not commute automatically supply [a,a†]=I[a,a^\dagger]=I.

The adjoint reverses order:

(AB)†=B†A†,(zA)†=z∗A†.(AB)^\dagger=B^\dagger A^\dagger, \qquad (zA)^\dagger=z^*A^\dagger.

Declare whether couplings are real, complex, positive, or independent. For H=ga+g∗a†H=g a+g^*a^\dagger, Hermiticity holds for complex gg. Replacing g∗g^* with gg is valid only with a real-coupling assumption or an explicitly justified phase convention.

Square roots and logarithms also require assumptions. For a real parameter xx, x2=∣x∣\sqrt{x^2}=|x|, not generally xx. A symbolic diagonalization that chooses a branch without recording it can exchange eigenvalue labels across a parameter crossing.

For differential operators, products act on everything to their right. With p=−iℏ∂xp=-i\hbar\partial_x and a smooth multiplication operator f(x)f(x), applying both sides to a test function yields

pf=fp−iℏf′.pf=fp-i\hbar f'.

This is an identity on an appropriate common domain, not a license to ignore boundary conditions. Formal integration by parts may leave a boundary term even when the symbolic differential expressions match.

Why finite matrices cannot prove every identity

Section titled “Why finite matrices cannot prove every identity”

Truncate the oscillator basis to ∣0⟩,…,∣N−1⟩\lvert0\rangle,\ldots,\lvert N-1\rangle and let aNa_N be the truncated lowering matrix. Direct multiplication gives

[aN,aN†]=I−N∣N−1⟩⟨N−1∣.[a_N,a_N^\dagger] =I-N\lvert N-1\rangle\langle N-1\rvert.

Every finite matrix commutator has trace zero, so it cannot equal II. The defect occurs at the upper cutoff. Testing the canonical commutator on low-occupation states can succeed while the full matrix identity fails, exactly as it should.

For a normalized truncated state ψ\psi, the commutator expectation is 1−N∣ψN−1∣21-N|\psi_{N-1}|^2. This supplies a useful occupation-cutoff diagnostic. It also explains why a symbolic identity should not be “corrected” merely because a finite cutoff violates it at its boundary.

Check a symbolic result in several ways: evaluate a small exact representation when one exists, substitute nonsymmetric parameter values, verify adjoints and dimensions, and test a known limiting case. Pauli matrices provide exact finite-dimensional checks for spin identities; bosonic commutators require the cutoff qualification above.

Random numerical substitution can disprove an identity by finding a counterexample, but a finite number of passing samples is not a proof. Choosing only commuting or real matrices can conceal precisely the error being tested.

Expanded noncommutative polynomials can grow rapidly. Retain factored forms when they preserve meaning, collect terms in a chosen basis, and cache repeated commutators. A truncated Baker–Campbell–Hausdorff expression must carry its expansion order; dropping higher nested commutators without a small-parameter or exact-closure argument changes an identity into an approximation.

Normal-order a2a†a^2a^\dagger and verify the result by acting on ∣n⟩\lvert n\rangle away from a numerical cutoff.

Solution

a2a†=a(a†a+I)=a†a2+2aa^2a^\dagger=a(a^\dagger a+I)=a^\dagger a^2+2a. Both sides produce (n+1)n∣n−1⟩(n+1)\sqrt n\lvert n-1\rangle. The result also vanishes at n=0n=0. A finite truncation needs enough room for the intermediate raising operation.

For N=3N=3, what is the diagonal of [aN,aN†][a_N,a_N^\dagger]?

Solution

It is (1,1,−2)(1,1,-2), with zero trace. The top entry is 1−N1-N, not one.

  • Meurer, A., et al., “SymPy: Symbolic Computing in Python,” PeerJ Computer Science 3, e103 (2017), article — symbolic representations, assumptions, and extensible computer algebra.
  • Sakurai, J. J., and J. Napolitano, Modern Quantum Mechanics, 3rd ed., Cambridge University Press, 2021 — operator identities, commutators, and oscillator algebra.