# Quantum Harmonic Oscillator Matrix Elements

I have a question about the procedure of generating the matrix elements of the Hamiltonian for a Harmonic oscillator.

I understand how to calculate the matrix for the normal Hamiltonian i.e., $$H=\frac{p^2}{2m}+\frac{1}{2}m\omega x^2$$ as $H \psi_j =E_j \psi_j$ then $$H_{ij}=\langle i｜H｜j\rangle=E_j\delta_{ij}=(j+1/2)\hbar \omega~ \delta_{ij}$$ which gives us the matrix.

But how would one go about calculating the matrix elements for a more complicated Hamiltonian e.g. an addition of $\cos(x)$ term to the potential $$H=\frac{p^2}{2m}+\frac{1}{2}m\omega x^2+\cos(x).$$

In this case if I remember correctly we can write $H_{mn}=\langle e_m｜H｜e_n\rangle$ which gives an integral of the new Hamiltonian with the $e_m$ and $e_n$ basis. However my knowledge about this is a bit sketchy and I am unsure what this basis vector is, so any help would be appreciated,

• In the normal quantum harmonic oscillator case, you should think about what your eigenstates $\psi_j$ are and how you arrived at them. For the more complicated case, what you wrote for $H_{mn}$ is correct. You just need to provide some basis (such as the $\psi_j$ basis in the original case). Also, the matrix element is given by the definition of the inner product on your Hilbert space. For a position space basis, it would look something like $H_{ij} = \psi_i^\dagger(x)H(x)\psi_j(x)$. – Aaron Nov 1 '16 at 21:44
• Are you working on a flux qubit or something like that? – DanielSank Dec 10 '16 at 23:02

To start with, dimensionally, your extra interaction term makes no sense, and you need to normalize x in your extra term to yield a dimensionless argument for the cosine. To this end, introduce dimensionless real constants ρ and α, so your hamiltonian is now $$H= \frac{p^2}{2m} + \frac{m\omega x^2}{2} + 2\rho \hbar \omega \cos \left ( \frac{\alpha x~\sqrt{2m\omega}}{\sqrt{\hbar}}\right ) ~.$$
Dispensing with pesky dimensionful constants, $$a\equiv x\sqrt{m\omega/2\hbar} +i p/\sqrt{2\hbar m\omega}, \qquad a^\dagger\equiv x\sqrt{m\omega/2\hbar} -i p/\sqrt{2\hbar m\omega}, \qquad [a,a^\dagger ]=1 ,$$ so that $$H=\hbar \omega \left( a^\dagger a + \frac{1}{2} +2\rho \cos(\alpha(a+a^\dagger)) \right).$$
For example, $$\langle n| H |0\rangle = \langle n| \hbar \omega \left ( \frac{1}{2}+\rho e^{-\alpha^2/2}(e^{i\alpha a^\dagger } e^{i\alpha a} +e^{-i\alpha a^\dagger }e^{-i\alpha a}) \right ) |0 \rangle \\ =\hbar \omega \left (\frac{1}{2}+\rho e^{-\alpha^2/2} ~(-)^{\lfloor n/2 \rfloor } (1+ (-)^n)~\frac{\alpha^n}{\sqrt{n}} \right )~,$$ etc… where use has been made of the integer floor function $\lfloor x\rfloor$.