$\hat{x}, \hat{p}$ の交換関係を使って、次のように計算できる: \begin{align} \left[ \hat{a}, \hat{a}^\dagger \right] &= \frac{m \omega}{2 \hbar} \cdot \frac{-2i}{m \omega} \left[ \hat{x}, \hat{p} \right] \\ &= 1 \\ \left[ \hat{N}, \hat{a} \right] &= \left[ \hat{a}^\dagger \hat{a}, \hat{a} \right] \\ &= \hat{a}^\dagger \left[ \hat{a}, \hat{a} \right] + \left[ \hat{a}^\dagger, \hat{a} \right] \hat{a} \\ &= - \hat{a} \\ \left[ \hat{N}, \hat{a}^\dagger \right] &= \left[ \hat{a}^\dagger \hat{a}, \hat{a}^\dagger \right] \\ &= \hat{a}^\dagger \left[ \hat{a}, \hat{a}^\dagger \right] + \left[ \hat{a}^\dagger, \hat{a}^\dagger \right] \hat{a} \\ &= \hat{a}^\dagger \end{align}
(1) で得た交換関係を使って、次のように計算できる: \begin{align} \hat{N} \hat{a}^\dagger | n \rangle &= \left( \hat{a}^\dagger \hat{N} + \hat{a}^\dagger \right) | n \rangle \\ &= \left( n + 1 \right) \hat{a}^\dagger | n \rangle \\ \hat{N} \hat{a} | n \rangle &= \left( \hat{a} \hat{N} - \hat{a} \right) | n \rangle \\ &= \left( n - 1 \right) \hat{a} | n \rangle \end{align}
\begin{align} \hat{x} &= \sqrt{\frac{\hbar}{2 m \omega}} \left( \hat{a}^\dagger + \hat{a} \right) \\ \hat{p} &= i \sqrt{\frac{m \hbar \omega}{2}} \left( \hat{a}^\dagger - \hat{a} \right) \\ \hat{x}^2 &= \frac{\hbar}{2 m \omega} \left( \hat{a}^\dagger \hat{a}^\dagger + \hat{a}^\dagger \hat{a} + \hat{a} \hat{a}^\dagger + \hat{a} \hat{a} \right) \\ &= \frac{\hbar}{2 m \omega} \left( 2 \hat{N} + 1 + \hat{a}^\dagger \hat{a}^\dagger + \hat{a} \hat{a} \right) \\ \hat{p}^2 &= - \frac{m \hbar \omega}{2} \left( \hat{a}^\dagger \hat{a}^\dagger - \hat{a}^\dagger \hat{a} - \hat{a} \hat{a}^\dagger + \hat{a} \hat{a} \right) \\ &= \frac{m \hbar \omega}{2} \left( 2 \hat{N} + 1 - \hat{a}^\dagger \hat{a}^\dagger - \hat{a} \hat{a} \right) \\ \langle n | \hat{x}^2 | n \rangle &= \frac{\hbar}{2 m \omega} (2n+1) \\ \langle n | \hat{p}^2 | n \rangle &= \frac{m \hbar \omega}{2} (2n+1) \\ \langle n | \hat{x}^2 | n \rangle \langle n | \hat{p}^2 | n \rangle &= \frac{\hbar^2}{4} (2n+1)^2 \end{align}