Solution (source code)

= Solution

Place the join at $x=0$, with an incident wave travelling from medium 1 towards medium 2. Write
$$
\Psi_1=(Ae^{ik_1x}+Be^{-ik_1x})e^{-i\omega t},\qquad
\Psi_2=Ce^{ik_2x}e^{-i\omega t},\quad k_j=\omega/v_j.
$$
Continuity of displacement and slope gives $A+B=C$ and $k_1(A-B)=k_2C$. Hence <reflection at a density step on a string> gives
$$
\boxed{r=\frac BA=\frac{k_1-k_2}{k_1+k_2}=\frac{Z_1-Z_2}{Z_1+Z_2}
=\frac{\sqrt{\rho_1}-\sqrt{\rho_2}}{\sqrt{\rho_1}+\sqrt{\rho_2}}},\qquad
\frac CA=\frac{2Z_1}{Z_1+Z_2}.
$$
For $\boxed{\rho_2>\rho_1}$, $r<0$: the reflected transverse displacement has a <phase> reversal of $\pi$. For $\rho_2<\rho_1$, $r>0$ and there is no displacement-phase reversal. The transmitted displacement has no <phase> reversal for positive real <mechanical impedances>.