Two rail tracks ,which make an angle $X$ with each other ,intersect at $O$. Two trains $P$ and $Q$ are travelling on these tracks with speeds $u$ and $v$ towards $O$. Initially $P$ & $Q$ are at distance $a$ & $b$ from $O$ respectively. Show that the shortest distance between the train is
$\frac{(av - bu)\sin X}{(u^2+v^2-2uv \cos X)}$
And show that trains would collide if
$\frac{u}{v} = \frac{a}{b}$
A clear explanation would be great.
Hint: Shortest distance = $\sqrt{a^2 + b^2 - 2\cdot a\cdot b\cdot cos(x)}$