Solution (source code)

= Solution

Inside the <infinite square well>, the stationary <wavefunctions> can be chosen real:
$$
\boxed{\Psi_n(x)=C_n\sin\frac{n\pi x}{a},\qquad n=1,2,3,\ldots,\quad 0<x<a.}
$$
They vanish outside the well and at its impenetrable endpoints. A sine meets the left boundary condition; the right one requires $\sin(n\pi)=0$. The putative $n=0$ function is identically zero, so it is not a <quantum state>. The constants $C_n$ are fixed by <wavefunction normalization>.