# Gradient of distance-squared on Riemannian manifold

Problem:

Let $$M$$ be a Riemannian manifold. Consider the function $$f: M \rightarrow \mathbb{R}$$ where $$f(x)=\text{dist}_M^2(p,x)$$, and $$p \in M$$ is fixed. Show that $$\text{grad}(f)=-2\exp^{-1}_x(p)$$ as vectors in $$T_xM$$. (Assuming that $$\exp^{-1}$$ exists and is smooth etc.)

My attempt at a proof:

We must show that $$\langle -2\exp^{-1}_x(p), \cdot \rangle_x = df(\cdot)$$ as 1-forms at $$x$$.

Let $$e_1,\dots,e_n$$ be an orthonormal basis of $$T_pM$$ and introduce normal coordinates at $$p$$: $$x=(x^1,\dots,x^n) \leftrightarrow x=\exp_p(x^i e_i)$$. If $$q=\exp_p(v)$$ then $$\text{dist}_M (p,q)=||v||_p$$ and so $$f(x)=||x^i e_i||^2_p=\sum (x^i)^2$$, where the second equality follows from the fact that the metric is the identity at $$p$$ (in these coordinates).

So $$df=\sum 2x^i dx^i$$. $$(*)$$

On the other hand, the geodesic "from x to p" is the same as the geodesic "from p to x", except that the direction is reversed. It should therefore be true that $$p=\exp_x(-S_{p \rightarrow x}x^i e_i )=\exp_x(-x^i S_{p \rightarrow x} e_i)$$ where $$S_{p \rightarrow x}$$ is the parallel transport from $$p$$ to $$x$$. Hence $$\exp^{-1}_x(p)=-\sum x^i S_{p \rightarrow x} e_i$$. Hence $$\langle -2\exp^{-1}_x(p), \cdot \rangle_x=\langle 2x^i S_{p \rightarrow x}e_i, \cdot \rangle = 2x^i \langle S_{p \rightarrow x} e_i, \cdot \rangle = 2x^i dx_i$$ which gives the result on comparison with $$(*)$$. $$\square$$

My question:

When writing that out, I felt like I was manipulating symbols without really understanding what they mean. For example, when I write $$x^i$$ I'm not sure whether I mean the coordinate function $$x^i$$ or its particular value at the point $$x$$. I was also concerned that when I talk about parallel transport I should really have been talking about the derivative of $$\exp$$. There's a lemma in Do Carmo which states $$\langle (D\exp_p)_v(v),D\exp_p)_v(w)\rangle=\langle v,w \rangle$$ for $$v \in T_pM$$ and $$w \in T_v(T_pM) \simeq T_pM$$. I can see this might be useful, though I'm not sure precisely how.

I would appreciate it very much if you checked to see if this proof is correct and "expand it out", particularly the second half) including more details to make clear what is going on.

• This paper (Foote, "Regularity of the distance function", Proceed. AMS 1984) may help you. Oct 30, 2018 at 16:09

A straightforward computation one could do is : Let $$v\in (TM)_x$$. Let $$x(t)$$ be a curve such that $$x(0)=x$$ and $$x'(0)=v$$. Then $$df(x)(v)= \frac{d}{dt} d(p,x(t))^2|_{t=0}$$. Take a variation of the geodesic $$\gamma_0$$ joining $$p$$ to $$x$$, given by $$H(s,t)=\gamma_t(s)$$, where $$\gamma_t$$ is the geodesic joining $$p$$ to $$x(t)$$. Notice that $$\frac{d}{dt} d(p,x(t))^2|_{t=0}= 2 \frac{d}{dt} E(\gamma_t)|_{t=0}.$$ Use the first variation formula for energy (see for ex. Gallot Hulin Lafontaine) to find that $$\frac{d}{dt} E(\gamma_t)|_{t=0}=g(v,\gamma_0'(d(p,x))),$$ where $$g$$ is the metric. But $$\gamma_0'(d(p,x))$$ is the quantity we wanted to get. It follows now from the definition; $$g_x(\nabla(f),v)=df(x)(v)$$ for all $$v\in (TM)_x$$.

Here is another proof that uses the Gauss lemma which I believe is what you are referring to in do Carmo.

Let $$\gamma_t(s)$$ be a geodesic variation through with $$\gamma_0(0) = p, \gamma_0(1) = x$$ where we note that $$\frac{d}{dt}\bigg\vert_{t = 0}\gamma_0(t) = \dot{\gamma}(0) = \log_p(x)$$ by definition of $$\exp_p$$. By reversing the direction of this geodesic we find that $$\frac{d}{dt}\bigg\vert_{t = 0}\gamma_0(1-t) = -\dot{\gamma}(1) = \log_x(p)$$. This is exactly the statement that you wanted regarding parallel transport, the parallel transport of $$\dot{\gamma}(0)$$ along $$\gamma_0(t)$$ gives $$\dot{\gamma}(1)$$ at $$x$$ (as the velocity of a geodesic is parallel) which is equal to $$-\log_x(p)$$.

