Solution (source code)

= Solution

Take $m,\omega>0$ and use the usual common invariant domain for the <position operator>, <momentum operator> and their products. Since $X$ and $P$ are <self-adjoint>,
$$
\boxed{a_+=\frac{P+im\omega X}{\sqrt{2m\omega\hbar}}.}
$$
Expanding the <commutator> and using $[P,X]=-i\hbar I$ gives
$$
[a_-,a_+]=\frac{im\omega[P,X]-im\omega[X,P]}{2m\omega\hbar}=I.
$$
The two products are
$$
a_+a_-=\frac{P^2+m^2\omega^2X^2-m\omega\hbar}{2m\omega\hbar},\qquad
a_-a_+=\frac{P^2+m^2\omega^2X^2+m\omega\hbar}{2m\omega\hbar}.
$$
Consequently the <quantum harmonic oscillator> <Hamiltonian operator> is
$$
\boxed{H=\hbar\omega(a_+a_-+\tfrac12 I)=\hbar\omega(a_-a_+-\tfrac12 I).}
$$
The identity $[AB,C]=A[B,C]+[A,C]B$ now gives
$$
\boxed{[H,a_-]=-\hbar\omega a_-,\qquad[H,a_+]=\hbar\omega a_+.}
$$
Thus $H(a_\pm\psi)=(E\pm\hbar\omega)a_\pm\psi$. \b[Each ladder image is an <eigenstate> if it is nonzero]; a zero <vector> is not an <eigenstate>. The distinction is needed for lowering the <ground state>. Their squared <norms> are
$$
\boxed{\|a_-\psi\|^2=\left(\frac E{\hbar\omega}-\frac12\right)\|\psi\|^2,\qquad
\|a_+\psi\|^2=\left(\frac E{\hbar\omega}+\frac12\right)\|\psi\|^2.}
$$
These follow by moving the operator to the other side of the <inner product> with its <adjoint operator>. The first inequality implies $E\geq\hbar\omega/2$ for every <eigenstate>.

For a lowest-energy <quantum state>, $a_-\psi_0$ must vanish, since otherwise it would be an <eigenstate> with lower energy. The <norm> formula then forces $E_0=\hbar\omega/2$. Raising never vanishes and produces
$$
\boxed{E_n=\hbar\omega(n+\tfrac12),\qquad\psi_n=(a_+)^n\psi_0,\qquad n=0,1,2,\ldots.}
$$
To see that there are no other <eigenvalues>, repeatedly lower any <eigenstate>. If $E/(\hbar\omega)-1/2$ were not a nonnegative integer, there would be a final nonzero lowered <quantum state> with energy strictly between $\hbar\omega/2$ and $3\hbar\omega/2$. Its lower image would have positive <norm> but energy below the lower bound, a contradiction. Thus every <eigenstate> reaches the ground eigenspace after an integer number of lowerings. On a positive level, lowering is injective by its strictly positive <norm> factor. The assumed one-dimensional ground eigenspace therefore makes every eigenspace one-dimensional, so the displayed raised <quantum states> give all <eigenstates> up to nonzero multiples. If $\psi_0$ is normalized, their <norms> are $\|\psi_n\|^2=n!$.

For $k\geq1$, $(a_+)^k\psi$ has <eigenvalue> $E+k\hbar\omega$, distinct from $E$. <eigenstates> of a <self-adjoint operator> with distinct <eigenvalues> are <orthogonal>: applying self-adjointness to their <inner product> gives $(E'-E)\langle\psi,\phi\rangle=0$. Therefore
$$
\boxed{\langle\psi,(a_+)^k\psi\rangle=0.}
$$
The <expectation> of $(a_-)^k$ also vanishes, either by lowering and <orthogonality> or by conjugating the adjoint relation.

Solving the ladder definitions for $X$ and $P$ gives
$$
T=\frac{\hbar\omega}{4}(a_-+a_+)^2,\qquad V=-\frac{\hbar\omega}{4}(a_+-a_-)^2,
$$
so $T-V=\frac12\hbar\omega((a_+)^2+(a_-)^2)$. Both terms have zero <expectation> by the preceding <orthogonality>. Since $T+V=H$, the oscillator form of the <quantum virial theorem> is
$$
\boxed{\mathbb E_\psi(T)=\mathbb E_\psi(V)=E/2.}
$$
Expectations here are divided by $\|\psi\|^2$ if the <eigenstate> is not normalized; no <normalization> assumption was used in the ladder argument.