# Distance between two points on a surface with metric $g_{mn}$

Say you have a two dimensional surface with a metric tensor $g_{mn}$ on which there are two points with coordinates $(\theta_1, \phi_1)$ and $(\theta_2,\phi_2)$, how would you calculate the distance between these points?

My initial idea would be to solve the geodesic equation:

$$\frac{d^2 x^a}{ds^2} + \Gamma^a_{\phantom a bc}\frac{dx^b}{ds}\frac{dx^c}{ds} = 0$$

Where $\Gamma^a_{\phantom abc}$ are the Christoffel Symbols.

Then, after solving the equation $x^a(s)$, I would calculate the length using the arc length formula,

$$s = \int^b_a \sqrt{\left(\frac{d\theta}{ds}\right)^2 + \left(\frac{d\phi}{ds} \right)^2} ds$$

Or maybe, since the above is calculation Euclidean distance:

$$s = \int^b_a \sqrt{g_{ab}\frac{dx^a}{ds}\frac{dx^b}{ds}} ds$$

Is this the correct method or is there an easier way to calculate it?

Note: What I'm trying to do is derive the formula for the Great Circle distance using the metric for a sphere,

$$\begin{bmatrix}r^2& 0\\0& r^2 \sin^2\theta\end{bmatrix}$$

with the Python gravipy library while still allowing any 2-dimensional metric to be used.

To calculate the distance between two points, first you have to choose a path between those two, say $\gamma (s)$. If you want the shortest distance, as you said, solve the geodesic equation $\nabla_{\dot{\gamma}} \dot{\gamma} = 0$ to obtain function $\phi = \phi(\theta)$ and then calculate \begin{align} \int_{s_1}^{s_2} ds &= \int_{s_1}^{s_2} \sqrt{g_{\mu \nu}dx^{\mu} dx^{\nu}} \\ &=\int_{s_1}^{s_2} \sqrt{R^2 d\theta^2 + R^2 \sin^2 \theta d\phi^2} \\ &= R \int_{\theta_1}^{\theta_2} \sqrt{1+\sin^2 \theta \Big(\frac{d\phi}{d\theta}\Big)^2} d\theta \end{align} However, to show that the great circle is the geodesic on $\mathbb{S}^2$ you don't need to calculate the distance. Just solve geodesic eq.
• Could you expand a little on the first step: Choosing a path $\gamma (s)$, then solving $\nabla_\dot{\gamma} \dot{\gamma} = 0$? Jul 15 '18 at 19:32
• If $\gamma (s) = \dot{\gamma}^{i} \partial_i = \dot{x}^i \partial_i$. The eq $\nabla_{\dot{\gamma}}\dot{\gamma} = 0$ is just your geodesic eq above. Jul 15 '18 at 19:45