Take $$\frac{d}{ds}\gamma_s(1) = v$$. The squared distance function can be written as $$f(x) = d(x,p)^2 = \vert \log_p(x) \vert^2$$ so that $$df(v) = \frac{d}{ds}\bigg\vert_{s = 0}\vert \log_p(\gamma_s(1))\vert^2 = 2\langle \log_{p*}(v),\log_p(\gamma_0(1))\rangle_p$$ Note that as a function of $$s$$, $$\log_p(\gamma_s(1))$$ always lies in $$T_pM$$ and thus the inner product in this expression is the inner product of $$T_pM$$ and so it is as if we are working in $$\mathbb{R}^n$$ (points in $$T_pM$$ and tangent vectors can be canonically identified, justifying the last equality above). Under this canonical identification of a vector space and its tangent spaces we have $$\log_p(\gamma_0(1)) = \log_{p*}(\dot{\gamma}_0(1))$$ which can be seen by finding the coordinate expression for $$\gamma_0(t)$$ in normal coordinates.

Now we use the Gauss lemma, as $$\dot{\gamma}_0(1)$$ is a radial the Gauss lemma implies that

$$df(v) = 2\langle \log_{p*}(v),\log_p(\gamma_0(1))\rangle_p = 2\langle \log_{p*}(v),\log_{p*}(\dot{\gamma}_0(1)) \rangle_p = 2\langle v,\dot{\gamma}_0(1) \rangle_x$$ Thus $$\text{grad}(f) = 2\dot{\gamma}_0(1) = -2\log_x(p)$$ as desired.

Your proof looks to be more or less correct other than the last step which I believe requires some extra justification like the Gauss lemma. The reason being that the normal coordinate vector fields $$\partial_i$$ are not parallel in general (only the radial ones are!). We thus cannot conclude that the parallel transport of $$\partial_{i,p}$$ to $$x$$ is equal to $$\partial_{i,x}$$.

I just saw the question, here's my attempt at a proof, but I still need to think why (1) and (2) below are correct. I feel they are, but I need to justify, so I'm happy to receive justification of correction in case I'm wrong.

Steps:

1. I'll define what $$exp, log :=exp^{-1}$$ are in $$\mathbb{R}^m.$$
2. Prove the formula: $$\text{grad}(f)=-2\exp^{-1}_x(p)$$ for $$\mathbb{R}^m$$ first.
3. Use the normal coordinates to carry over the $$log^{\mathbb{R}^m}$$ to $$log^{M},$$ where $$log^{*}$$ denotes the $$log$$ maps for *, i.e. inverses of the $$exp$$ maps in the corresponding spaces. The assumptions (1) and (2) below are made at this very step and I'm a bit unsure if they're correct...

Steps 1) and 2):

Let's prove the formula in $$\mathbb{R}^n$$ first. Here $$d^2(y,z)=||y-z||^2, exp_{a}b=a+b, log_{a}b=b-a.$$ Take $$z=0, g(y):=||y||^2, \nabla{g}(y)=2y=-2(-y)=-2log_{y}(0)\equiv -2exp_{y}^{-1}(0).$$ Therefore, we established the formula in the Euclidean case.

Step 3):

Now let's work in the case of general Riemannian manifold $$(M,g), dim(M)=m.$$. Let $$p\in(M,g),$$ with its exponential map $$exp^{M},$$ log map $$log^{M}.$$ Pick a normal coordinate chart $$(U,\phi)$$ around $$p$$ so that $$U$$ is a $$\delta$$-uniformly normal neighborhood of $$p,$$ i.e. $$U\subset B(x,\delta) \forall x\in U$$ (such a $$\delta>0$$ exists, see for example, John Lee's book "Riemannian Manifolds: Introduction to curvature", Lemma 5.12, P.78). Let $$W:=\phi(U)\subset \mathbb{R}^m$$. [So here essentially we pick an ordered orthonormal basis $$(E_i)_{1\le i\le m},$$ of $$T_pM$$ and $$E:\mathbb{R}^m\to T_pM:= (x_1\dots x_m)\mapsto \sum_i{x_iE_i},$$ and then define $$\phi:U\to W:= \phi(x):=E^{-1}log^{M}(x)=:(x_1\dots x_m).$$]

Note that (I'm sure it's correct, but why exactly? By Gauss' lemma or radial isometry in a uniformly normal neighborhood?!)

$$log^{\mathbb{R}^m}\circ \phi = D\phi \circ log^{M}\dots (1)$$

Assuming the above is correct, the rest is easy:

Letting $$y:=\phi(x), d^2(x,p)=||y||^2, ||.||$$ meaning the Euclidean norm. Therefore,

$$D\phi_{x}(\nabla_{x}{d^2(x,p)})=\nabla_{y}||y||^2 \dots (2)$$ (why? Is this because: $$d^2(x,p)=||y||^2\implies$$ their differentials correspond, and hence their gradients do?)

Assuming the above is correct,

$$D\phi_{x}(\nabla_{x}{d^2(x,p)}) =-2log_{y}(0)$$ $$\implies \nabla_{x}{d^2(x,p)}$$ $$= D\phi_{x}^{-1}(-2log_{y}(0))$$ $$= -2 D\phi_{x}^{-1} (log_{y}(0))$$ (linearity) $$= -2 log_{\phi^{-1}(y)}{\phi^{-1}(0)}=-2log_{x}(p)$$ (applying (1) above, assuming correct)

This proves it.