# Shortest path to a geodesic

If we have two points A and B on the surface of a sphere, a geodesic between them, and another point C on the same sphere surface, but not on the geodesic, is there any concept of a "perpendicular" geodesic to AB that passes through C ?

Because I'm not able to describe the problem mathematically (because I don't know what is the exact concept I'm searching for, and I don't have the proper mathematical vocabulary), I'm going to describe the practical problem for which I need this.

A and B are two points on the surface of the Earth with a geodesic between them, C is another point on the surface of the Earth, which does not pass through AB, and I need to calculate the coordinates of D, on the AB geodesic, so that the geodesic distance between C and D is minimized. It is sort of a "shortest distance from point to line" problem applied to geodesics. In 2D geometry D would be the perpendicular foot from C to AB.

Let $$\alpha:I\to M$$ be an curve on some Riemannian manifold $$(M,g)$$ (this could be your geodesic connecting $$A$$ and $$B$$). Then under suitable conditions, we can treat the image as a $$1$$-dimensional submanifold. Then you can consider your length function $$L:\Omega\to\mathbf{R}$$, where $$\Omega$$ is the space of of all piecewise smooth curves $$\gamma:[a,b]\to M$$ with the conditions that $$\gamma(a)\in\alpha(I)$$, $$\gamma'(a)\in T_{\gamma(a)}\alpha(I)^\perp$$, and $$\gamma(b)=C$$. The usual variational analysis of such a functional/space would then apply. That is, your critical points of the functional should be geodesics, and they should minimize if the second variation is positive definite on $$T_\gamma\Omega$$ (your second variation should contain the shape operator of the submanifold $$\alpha(I)\times\{C\}\subset M\times M$$).