How to find tangent distance from a point on a sphere to a spherical polar cap? Suppose we have a point $P$ on a unit-sphere, and another point $X$ (may be north-pole) with spherical cap radius $r$ (radius along sphere surface). We need to find tangent distance from $P$ to the cap (tangent along spherical surface).
This is part of a bigger problem: We need to find shortest distance between two points on a sphere (along surface) so that it does not go through a spherical cap.
 A: I'm not sure to well understand your question, so I add a figure.

The figure is a plane section of your sphere passing from $P$. If I well understand the distance that you want is the length of the arc $PB$.( If this is wrong than my answer is wrong) 
You know the radius of the cap, that is the arc $AB=\beta$. In this case the arc $PB$ is simply $\dfrac{\pi}{2}-\alpha-\beta$ , where $\alpha$ is the arc that fix the position of $P$ with respect to the equatorial plane of the sphere(its latitude).
If you know as radius of the cap the distance $CB$ than you can find  $\beta=\arcsin (CB)$. 
A: Without loss of generality we may assume that $X$ is the North pole, so that the border of your spherical cap $C$ is parallel to the $xy$-plane and has equation
$$
\begin{cases}
x^2 + y^2 = r^2 \\
z = \sqrt{1 - x^2 - y^2} = \sqrt{1 - r^2} =: z_C
\end{cases}
$$
Further, we may assume that $C$ is strictly contained in the upper hemisphere and that $P \notin C$. Indeed, if $P$ is inside $C$ every great circle through $P$ intersects the border of $C$ in two distinct points, while if $P \in \partial C$ the distance you are looking for is trivially $0$.
If I understand correctly, you are looking for the shortest arc of great circle from $P = (x_P,y_P,z_P)$ to a point of tangency with $\partial C$. If this is the case, then observe that there are exactly two great circles $\gamma_1,\gamma_2$ through $P$ which are tangent to $\partial C$, and those are symmetric with respect to the plane $\pi$ through $P$, $X$, and the centre of the sphere $O$. In particular, this means that if $\sigma$ is the plane through $X$ orthogonal to $\pi$, then
$$
\sigma \cap \partial C = (\gamma_1 \cap \partial C) \cup (\gamma_2 \cap \partial C)
$$
Since by construction the projection of $P$ to the $xy$-plane must be orthogonal to $\sigma$, it follows that $\sigma$ is given by the equation
$$
x_P x + y_P y = 0
$$
Now suppose without loss of generality that $y_P \neq 0$. Then substituting $y = - \frac{x_P}{y_P} x$ into the equation for $\partial C$ gives
$$
\sigma \cap \partial C = \left\{\left(\pm \, c, \mp \, \frac{x_P}{y_P} c, z_C\right)\right\}
\quad \text{where } \quad
c = r \left(\left( \frac{x_P}{y_P} \right)^2 + 1 \right)^{-1/2}
$$
Finally, the distance you are looking for is the orthodromic between $P$ and any one of those two points.
