Solution (source code)

= Solution

A plane wave $Ae^{ikx}$ carries current $(\hbar k/m)|A|^2$. The incident, reflected, and transmitted currents are therefore
$$
J_{\rm in}=\frac{\hbar k}{m},
\qquad
J_{\rm ref}=-\frac{\hbar k}{m}|R|^2,
\qquad
J_{\rm tr}=\frac{\hbar k}{m}|T|^2.
$$
Spatial constancy of the current gives
$$
J_{\rm in}+J_{\rm ref}=J_{\rm tr},
$$
and hence
$$
\boxed{|R|^2+|T|^2=1}.
$$
This is conservation of probability flux: every incident particle is either reflected or transmitted.