Solution (source code)

= Solution

Infinite walls impose the <Dirichlet boundary conditions> $\psi(-a)=\psi(a)=0$. Inside the <infinite square well>, the <Time-independent Schrödinger equation> is $-\hbar^2\psi''/(2m)=E\psi$. Its nonzero solutions satisfying both endpoint conditions have wave numbers $k_n=n\pi/(2a)$, $n\geq1$. Since
$$
\int_{-a}^a\sin^2\left(\frac{n\pi(x+a)}{2a}\right)dx=a,
$$
the normalized <energy eigenstates> are the sine modes with prefactor $1/\sqrt a$. They are orthonormal by sine <orthogonality> and complete by the <Fourier sine series> on an interval of length $2a$. Differentiating twice gives
$$
\boxed{E_n=\frac{\hbar^2\pi^2n^2}{8ma^2}\quad(n=1,2,\ldots)}.
$$