Solution (source code)

= Solution

The time-independent <Schrödinger equation> gives the even interior <wavefunction> $\psi=A\cos(\alpha x)$, with $\alpha^2=2m(U+E)/\hbar^2$. Outside, normalizability of a <bound state> requires $\psi=C e^{-\beta(|x|-l)}$, with $\beta^2=-2mE/\hbar^2$.

Continuity of the <wavefunction> and its <derivative> at $x=l$ gives $C=A\cos(\alpha l)$ and $-\beta C=-\alpha A\sin(\alpha l)$. A nonzero solution cannot have $\cos(\alpha l)=0$, so division gives
$$
\boxed{\alpha\tan(\alpha l)=\beta.}
$$
At the formally allowed endpoint $E=-U$, the even interior solution is constant; <derivative> matching would force the exterior amplitude to vanish, leaving the zero solution. Nontrivial <bound states> therefore have $-U<E<0$. The matching formula is the even-state condition for a <finite square well>.