Characterization of geodesics by distance function Let $ M $ be a Riemannian manifold. The length of a piecewise smooth curve $ \gamma\colon [a, b] \to M $ is defined by
$$
L(\gamma) = \int_a^b \lvert \gamma'(t) \rvert \,dt,
$$
and the distance function on $ M $ is defined by
$$
d(p, q) = \inf \{L(\gamma) \mid \text{$ \gamma $ is a piecewise smooth curve from $ p $ to $ q $}\}
$$
for $ p $, $ q \in M $.
Question. Let $ \gamma\colon [a, b] \to M $ be a (not necessarily smooth) map. If $ d(\gamma(s), \gamma(t)) = \lvert s - t \rvert $ for all $ s $, $ t \in [a, b] $, is $ \gamma $ a unit-speed geodesic?
Background. I have read the proof that minimizing curves with constant speed are geodesics and that geodesics are locally minimizing in J. M. Lee’s Introduction to Riemannian Manifolds (2nd edition). Now I wonder if geodesics can be characterized using the distance function.
 A: I consulted with my friend in university and got the answer.
Suppose that $ 0 $ is an interior point of $ [a, b] $. We will prove that $ \gamma $ is a unit-speed geodesic in a neighborhood of $ 0 $. (We can prove it in the same way when $ 0 $ is an end point of $ [a, b] $.) Fix a sufficiently small number $ \epsilon > 0 $ so that $ [-\epsilon, \epsilon] \subseteq [a, b] $ and that $ \operatorname{Exp}_p $ and $ \operatorname{Exp}_q $ are defined on the closed $ 2\epsilon $-balls where $ p = \gamma(-\epsilon) $ and $ q = \gamma(\epsilon) $. Since $ d(p, q) = 2\epsilon $, there is a unique unit-speed minimizing curve $ \widetilde{\gamma}\colon [-\epsilon, \epsilon] \to M $ from $ p $ to $ q $.
Take $ t \in [-\epsilon, \epsilon] $ arbitarily. Since $ d(p, \gamma(t)) = \epsilon + t \leq 2\epsilon $ and $ d(\gamma(t), q) = \epsilon - t \leq 2\epsilon $, there are a unit-speed minimizing curve $ \widetilde{\gamma}_1\colon [-\epsilon, t] \to M $ from $ p $ to $ \gamma(t) $ and a unit-speed minimizing curve $ \widetilde{\gamma}_2\colon [t, \epsilon] \to M $ from $ \gamma(t) $ to $ M $. The concatenation of $ \widetilde{\gamma}_1 $ and $ \widetilde{\gamma}_2 $ is also a unit-speed minimizing curve from $ p $ to $ q $ and hence coincides with $ \widetilde{\gamma} $. Especially, $ \gamma(t) = \widetilde{\gamma}(t) $. This proves the claim.
