Worst case examples of non-differentiability of the Riemannian distance function
Solution 1:
No, the closure of $X$ has locally finite $1$-dimensional measure. Indeed, the set of non-differentiability points is contained in the cut locus of $p$, which is a closed set. It was proved by Hebda and Itoh that the intersection of cut locus with every compact set has finite $1$-dimensional measure. See
- Hebda, James J. Metric structure of cut loci in surfaces and Ambrose's problem. J. Differential Geom. 40 (1994), no. 3, 621–642.
- Itoh, Jin-ichi. The length of a cut locus on a surface and Ambrose's problem. J. Differential Geom. 43 (1996), no. 3, 642–651.
Both papers (and other related literature) are referenced in the paper The Lipschitz continuity of the distance function to the cut locus by Itoh and Tanaka, where the result is extended to arbitrary dimensions, and to cut locus of a submanifold (which could be a point). This paper is in free access.
Solution 2:
First, I think this question is more suitable for www.mathoverflow.net
I will consider the general setting of a Riemannian manifold $M$ (of arbitrary dimension and topology). Define the non-smoothness set $N(p)$ set of the distance function $d(p, x)$ (with fixed $p$), the cut-locus $C(p)$ of the point $p$ and the set $NU(p)$ consisting of points $q\in M$ such that the minimizing geodesic segment connecting $p$ to $q$ is non-unique. It is clear that $$ N(p)\subset NU(p). $$ Quite a bit is known about $C(p)$, some of the results are summarized in Berger's book "Riemannian Geometry During the Second Half of the Twentieth Century" (page 113). In particular, it is known that $$ C(p)= \overline{NU(p)}. $$ From this, it is easy to see that $N(p)$ is contained in a closed set of zero measure and, hence, the answer to your question is negative. Berger further cites a result by Gluck and Singer that $C(p)$ can, in general, be non-triangulable.