# Bra-Ket Notation problem

I am currently working to find the mean position for a harmonic oscillator, but I've stumbled upon a mathematical problem.

I have:

$$\langle n|x^{2}|n\rangle=\langle n|aa^{\dagger}+a^{\dagger}a|n\rangle \space\space\space (1)$$

Now, I know that $$a|n\rangle=\sqrt{n}|n-1\rangle \space\space\space (2)$$ and $$a^{\dagger}|n\rangle=\sqrt{n+1}|n+1\rangle \space\space\space (3)$$

I am confused as to how I am to calculate (1) with the help of the above.

I'm guessing $$\langle n \vert a\neq a\vert n\rangle$$, so how can I transform (2) and (3) into giving me what I need to solve (1)?

• Your equation (2) is incorrect, it should be $a|n\rangle = \sqrt{n}|n-1\rangle$ Commented May 26, 2021 at 15:47
• You're right! Copy mistake! :)
– Tita
Commented May 26, 2021 at 15:55

Hint: $$\langle n|(aa^{\dagger}+a^{\dagger}a)|n\rangle = \langle n|aa^{\dagger}|n\rangle + \langle n|a^{\dagger}a|n\rangle = (\langle n|a)(a^{\dagger}|n\rangle) + (\langle n|a^{\dagger})(a|n\rangle) \\ = (a^{\dagger}|n\rangle)^{\dagger} (a^{\dagger}|n\rangle) + (a|n\rangle)^{\dagger}(a|n\rangle)$$