Derivative of distance function on a Riemannian manifold. While reading Andrews and Hopper's book on Ricci flow, I found the following computation which I am not able to verify.
$M$ is a compact Riemannian manifold and $p \in M$ and $r>0$. We are interested in the function $\psi(x) = \phi\left(\frac{d_{g}(x,p)}{r}\right)$. Here $\phi$ is a smooth bump function $\phi: [0,\infty) \to \mathbb{R}$ with the following properties.

*

*$\phi = 1$ on $[0,1/2]$.

*$\phi = 0$ on $[1,\infty)$.

*$|\phi'| \leq 3$ on $[1/2,1]$.

Now we want to compute the derivative of $\psi$. Claim is that $|\nabla \psi| \leq \frac{1}{r} \sup |\phi'|$.
I assumed $r$ is small enough so that $B(p,r)$ lies in a normal neighborhood around $p$, then $d_{g}(p,x)= \sqrt{x_{1}^{2} + \dots + x_{n}^{2}}$ in normal coordinates around $p$. Then I see that
$$
\frac{\partial \psi}{\partial x_{i}} = \frac{1}{r}\phi'\left( \frac{d_{g}(x,p)}{r}\right) \frac{x_{i}}{\sqrt{x_{1}^{2} + \dots + x_{n}^{2}}}.
$$
Thus
$$
|\nabla \psi|^{2} = g^{ij}(x)\frac{\partial \psi}{\partial x_{i}} \frac{\partial \psi}{\partial x_{j}} = \frac{1}{r^{2}}\phi'\left(\frac{d_{g}(x,p)}{r}\right)^{2}\frac{g^{ij}(x)x_{i}x_{j}}{x_{1}^{2} + \dots + x_{n}^{2}}.
$$
I don't know how to go forward. I tried working in normal coordinates around $x$, that didn't seem to work either.
Also, I am not sure how to deal with the derivative of the distance function if $x$ is not in a normal neighborhood of $p$.
 A: Another more intuitive (and coordinate free) way to see this: Since $\psi (x) = \phi \left( \frac{d(x, p)}{r}\right)$,
$$\nabla \psi = \phi' \left(\frac{d(x, p)}{r}\right) \cdot \frac{\nabla d}{r}$$
So it suffices to show that $|\nabla d|\le 1$. This follows from triangle inequality: Let $v\in T_xM$. Then $\gamma (t) = \exp_x (tv)$ is a curve on $M$ with $\gamma(0) = x$, $\gamma'(0) = v$. Then
\begin{align*}
\langle \nabla d, v\rangle &= \frac{d}{dt} d(p, \gamma(t))\bigg|_{t=0} \\
&= \lim_{t\to 0} \frac{d(p, \gamma(t)) - d(p, x)}{t}
\end{align*}
Since by triangle inequality,
$$\left|\frac{d(p, \gamma(t)) - d(p, x)}{t}\right| \le \frac{d(x, \gamma(t))}{|t|} = \frac{|t|\| v\|}{|t|} = \|v\|$$
we have
$$ |\langle \nabla d, v\rangle| \le \|v\|\Rightarrow |\nabla d| \le 1$$
(e.g. by picking $v = \nabla d$).
We use nothing but that the distance function $d(\cdot, p)$ is Lipschitz with Lipschitz constant $1$. This already implies that the gradient is $\le 1$.
A: The answers above of course do the job. Another nice way to prove that the gradient of the distance function has norm one is to use the first variation formula, and like Arctic Char's answer, this also works at all points where the distance function is differentiable. Moreover one gets an explicit formula for the gradient as the velocity vector of a minimal unit speed geodesic. It is well known that the distance function $d_p(x):= d(p,x)$ is differentiable precisely at those points $x\in M\setminus \{p\}$ which can be connected to $p$ be a unique minimal geodesic. For simplicity let us just work away from the cut locus so that $d_p$ is in fact smooth. Suppose $x$ is one such point and $\gamma_x:[0,d_p(x)]\rightarrow M$ is the unique unit speed minimal geodesic from $p$ to $x$. Then we claim that $$\nabla d_p (x) = \gamma_x'(d_p(x)).$$ In particular, $|\nabla d_p(x)| = 1$ since $\gamma_x$ is chosen to be unit speed. Let us now prove the claim. Let $v\in T_xM$ be an arbitrary unit vector. Since the cut-locus is closed, there exists a $\sigma:(-\varepsilon,\varepsilon)\rightarrow M$ such that $\sigma(0) = x$, $\sigma'(0) = v$ and such that there exists a unique minimal geodesic $\gamma_{s}:[0,d_p(x)]\rightarrow M$ from $p$ to $\sigma(s)$ for all $s\in (-\varepsilon,\varepsilon)$. Then $\Gamma(s,t) = \gamma_s(t)$ is a variation of $\gamma(t)$ through geodesics. Moreover $\Gamma(s,0) = p$ for all $s$. We now compute
\begin{align*}
\langle\nabla d_p(x),v\rangle &= \frac{d}{ds}\Big|_{s=0}d_p(\sigma(s))\\
& = \frac{d}{ds}\Big|_{s=0}\mathcal{L}(\gamma_s)\\
&= \langle \dot\gamma(d_p(x)),v\rangle + \int_0^{d_p(x)}\langle\mathcal{D}_t\gamma_x,v\rangle\\
&= \langle \dot\gamma(d_p(x)),v\rangle.
\end{align*}
Here $\mathcal{L}$ is the length functional and we use the first variation formula in the third line. This shows that $$\langle\nabla d_p(x),v\rangle =\langle \dot\gamma(d_p(x)),v\rangle $$ for all unit tangent vectors $v\in T_xM$ and hence the claim is proved.
A: You've almost completed the computation. The last step is noting that in normal coordinates the radial vector field $\frac{\partial}{\partial r}=\frac{x_i}{\sqrt{x_1^2+\dots+x_n^2}}\frac{\partial}{\partial x_i}$ is a has unit magnitude (because it is the velocity of a unit speed geodesic). Thus, the second term in your expression $\frac{g^{ij}x_ix_j}{x_1^2+\dots+x_n^2}$ is equal to $1$.
