Ladder operator for harmonic oscillator, I don't get a mathematical

1. Jun 6, 2013

fluidistic

If the ladder operator $a=\sqrt {\frac{m\omega}{2\hbar}}x+\frac{ip}{\sqrt{2m\hbar \omega}}$ and $a^\dagger=\sqrt {\frac{m\omega}{2\hbar}}x-\frac{ip}{\sqrt{2m\hbar \omega}}$ then I get that the number operator N, defined as $a^\dagger a$ is worth $\frac{m \omega x^2}{2\hbar}+\frac{p^2}{2m\hbar \omega}$.
In wikipedia and http://quantummechanics.ucsd.edu/ph130a/130_notes/node167.html, as well as in books, one can read that for the harmonic oscillator $\hat H=\hbar \omega \left ( a^\dagger a +\frac{1}{2} \right )$. When I calculate the right hand side of this equation using my calculated value for N, I reach that $\hbar \omega \left ( a^\dagger a +\frac{1}{2} \right )=\frac{\hbar \omega }{2}+\frac{m\omega ^2 x^2}{2}+\frac{p^2}{2m}$.
However for the harmonic oscillator the hamiltonian operator is $\hat H=\frac{\hat {\vec p ^2}}{2m}+\frac{m\omega ^2 \hat x ^2}{2}$.
So that I do not reach that the left hand side is equal to the right hand side. Instead, I get that the left hand side is worth the right hand side + $E_0$, the ground state energy. Am I making an algebra mistake?! If not, what the heck is going on?

2. Jun 6, 2013

kith

This is not true because x and p don't commute, so the mixed terms don't vanish. xp is not equal to px, but to px + [x,p].

3. Jun 6, 2013

fluidistic

My bad, you are right. For a moment I forgot that x and p were operators. Thank you very much!

4. Jun 6, 2013

kith

You're welcome ;-)