Let $(M^n,g)$ be a smooth Riemannian manifold. The distance between two points is the infimum of the lengths of the curves which join the points. Consider the square of the distance function
$d^2\colon M\times M\to \mathbb{R}$
Why is the square of the distance function infinitely smooth near the diagonal?
In other words why does, for all $p \in M$, there exists a neighborhood $U$ of $p$ such that for all $x,y\in U$, $d^2(x,y)$ is infinitely smooth on $U\times U$.
I saw this fact here and it is supposed to be easy but I can't work this out or find a proof of it... If one of the response on the other post actually anwsers the question I would love to have some precisions.
Any help would be appreciated! Thanks.