Shortest distance between a point and a geodesic on a sphere

I have a geodesic (connecting points A and B) on a sphere. There's a another point C on the same sphere. So, I know distance AB. If necessary, AC and BC can also be computed.

I need to find the shortest distance between the point C and the geodesic line AB. My initial attempt was to use an idea like Lagrange multipliers to find the shortest arc length, however, it is difficult to solve the differential equation.

How can I calculate the shortest distance between C and AB? Thanks.

• It might be obvious, but as in Euclidean geometry, the shortest path between a point and a geodesic is itself a geodesic which intersects perpendicular to the first. Commented Jan 3, 2018 at 11:27

I will assume that it is a sphere of radius r. Think of $A,B$ and $C$ as vectors of length $r$ in $\mathbb{R}^3$. The geodesic $AB$ is a great circle on the sphere, it divides the sphere into lower and upper hemisphere. The unit normal vector of this great circle is $$N = \frac{A\times B}{|A\times B|}.$$ The angle between $C$ and $N$ is $\theta = \cos^{-1}(\frac{C\cdot N}{r})$. Then the angle between $C$ and $AB$ is $\pi/2 - \theta$. Therefore the shortest distance is $(\pi/2 - \theta) r = r(\pi/2 - \cos^{-1}(\frac{C\cdot N}{r}))$.

You need to find a point $P$ on $AB$ so that the arc $CP$ is

• a geodesic (great circle), and,
• it is also orthogonal to $AB$

lengths $CA,CB$ are not needed. ( To find their lengths and give it in the problem you need angular data between sides of spherical triangle!).

For the special case if $AB$ is the equator and $C$ has latitude $\phi,$ then the required distance is $R \phi.$

Assuming you mean the distance to the less than $\pi$ radian part of the great circle between A and B:
The other answers only apply, if the projection of $C$ to the line between $A$ and $B$ is inside the sphere. This is is the case if

$$||\frac{A (1+t)+B (1-t)}{2}-C||^2_2$$

has a stationary point $-1\leq t_s \leq1$. When differentiating the expression and solving it to equal $0$ we get $$t_s=\frac{B\cdot B-A\cdot A+(A-B)\cdot C}{(A-B)\cdot(A-B)}$$

If $t>1$ then the shortest distance is $AC$ and if $t<1$ then the shortest distance is $BC$.

For simplicity, I assume the sphere is of radius $r=1$.

Further, I assume that by geodesic you mean the shortest connection and not just any great circle arc because then we would need more information on how the curve looks exactly. Therefore I assuming $A$ and $B$ are not antipodal, because otherwise the geodesic is not unique and we can also find one which passes through $C$.

Analytic way

The geodesic can be parametrized as

$$g(t)=\frac{(1-t)A+tB}{\|(1-t)A+tB\|},\quad t\in[0,1].$$

The distance of $C$ from a point $g(t)$ on the geodesic is

$$d(t)=\arccos\langle C,g(t)\rangle.$$

You can try to find the minimum of this function $d(t)$, which might be either in the interior $t\in(0,1)$ and can be found by means of analysis (derive and search for zeros), or might be one of the points for $t\in\{0,1\}$ which can be checked one by one.

Geometric way

Change your coordinate system in such a way so that the great circle trought $A$ and $B$ is the equator of the sphere, i.e. put both $A$ and $B$ on the equator. Say $A$ has a longitude of $\phi_a$ and $B$ has a longitude of $\phi_b$ with $\phi_b-\phi_a\in(0,\pi)$.

If $\phi_c$ (the longitude of $C$) is inside the interval $(\phi_a,\phi_b)$, then the distance of $C$ to the geodesic is just the value of the latitude of $C$.

If not, then you can compute the spherical distance of $C$ from $A$ and $B$ respectively (with the formula given in the first part) and check which is smaller. This is the distance of $C$ from the geodesic.

Here's a general approach. A geodesic is the generalization of a "line" to some manifold. A "circle" is that set of points the distance from some center along the connecting geodesic remains constant.

Given a point on a line(geodesic connecting AB) and a point(C) not on that line:

1) Construct a "circle" centered at point A and passing through C. 2) Construct a "circle" centered at point B and passing through C. 3) Draw a "line" from C to the other intersection of the 2 circles.

The intersection of this "line" with the geodesic containing AB is the point of closest approach on geodesicAB to point C.

Rules governing existence of geodesics apply, i.e. the space is a twice differentiable, smooth manifold.