Distance on the sphere is convex

Let $$\mathbb{S}^n$$ be the unit sphere and choose $$p_0$$ as the north pole. Consider the function $$d:\mathbb{S}^n \to [0, \infty)$$ defined by $$d(p) = d(p,p_0) = \cos^{-1}( \langle p, p_0 \rangle)$$. It is the intrinsec distance to $$p_0$$ in the sphere. Is this function convex?

In order to answer this question, we have to show that $$d \circ \gamma$$ is a convex function of a real variable, for any geodesic $$\gamma$$ of the sphere. I showed it for geodesics issuing from $$p_0$$. Is it enough?

• Sorry. Geodesics through $p_0$ tell you only how the function behaves as you move away from $p_0$. They do not tell you how it behaves in other directions. – Paul Sinclair Apr 3 at 0:53
• Thank you for your comment. Do you believe that $d$ is convex? – Eduardo Longa Apr 3 at 1:08
• Look at $\Bbb S^2$ first. Consider a great circle slanted at 45 degrees. Calculate your function as a function of $\theta$ around the circle. Is that function convex everywhere? – Paul Sinclair Apr 3 at 1:13

Consider $$p,\ q$$ in $$\mathbb{S}^2$$. When $$c(t)$$ is unit speed geodesic starting at $$q$$, then $$f(t)=|p-c(t)|$$ so that Cosine law is $$\cos\ f=\cos\ t\cos\ l +\sin\ t\sin\ l\cos\ \alpha$$ where $$l=|p-q|$$ and $$\alpha =\angle\ ({\rm Dir}\ [qp],c'(0) )$$ (Here $${\rm Dir}$$ is a direction)
Hence $$-\cos\ f=(\cos\ f)''=(-\sin\ ff')'=-\cos\ f(f')^2-\sin\ ff''$$
Here $$f'=-\cos\ \alpha$$ so that $$f'' =\cot\ f\sin^2 \alpha$$
When $$f <\frac{\pi}{2}$$, then $$f$$ is convex.