[proofplan]
Set $r = d(p, q)$. The strategy is to identify a candidate minimal geodesic emanating from $p$ and show it must reach $q$ at parameter $r$. We choose the geodesic $\gamma(t) = \exp_p(t v)$, where $v \in T_p M$ is the unit vector pointing toward an optimal point $p_0$ on a small geodesic sphere $S_\delta(p)$ — a point that lies on every minimizer from $p$ to $q$. The set $A = \{t \in [0, r] : d(\gamma(t), q) = r - t\}$ records the parameter values for which $\gamma$ is "still on track" toward $q$. We show $A$ contains $\delta$, is closed, and is open relative to $[0, r)$ via a small-sphere matching argument; connectedness of $[0, r]$ then forces $A = [0, r]$, so $\gamma(r) = q$ and $\gamma|_{[0, r]}$ is the desired minimal geodesic.
[/proofplan]
[step:Reduce to the case $p \neq q$ and fix the candidate geodesic via an optimal point on a small sphere]
If $p = q$, the constant curve at $p$ is a minimal geodesic, so assume $p \neq q$ and set $r = d(p, q) > 0$. Choose $\delta > 0$ small enough that $\exp_p$ restricts to a diffeomorphism on the closed ball $\overline{B}(0, \delta) \subset T_p M$ — possible by the [Exponential Map as a Local Diffeomorphism](/theorems/2712) — and so that $\delta < r$. Then the geodesic sphere
\begin{align*}
S_\delta(p) := \{x \in M : d(x, p) = \delta\} = \exp_p(\{v \in T_p M : |v|_g = \delta\})
\end{align*}
is the diffeomorphic image of a Euclidean sphere, hence compact.
By the [Optimal Point on a Geodesic Sphere](/theorems/2725) (which applies because $0 < \delta < d(p, q)$), there exists $p_0 \in S_\delta(p)$ such that
\begin{align*}
d(p, p_0) + d(p_0, q) = d(p, q) = r.
\end{align*}
In particular $d(p_0, q) = r - \delta$. Write $p_0 = \exp_p(\delta v)$ for the unique $v \in T_p M$ with $|v|_g = 1$, and define the candidate geodesic
\begin{align*}
\gamma : [0, \infty) &\to M \\
t &\mapsto \exp_p(t v).
\end{align*}
This curve is defined for all $t \geq 0$ because $\exp_p$ is defined on all of $T_p M$ by hypothesis. Since $|v|_g = 1$, by [Geodesics Have Constant Speed](/theorems/2709) the curve $\gamma$ has unit speed.
[guided]
The proof rests on a single algebraic identity: a curve from $p$ to $q$ of length exactly $r = d(p, q)$ is necessarily a minimal geodesic (after reparametrization). Our task is to produce such a curve. The natural candidate is a geodesic — but which one? We need to pick the initial direction at $p$ correctly.
If $p = q$, the constant curve at $p$ is a minimal geodesic, so assume $p \neq q$ and set $r = d(p, q) > 0$. We now build the small geodesic sphere centred at $p$ that will host our optimal point.
Here is the geometric idea. Imagine standing at $p$ and walking toward $q$ along an unknown minimal path. After walking a tiny distance $\delta$, you cross a small sphere around $p$ at some point $p_0$. By the triangle equality (which characterises minimisers), this $p_0$ satisfies $d(p, p_0) + d(p_0, q) = d(p, q)$. So the question becomes: which point on the small sphere lies on a minimal path?
To make "small sphere" precise, we need $\exp_p$ to be a genuine local chart there. Choose $\delta > 0$ small enough that $\exp_p$ restricts to a diffeomorphism on the closed ball $\overline{B}(0, \delta) \subset T_p M$ — this is possible by the [Exponential Map as a Local Diffeomorphism](/theorems/2712) — and so that $\delta < r$, which we will need for the optimal-point theorem below. Both conditions hold for any sufficiently small $\delta$. We then define the geodesic sphere
\begin{align*}
S_\delta(p) := \{x \in M : d(x, p) = \delta\} = \exp_p(\{v \in T_p M : |v|_g = \delta\}),
\end{align*}
which is the diffeomorphic image of a Euclidean sphere of radius $\delta$, hence compact. The fact that the metric distance $\delta$-sphere coincides with the image of the Euclidean $\delta$-sphere is precisely what the diffeomorphism property of $\exp_p$ on $\overline{B}(0, \delta)$ buys us.
We can now invoke the [Optimal Point on a Geodesic Sphere](/theorems/2725). Its hypotheses: $0 < \delta < d(p, q)$, which we have arranged ($\delta < r$ and $r > 0$). The theorem produces $p_0 \in S_\delta(p)$ with
\begin{align*}
d(p, p_0) + d(p_0, q) = d(p, q) = r.
\end{align*}
Since $p_0 \in S_\delta(p)$ we have $d(p, p_0) = \delta$, so $d(p_0, q) = r - \delta$.
We now extract the candidate initial velocity. Write $p_0 = \exp_p(\delta v)$ for the unique $v \in T_p M$ with $|v|_g = 1$ — uniqueness holds because $\exp_p|_{\overline{B}(0, \delta)}$ is injective. This $v$ is the direction "pointing toward $p_0$" at $p$, and it is the only candidate that has any chance of producing a length-$r$ curve from $p$ to $q$. Define the candidate geodesic
\begin{align*}
\gamma : [0, \infty) &\to M \\
t &\mapsto \exp_p(t v).
\end{align*}
Why is $\gamma$ defined for all $t \geq 0$, not just for $t \in [0, \delta]$? Because the hypothesis of the theorem is that $\exp_p$ is defined on all of $T_p M$ — completeness of $\exp_p$ at $p$. This is essential: we will need to follow $\gamma$ all the way to time $t = r$, far past the diffeomorphism radius $\delta$. By [Geodesics Have Constant Speed](/theorems/2709), since $\dot\gamma(0) = v$ has $|v|_g = 1$, the curve $\gamma$ has constant unit speed.
The remaining task — taking up the rest of the proof — is to show $\gamma(r) = q$. The plan is to track the "remaining distance to $q$": define $A = \{t \in [0,r] : d(\gamma(t), q) = r - t\}$. The key facts will be that $A$ is non-empty, closed in $[0, r]$, and relatively open in $[0, r)$, which together force $A = [0, r]$.
[/guided]
[/step]
[step:Define the on-track set $A$ and verify $\delta \in A$]
Define
\begin{align*}
A := \{t \in [0, r] : d(\gamma(t), q) = r - t\}.
\end{align*}
Geometrically, $A$ records those parameter values for which the curve $\gamma|_{[0,t]}$, concatenated with a minimal path from $\gamma(t)$ to $q$, achieves the global distance $r$.
We claim $\delta \in A$. By [Geodesics Minimize Length Locally](/theorems/2720) applied to the diffeomorphic chart $\exp_p$ on $\overline{B}(0, \delta)$, the curve $\gamma|_{[0, \delta]}$ has length $\delta$ and is the unique minimal geodesic from $p$ to $\gamma(\delta) = p_0$. In particular $d(p, \gamma(\delta)) = \delta$. Combined with the optimal-point identity $d(p, p_0) + d(p_0, q) = r$:
\begin{align*}
d(\gamma(\delta), q) = d(p_0, q) = r - \delta,
\end{align*}
so $\delta \in A$. In particular $A \neq \varnothing$.
Note also that $0 \in A$ holds directly from the definition: $d(\gamma(0), q) = d(p, q) = r = r - 0$. We use $\delta$ rather than $0$ as the seed because it lets us apply the closedness and matching arguments uniformly on $[0, r]$ without separating out the case $t_0 = 0$.
[/step]
[step:Show that $A$ is closed in $[0, r]$]
The function
\begin{align*}
\Phi : [0, r] &\to \mathbb{R} \\
t &\mapsto d(\gamma(t), q) - (r - t)
\end{align*}
is continuous: $\gamma$ is continuous, $d(\cdot, q) : M \to \mathbb{R}$ is $1$-Lipschitz (hence continuous) by the triangle inequality, and $t \mapsto r - t$ is continuous. Since $A = \Phi^{-1}(\{0\})$ is the preimage of a closed set under a continuous function, $A$ is closed in $[0, r]$.
[/step]
[step:Show that $A \cap [0, r)$ is open in $[0, r)$ via a small-sphere matching argument]
Let $t_0 \in A \cap [0, r)$, so $d(\gamma(t_0), q) = r - t_0 > 0$. We show that some interval $[t_0, t_0 + \delta_0] \subseteq A$ for sufficiently small $\delta_0 > 0$. Combined with the closedness from the previous step, this will give the relative openness claim once we organise the argument as a connectedness argument in the next step.
Set $p' := \gamma(t_0)$. Since $\exp_{p'}$ is a local diffeomorphism near $0 \in T_{p'}M$ — by the [Exponential Map as a Local Diffeomorphism](/theorems/2712) — choose $\delta_0 \in (0, r - t_0)$ so that $\exp_{p'}$ restricts to a diffeomorphism on $\overline{B}(0, \delta_0) \subset T_{p'}M$. Since $\delta_0 < r - t_0 = d(p', q)$, the [Optimal Point on a Geodesic Sphere](/theorems/2725) applies at $p'$: there exists $p_0' \in S_{\delta_0}(p')$ with
\begin{align*}
d(p', p_0') + d(p_0', q) = d(p', q) = r - t_0.
\end{align*}
In particular $d(p_0', q) = r - t_0 - \delta_0$.
[claim:Coincidence of paths] The point $p_0'$ equals $\gamma(t_0 + \delta_0)$.
[proof]
Consider the broken curve $c$ from $p$ to $p_0'$ formed by concatenating $\gamma|_{[0, t_0]}$ (length $t_0$, since $\gamma$ has unit speed) with a minimal geodesic from $p'$ to $p_0'$ (length $\delta_0$, by the optimal-point construction). Then
\begin{align*}
\ell(c) = t_0 + \delta_0.
\end{align*}
On the other hand, by the triangle inequality and the optimal-point identities,
\begin{align*}
d(p, p_0') \geq d(p, q) - d(p_0', q) = r - (r - t_0 - \delta_0) = t_0 + \delta_0,
\end{align*}
so $d(p, p_0') \geq \ell(c) = t_0 + \delta_0$. Since $d(p, p_0') \leq \ell(c)$ always holds, we conclude $d(p, p_0') = t_0 + \delta_0$ and $c$ is a length-minimising piecewise smooth curve from $p$ to $p_0'$.
By [Minimal Geodesics Are Smooth Geodesics](/theorems/2721), every length-minimising unit-speed piecewise $C^1$ curve is a smooth geodesic — in particular, $c$ is smooth at the joining time $t_0$. Smoothness at $t_0$ means the geodesic equation holds there, so the velocities match: $\dot c(t_0^-) = \dot c(t_0^+) = \dot\gamma(t_0)$. By the local existence and uniqueness theorem for geodesics — geodesics with the same initial point and initial velocity agree on their common domain — the smooth geodesic continuation of $\gamma$ past $t_0$ coincides with the second leg of $c$ on $[t_0, t_0 + \delta_0]$. Hence $\gamma(t_0 + \delta_0) = p_0'$.
[/proof]
[/claim]
Using the claim,
\begin{align*}
d(\gamma(t_0 + \delta_0), q) = d(p_0', q) = r - t_0 - \delta_0 = r - (t_0 + \delta_0),
\end{align*}
so $t_0 + \delta_0 \in A$.
[guided]
This is the heart of the proof. We have $\gamma$ defined globally, and we know it is "on track" at time $t_0$, meaning $d(\gamma(t_0), q) = r - t_0 > 0$ (positive because $t_0 < r$). We want to show that, a small time later, $\gamma$ is still on track. The obstacle is that $\gamma$ is the geodesic with initial conditions at $p$, while the natural minimiser past $\gamma(t_0)$ is a geodesic with initial conditions at $p' := \gamma(t_0)$. We must show these two geodesics agree.
The bridge is a small geodesic sphere centred at $p'$. Pick $\delta_0 \in (0, r - t_0)$ so small that $\exp_{p'}$ restricts to a diffeomorphism on $\overline{B}(0, \delta_0) \subset T_{p'}M$. The first condition lets us apply the optimal-point theorem; the second makes $S_{\delta_0}(p')$ a genuine geodesic sphere via the [Exponential Map as a Local Diffeomorphism](/theorems/2712). Both hold for any sufficiently small $\delta_0$.
The hypotheses of the [Optimal Point on a Geodesic Sphere](/theorems/2725) at $p'$ are met: $\delta_0 < r - t_0 = d(p', q)$, and $S_{\delta_0}(p')$ is the image of the Euclidean $\delta_0$-sphere under $\exp_{p'}$. The theorem produces $p_0' \in S_{\delta_0}(p')$ with
\begin{align*}
d(p', p_0') + d(p_0', q) = d(p', q) = r - t_0.
\end{align*}
Since $p_0' \in S_{\delta_0}(p')$, we have $d(p', p_0') = \delta_0$, and therefore $d(p_0', q) = r - t_0 - \delta_0$.
Now compose two pieces into a broken curve $c$ from $p$ to $p_0'$: walk from $p$ to $p'$ along $\gamma|_{[0, t_0]}$ (length $t_0$, since $\gamma$ has unit speed), then from $p'$ to $p_0'$ along the minimal geodesic supplied by the optimal-point construction (length $\delta_0$). The total length is
\begin{align*}
\ell(c) = t_0 + \delta_0.
\end{align*}
Why does this curve actually achieve the distance $d(p, p_0')$? On the one hand, $d(p, p_0') \leq \ell(c) = t_0 + \delta_0$ from the existence of the broken curve. On the other hand, the triangle inequality and the optimal-point identity force the reverse:
\begin{align*}
d(p, p_0') \geq d(p, q) - d(p_0', q) = r - (r - t_0 - \delta_0) = t_0 + \delta_0.
\end{align*}
Combining, $d(p, p_0') = t_0 + \delta_0$ and $c$ is a length-minimising piecewise smooth curve from $p$ to $p_0'$.
The next move uses the regularity result [Minimal Geodesics Are Smooth Geodesics](/theorems/2721): a length-minimising unit-speed piecewise $C^1$ curve is in fact a smooth geodesic. Why does this matter here? Because $c$ has a potential corner at the joining time $t_0$ — the first leg is $\gamma$, with initial direction $v$ at $p$; the second leg is a different geodesic emanating from $p'$ in some direction $v' \in T_{p'}M$ a priori unrelated to $\dot\gamma(t_0)$. Smoothness of $c$ at $t_0$ forces the velocities to match: $\dot c(t_0^-) = \dot c(t_0^+) = \dot\gamma(t_0)$. By the local existence and uniqueness theorem for geodesics — geodesics with the same initial point and initial velocity agree on their common domain of definition — the second leg of $c$ on $[t_0, t_0 + \delta_0]$ is the continuation of $\gamma$. Therefore
\begin{align*}
\gamma(t_0 + \delta_0) = p_0'.
\end{align*}
Plugging in the optimal-point identity for $p_0'$:
\begin{align*}
d(\gamma(t_0 + \delta_0), q) = d(p_0', q) = r - t_0 - \delta_0 = r - (t_0 + \delta_0),
\end{align*}
so $t_0 + \delta_0 \in A$. At time $t_0 + \delta_0$, the curve $\gamma$ has reached the optimal point on the small sphere around $\gamma(t_0)$ — exactly the "still on track" condition we needed to propagate.
[/guided]
[/step]
[step:Use connectedness to conclude $r \in A$]
Define $T := \sup A$. We show $T = r$ and $T \in A$, so $\gamma(T) = \gamma(r)$ satisfies $d(\gamma(r), q) = 0$, i.e., $\gamma(r) = q$.
Since $A \neq \varnothing$ and $A \subseteq [0, r]$, we have $T \in [0, r]$. Closedness of $A$ in $[0, r]$ (Step 3) gives $T \in A$. Suppose for contradiction $T < r$. Then $T \in A \cap [0, r)$, so the previous step produces $\delta_0 > 0$ with $T + \delta_0 \in A$, contradicting $T = \sup A$. Hence $T = r$.
Therefore $r \in A$, meaning $d(\gamma(r), q) = 0$, so $\gamma(r) = q$.
[guided]
We have shown $A$ is non-empty, closed in $[0,r]$, and that whenever $t_0 \in A \cap [0, r)$ there is some $\delta_0 > 0$ with $t_0 + \delta_0 \in A$. The standard "open + closed + non-empty implies everything" argument runs as follows.
Let $T = \sup A$, an element of $[0, r]$. Closedness of $A$ means $T \in A$. If $T < r$, then $T \in A \cap [0, r)$, so the small-sphere argument from Step 4 produces $\delta_0 > 0$ with $T + \delta_0 \in A$. But $T + \delta_0 > T$ contradicts $T = \sup A$. Therefore $T = r$.
This is genuinely a connectedness argument: the small-sphere step prevents $T$ from being a strict sup, and closedness ensures $T \in A$ rather than only $T \in \bar A$. The interval $[0, r]$ being connected is what ties these together.
The conclusion is $r \in A$: $d(\gamma(r), q) = r - r = 0$, so $\gamma(r) = q$.
[/guided]
[/step]
[step:Conclude that $\gamma|_{[0, r]}$ is a minimal geodesic from $p$ to $q$]
The curve
\begin{align*}
\gamma|_{[0, r]} : [0, r] &\to M \\
t &\mapsto \exp_p(t v)
\end{align*}
is a unit-speed geodesic by construction (Step 1). It satisfies $\gamma(0) = p$ and $\gamma(r) = q$ by Step 5, so its length is
\begin{align*}
\ell(\gamma|_{[0, r]}) = \int_0^r |\dot\gamma(t)|_g \, d\mathcal{L}^1(t) = \int_0^r 1 \, d\mathcal{L}^1(t) = r = d(p, q).
\end{align*}
Since the length of any curve from $p$ to $q$ is at least $d(p, q) = r$, the curve $\gamma|_{[0, r]}$ achieves the minimum and is therefore a minimal geodesic from $p$ to $q$.
[/step]