Solution (source code)

= Solution

At the first endpoint, the <Cartesian coordinates> are $(r,0,0)$, so its <great circle> must have $l=0$. At the second endpoint, the <plane> condition gives $m\sin\theta_0\sin\phi_0+n\cos\theta_0=0$. Since $\cos\theta_0>0$, an equivalent regular <plane> equation is
$$
\boxed{\cos\theta_0\sin\theta\sin\phi-\sin\theta_0\sin\phi_0\cos\theta=0}.
$$
Where $\cos\theta\ne0$, divide by $\cos\theta_0\cos\theta$ to obtain
$$
\boxed{\tan\theta\sin\phi=\tan\theta_0\sin\phi_0}.
$$
The regular implicit equation includes the equatorial first endpoint; the tangent form is undefined there and must be read by a limit. The shorter connecting arc of this <great circle> is the shortest path. The endpoints are not antipodal, so this shorter arc is unique. For example, the central angle is $\delta=\arccos(\sin\theta_0\cos\phi_0)$, giving <spherical distance> $r\delta$.