Relationship between the length of the tangent line through a point on sphere and great-circle distance As an aviator I'm familiar with the concept of great-circle navigation because when we fly a route between 2 points on the globe we know the shortest distance between these two points is the great circle distance.
I'm developing a navigation app in Google Earth and I need to calculate the shortest distance from the surface of the "spherical" Earth to any point on the tangent line through A (origin) when flying the great circle path.
Also, I'm using a mean earth radius of 6,371.009 km for WGS84 ellipsoid.
Just to be clear, I'd like to refer to the diagram in the following link:
http://www.alaricstephen.com/main-featured/2017/5/22/the-haversine-formula
I use the Haversine formula to calculate the distance, d, between the points A and D (see diagram). What I'd like to calculate is the distance D to E as a function of d.
In the diagram this is referred to as the external secant (exsec) which is the portion DE of the secant exterior to the circle.
 A: $$r=OE\cos\theta$$
and
$$DE=r\sec\frac{\stackrel\frown{AD}}r-r.$$
A: HaverSine Formula is used routinely to compute long distances in navigation along shortest path great circles of the Earth between two points of given latitude and longitude.

First find $d$ on the Earth. Next air distance along a tangent if the flight point $B$ is above the Earth: $ t= r \tan \dfrac{d}{r}.$
$-------------------------$
After clarification the above can be ignored.
For perfect sphere model of earth it is simple trig. calculation.
Distance $ AD= r \theta =  $ the arc distance you calculated using Haversine formula along a great circle arc of earth radius $=r$ as shown. Calculate $ \theta $ in radians in the plane of kite shape $OAEB$ if we imagine $B$ on another tangent point below. We have $  \theta= \dfrac{\text{arc} AD}{r}$

Central dimension is length $OE$. From this subtract earth radius.
$$ DE = r \sec \theta - r\; = r (\sec \theta -1 )$$
This is the red height above target/destination/landing place which should vanish on landing at $D$. It is indicated by exsec in the supplied link   for unit earth radius.
