Calculate expectation values for \(x^2\) in state \(n\) using ladder operators


 * 1) Find the Hamiltonian that describes a simple harmonic oscillator in ladder operator form as described here: \(\mathbf{\hat{H}}=\omega\hbar \left (\hat{a}^{\dagger}\hat{a} + \frac{1}{2} \right )\) \(\hat{a} = \sqrt{\frac{m\omega}{2\hbar}} \left ( \hat{x} + i\frac{\hat{p}}{m\omega} \right ) \) \(\hat{a}^{\dagger} = \sqrt{\frac{m\omega}{2\hbar}} \left ( \hat{x} - i\frac{\hat{p}}{m\omega} \right ) \)
 * 2) Calculate \(x\): \(x=\sqrt{\frac{\hbar}{2m\omega}}\left(\hat{a}+\hat{a}^{\dagger}\right)\)
 * 3) Substitute this into \(\langle n|\hat{x}^2|n\rangle\): \(\langle n|\hat{x}^2|n\rangle = \frac{\hbar}{2m\omega}\langle n|\left(\hat{a}+\hat{a}^{\dagger}\right)^2|n\rangle\)
 * 4) Expand: \(\frac{\hbar}{2m\omega} (\langle n| \hat{a}^2|n\rangle + \langle n|\hat{a}^{\dagger}\hat{a}|n\rangle + \langle n|\hat{a}\hat{a}^{\dagger}|n\rangle + \langle n|{\hat{a}^{\dagger}}^{2}|n\rangle)\)
 * 5) Sum the terms.
 * 6) Since \(\langle a|b \rangle = \delta_{ab}\), eliminate all terms with unequal numbers of raising and lowering operators. \(\frac{\hbar}{2m\omega} (\langle n|\hat{a}^{\dagger}\hat{a}|n\rangle + \langle n|\hat{a}\hat{a}^{\dagger}|n\rangle)\)
 * 7) Use the commutator to rearrange \(\hat{a}\hat{a}^{\dagger}\): \(\frac{\hbar}{2m\omega} (\langle n|\hat{a}^{\dagger}\hat{a}|n\rangle + \langle n|1 + \hat{a}^{\dagger} \hat{a}|n\rangle)\)
 * 8) Substitute the number operator \(\hat{n}\) for \(\hat{a}^{\dagger}\hat{a}\) and calculate: \(\frac{\hbar}{2m\omega} (\langle n|n|n\rangle + \langle n|1 + n|n\rangle)\)
 * 9) Simplify: \(\frac{\hbar}{m\omega} (\frac{1}{2} + n)\)