# Calculating expectation value

I am trying to calculate the expectation value of an infinite quantum well in one dimension (L).

Given:
$$\phi_n = \sqrt{\frac{2}{L}}\sin\left(\frac{n\pi}{L}x\right)$$ and $$E_n=\left[\frac{\hbar^2\pi^2}{2mL^2}\right]n^2$$

I am trying co calculate $\langle\phi_n|\hat{T}|\phi_n\rangle$, where $\hat{T}$ is the kinetic energy operator.

So far I have:
$$\int_{-\infty}^\infty\sqrt{\frac{2}{L}}\sin\left(\frac{n\pi}{L}x\right)\left[\frac{-\hbar^2}{2m}\frac{\partial^2}{\partial x^2}\sqrt{\frac{2}{L}}\sin\left(\frac{n\pi}{L}x\right)\right]dx$$

which I reduce to:
$$\left(\frac{2}{L}\right)\left(\frac{\hbar^2}{2m}\right)\left(\frac{n\pi}{L}\right)^2\int_{-\infty}^\infty\sin^2\left(\frac{n\pi}{L}x\right)dx$$

Then I get stuck at this point. I'm not sure what to do with the integral as I'm pretty sure it diverges. What am I misunderstanding?

By the eigenenergies you quote, I imagine you're dealing with an infinite potential well with walls at $x=0$ and $x=L$. In this case, the wavefunction is zero outside of the well, so $$\phi_n(x) = \left\{\begin{array}& \sqrt{\frac{2}{L}}\sin\left(\frac{n\pi}{L}x\right) &\text{if }0<x<L,\text{ and}\\ \qquad \quad0&\text{otherwise.}\end{array} \right.$$
The integral is therefore over $x\in[0,L]$, and converges without a problem.