Work problem 4.1 from , calculation of the eigensolution for an infinite square well, with boundaries . It’s actually a bit tidier seeming to generalize this slightly to boundaries , which also implicitly solves the problem. This is surely a problem that is done in 700 other QM texts, but I liked the way I did it this time so am writing it down.
Our equation to solve is . Separation of variables gives us
With , we have
and the usual boundary conditions give us
We must have a zero determinant, which gives us the constraints on immediately
So our constraint on in terms of integers , and the corresponding integration constant
One of the constants can be eliminated directly by picking any one of the two zeros from 2.4
So we have
Because probability densities, currents and the expectations of any operators will always have paired and factors, any constant phase factors like above can be dropped, or absorbed into the constant , and we can write
The only thing left is to fix by integrating , for which we have
This last trig term vanishes over the integration region and we are left with
which essentially completes the problem. A final substitution back into 2.8 allows for a final tidy up
 R. Liboff. Introductory quantum mechanics. Cambridge: Addison-Wesley Press, Inc, 2003.