# Calculate the $n^{th}$ energy state given the wavefunction?

I am given the wavefunction $$\psi(x,t)$$.
How does one determine the probability of a measurement of the energy giving the $$n^{th}$$ eigenstate?

My guess is it should be something like $$P_n = \int_{-\infty}^{\infty}|\langle O_n|\psi(x,t)\rangle|^2dx$$, but what is the $$O_n$$ operator that I should use?

You first need to calculate the spectrum of the Hamiltonian, i.e. you need to solve the time-independent Schrodinger equation

$$\hat{H} \vert \varepsilon _n \rangle = E_n \vert \varepsilon _n \rangle$$

to find the eigenvalues $$E_n$$ and eigenvectors $$\vert \varepsilon _n \rangle$$.

With that in mind, if the $$n^\mathrm{th}$$ eigenstate corresponds to a non-degenerate eigenvalue, you can simply write:

$$\mathrm{Pr}(E=E_n , t) = \vert \langle \varepsilon_n \vert \Psi (t) \rangle \vert^2 = \Big\vert \int_{- \infty}^\infty dx \ \varepsilon_n(x)^* \psi(x,t) \Big\vert^2$$

And for the general degenerate case, where the eigenvalue $$E_n$$ corresponds to the orthonormal set of eigenvectors $$\{\vert \varepsilon_{n,k} \rangle \}_{k=1}^{g_n}$$ you have:

$$\mathrm{Pr}(E=E_n,t) = \sum_{k=1}^{g_n} \vert \langle \varepsilon_{n,k} \vert \Psi (t) \rangle \vert^2 = \sum_{k=1}^{g_n} \Big\vert \int_{- \infty}^\infty dx \ \varepsilon_{n,k}(x)^* \psi(x,t) \Big\vert^2$$ with $$g_n$$ being the order of degeneracy for the eigenvalue $$E_n$$.