Solution (source code)

= Solution

The <canonical commutation relation> $[x',p']=i\hbar I$ and <hamiltonian> $H'=p'^2/(2m)+m\omega^2x'^2/2$ give
$$
[H',x']=-\frac{i\hbar}{m}p',\qquad
[H',p']=i\hbar m\omega^2x'.
$$
Substitution in the <Heisenberg equation of motion> yields $\dot x'=p'/m$ and $\dot p'=-m\omega^2x'$. Differentiating once more gives the harmonic-oscillator equation for each operator. Its initial-value solution is
$$
\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}}
$$
Differentiating these expressions at zero verifies both prescribed initial <derivatives>. They also preserve $[x'(t),p'(t)]=i\hbar I$.