Considering the Hamiltonian of a harmonic oscillator \begin{equation} H=\frac{p^2}{2m}+\frac{m\omega^2 x^2}{2}, \end{equation} the time evolution of the Heisenberg picture position and momentum operators is given by \begin{align} \dot{x}&=\frac{i}{\hbar}[H,x]=\frac{p}{m}\\ \dot{p}&=\frac{i}{\hbar}[H,p]=-m\omega^2x, \end{align} from which we get \begin{align} \ddot{x}=\frac{\dot{p}}{m}=-\omega^2 x. \end{align} We can solve this differential equation with an initial condition $x(0)=x_0$ to obtain \begin{align} x=x_0 e^{-i\omega t}. \end{align} On the other hand, $p$ may be calculated by inserting $x=x_0 e^{-i\omega t}$ into $\dot{x}=\frac{p}{m}$ as the form \begin{align} p=-im\omega x_0 e^{-i\omega t}, \end{align} but it does not seem to be quantum mechanical because $p$ is represented in terms of $x_0$, so $p$ can commute with $x$. Where I am wrong?
2 Answers
You're not imposing the initial conditions correctly. The initial conditions are: \begin{align} x(0)&=x_0=x_S, \text{ and} \\ p(0)&=p_0=p_S. \end{align} That is, at $t=0$ the Heisenberg and Schrödinger picture operators coincide. So, the solution to this ordinary differential equation (ODE) for $x(t)$ $$\ddot{x}=-\omega^2x$$ is $$x(t) = A(x_0,p_0)\cos(\omega t)+B(x_0,p_0)\sin(\omega t). \tag1$$ Plugging $t=0$ into (1) produces $$A(x_0,p_0)=x_0.$$ Locking down $B$ requires using the equation $$\dot{x} = \frac{p}{m}$$ giving $$p = -mx_0\omega\sin(\omega t) +mB(x_0,p_0)\,\omega\cos(\omega t). \tag2$$ Plugging $t=0$ into (2) leads to $$B(x_0,p_0)=\frac{p_0}{m\omega}.$$ Thus the Heisenberg picture operators are: \begin{align} x(t) & = x_0 \cos(\omega t) + \frac{p_0}{m\omega}\sin(\omega t),\ \text{and} \\ p(t) & = - m\omega x_0\sin(\omega t) + p_0 \cos(\omega t). \end{align}
Your solution $ x = x_0 e^{-i\omega t}$ is not complete. The equation you are solving is second degree. It should depend two initial values $ x = x_0 e^{-i\omega t}+ x_1 e^{+i\omega t}$