Source: High School Physics Olympiad
Problem Sets:
Problem
Particles $A$ and $B$ start simultaneously from points $A$ and $B$, moving in uniform rectilinear motion with speed $v_1$ along $AB$ and speed $v_2$ along $BC$ respectively, where the angle between segments $AB$ and $BC$ (the angle $\angle ABC$) is $\alpha$. Initially the particles are a distance $l$ apart.
Place $A$ at the origin with $B$ at $(l, 0)$. Particle $A$ moves with velocity $(v_1, 0)$; particle $B$ moves along $BC$, which makes angle $\alpha$ with $BA$, so its velocity is $(-v_2\cos\alpha, v_2\sin\alpha)$.
The separation components at time $t$:
$$\Delta x = l - (v_1 + v_2\cos\alpha)t, \qquad \Delta y = v_2\sin\alpha\, t$$The squared distance is a quadratic in $t$:
$$d^2 = l^2 - 2l(v_1 + v_2\cos\alpha)t + (v_1^2 + v_2^2 + 2v_1v_2\cos\alpha)t^2$$Its vertex gives the closest approach at $t^* = \dfrac{l(v_1 + v_2\cos\alpha)}{v_1^2 + v_2^2 + 2v_1v_2\cos\alpha}$, and substituting back:
$$d_{min} = \frac{l\,v_2\sin\alpha}{\sqrt{v_1^2 + v_2^2 + 2v_1v_2\cos\alpha}}$$Equivalently, $d_{min}$ is the distance from $B$'s initial relative position to the line of the relative velocity $\vec{v}_B - \vec{v}_A$.