Solution (source code)

= Solution

Inside the <infinite square well>, $V=0$, and the <time-independent Schrödinger equation> is
$$
-\frac{\hbar^2}{2m}\frac{d^2\psi}{dx^2}=E\psi,\qquad\psi(0)=\psi(L)=0.
$$
For $E>0$, write $k^2=2mE/\hbar^2$ and $\psi=A\sin kx+B\cos kx$. The first <Dirichlet boundary condition> gives $B=0$, and the second requires $kL=n\pi$ for a nonzero state. The case $n=0$ is identically zero; negative $n$ only changes an overall <quantum phase>. For $E=0$ a linear solution satisfying both walls is zero, and for $E<0$ the hyperbolic solutions likewise cannot satisfy both walls nontrivially.

<Wavefunction normalization>, $\int_0^L|\psi|^2dx=1$, fixes $|A|=\sqrt{2/L}$. The orthonormal <energy eigenstates> and <energy eigenvalues> are therefore
$$
\boxed{\psi_n(x)=\sqrt{\frac2L}\sin\frac{n\pi x}L,\qquad E_n=\frac{n^2\pi^2\hbar^2}{2mL^2},\qquad n=1,2,\ldots.}
$$
Each state vanishes outside the well. Its stationary time-dependent form is $\Psi_n(x,t)=\psi_n(x)e^{-iE_nt/\hbar}$. General states are normalized <superpositions> of these modes, rather than additional single <energy eigenstates>.