Calculating the expectation value of a Hamiltonian 
I want to calculate the expectation value of a Hamiltonian. I have a wave function that is $$\psi = \frac{1}{\sqrt{5}}(1\phi_1 + 2\phi_2).$$

I want to know if I set this up properly. The Hamiltonian is $\hat H \left(x, \frac{\hbar \partial^2}{2m\partial x^2}\right)$. To get an expectation value I need to integrate this: 
$$\int \psi^* \hat H \psi dx.$$ 
Since the wavefunctions are normalized and real I can go with $\psi^* = \psi$. 
OK, so I put together the integral. 
$$\int \frac{1}{\sqrt{5}}(\phi_1 + 2\phi_2)\frac{\hbar}{2m} \frac{1}{\sqrt{5}}(\phi_1'' + \phi_2'') dx=\frac{\hbar}{2m}\frac{1}5\int(\phi_1 + 2\phi_2)(\phi_1'' + 2\phi_2'')dx,$$
and I know the wavefunction for $$\phi_n = \sqrt{\frac{2}{L}}\sin\left(\frac{n\pi x}{L}\right)$$ so $$\phi_1 = \sqrt{\frac{2}{L}}\sin\left(\frac{\pi x}{L}\right)$$  and $$\phi_2 = \sqrt{\frac{2}{L}}\sin\left(\frac{2\pi x}{L}\right).$$ 
I can plug these in and do the integral, and I wanted to check that was the right thing to do. I suspect there is an easier method, though. But if this will work then I can say "great, I at least understand this enough to do the problem." 
 A: So here is the abstract approach:
$$ \langle  \psi | H | \psi \rangle  = \frac{1}{5}\bigg( \langle \phi_1 | H | \phi_1 \rangle + 2\langle \phi_1 | H | \phi_2 \rangle  + 2\langle \phi_2 | H | \phi_1 \rangle  + 4 \langle \phi_2 | H | \phi_2 \rangle \bigg) \,.$$
Now you know that $H|\phi_1\rangle = E_1 |\phi_1 \rangle$ and $H|\phi_2\rangle = E_2 |\phi_2 \rangle$ --- or rather, you can easily check that the functions you've given are indeed eigenstates of the Hamiltonian:
$$ \frac{-\hbar^2}{2m} \frac{d^2}{dx^2} \phi_n = \frac{n^2 \pi^2 \hbar^2}{2m L^2} \phi_n  \equiv E_n \phi_n \,.$$
The functions $\phi_n$ are also normalised, as you can check, and are orthogonal to one another --- this must be the case, because they are the eigenfunctions of a Hermitian operator (with different eigenvalues). Hence the expression above becomes:
$$\langle  \psi | H | \psi \rangle  = \frac{1}{5}\bigg( E_1\langle \phi_1 | \phi_1 \rangle + 2E_2 \langle \phi_1 | \phi_2 \rangle  + 2E_2\langle \phi_2 | \phi_1 \rangle  + 4E_2 \langle \phi_2 | \phi_2 \rangle \bigg) \,.$$
$$\langle  \psi | H | \psi \rangle  = \frac{1}{5}\bigg( E_1  + 4E_2\bigg) \,.$$
Substituting in the form of the energies gives:
$$\langle  \psi | H | \psi \rangle  = \frac{17}{5} \frac{\pi^2 \hbar^2}{2m L^2} \,.$$
This is, to me, easier than computing the integral you've given, although the integral you've given is correct (or almost --- the Hamiltonian should have factor of $\hbar$ squared in front of the second derivative). If you tried to compute the integral, you would find a good deal of cancellation due to the orthogonality of the functions involved. If you're good at quickly spotting when an integral vanishes, e.g.:
$$ \int_0^L \sqrt{\frac{2}{L}} \sin \left(\frac{\pi x}{L }\right) \sqrt{\frac{2}{L}} \sin \left(\frac{2\pi x}{L }\right) \,dx = 0$$
then the above prescription might not seem any simpler. But as far as cleanness of approach goes, it's nicer to invoke the orthogonality of the eigenfunctions --- which is a result of central importance in this kind of problem, and one which you will prove in any introductory QM course --- before delving into explicit computations.
================================================================================
NB: I anticipate that you may not have met the above notation yet. There isn't anything to it. For our purposes, just take $\langle \psi | H |\psi \rangle$ to mean
$$ \int \psi^*(x) H \psi(x) \,dx  \,,$$
from which you should be able to see how the first line follows. The statement that two functions are orthogonal amounts to $\langle \phi_1 | \phi_2 \rangle = 0$, whilst the statement that a function is normalised amounts to  $\langle \phi_1 | \phi_1 \rangle = 1$.
