Solution (source code)

= Solution

Using $[x,p]=i\hbar$, the <Heisenberg picture> equations for the <quantum harmonic oscillator> are
$$
\boxed{\dot x=\frac{i}{\hbar}[H_0,x]=\frac pm,\qquad
\dot p=\frac{i}{\hbar}[H_0,p]=-m\omega^2x}.
$$
Solving these coupled linear equations gives
$$
\boxed{\begin{aligned}
x(t)&=x(0)\cos\omega t+\frac{p(0)}{m\omega}\sin\omega t,\\
p(t)&=p(0)\cos\omega t-m\omega x(0)\sin\omega t.
\end{aligned}}
$$
The oscillator <annihilation operator> and <creation operator> are
$$
a=\sqrt{\frac{m\omega}{2\hbar}}x+\frac{i}{\sqrt{2m\hbar\omega}}p,\qquad
a^\dagger=\sqrt{\frac{m\omega}{2\hbar}}x-\frac{i}{\sqrt{2m\hbar\omega}}p.
$$
They obey $[a,a^\dagger]=1$ and $H_0=\hbar\omega(a^\dagger a+1/2)$. Substitution of the position and momentum solutions, or the corresponding <commutators> with $H_0$, yields
$$
\boxed{a(t)=a(0)e^{-i\omega t},\qquad a^\dagger(t)=a^\dagger(0)e^{i\omega t}}.
$$