Solution (source code)

= Solution

Continuity has already been built into these forms. At $b$, <derivative> continuity requires $-q\sin(qb)=-\kappa\cos(qb)$ for even parity and $q\cos(qb)=-\kappa\sin(qb)$ for odd parity. Thus
$$
\boxed{q\tan(qb)=\kappa\quad\text{or}\quad-q\cot(qb)=\kappa.}
$$
Use $q/\kappa=\sqrt{U_0/|E|-1}$ to obtain the two printed equations. The right side is positive, so only the corresponding allowed tangent/cotangent branches can describe a <bound state>; squaring without retaining this sign restriction adds spurious roots.