TITLE: Is it possible for a metric on a smooth manifold to be smooth?
QUESTION [25 upvotes]: Are there any smooth manifolds $M$ with the following property:
There exist a realizing metric $d$ (i.e $d$ induces the topology on $M$), and $d$ is smooth on all of $M \times M$? 
If not, is it  possibe to guarantee smoothness of the function $x \mapsto d(x,y)$ (for a fixed $y$ ), or smoothness of $d^2$ even on a compact manifold?
(I am trying to see if we can achieve "improved smoothness" if we do not force the metric to be Riemannian.) 
Of course, such a metric cannot be induced by a Riemannian metric.
(see here and here).
Update and further questions:
(1) Joonas Ilmavirta showed $d$ cannot be smooth at a neighbourhood of points on the diagonal. Actually, the proof shows $d$ cannot even be twice continuously differentiable. (This is the regularity needed to bound from above the Taylor remainder*).
Now a natural quesion is whether this regularity can be achieved by some metric? (I suspect not, in fact I think the distance should not even be differentiable once at the diagonal, the intuition is based on the example of absolute value on $\mathbb{R}$).
(2) Is it also necessary for a singularity to exist at the diameter of the metric (for compact manifolds)?

*In fact the proof works even if we only assume $x \mapsto d(x,y)$ is continuously twice differentiable, and continuity of the partial derivatives (as functions of two variables).
$ \frac{d}{dt}f(t,t) = \lim_{\Delta \to 0} \frac {f(t+\Delta,t+\Delta)-f(t,t)}{\Delta} = \lim_{\Delta \to 0} \left( \frac {f(t+\Delta,t+\Delta)-f(t+\Delta,t)}{\Delta} + \frac {f(t+\Delta,t)-f(t,t)}{\Delta} \right) = \lim_{\Delta \to 0} \left( \frac {f(t+\Delta,t+\Delta)-f(t+\Delta,t)}{\Delta} + \frac {f(t+\Delta,t)-f(t,t)}{\Delta} \right) = \lim_{\Delta \to 0} \frac{\partial f}{\partial s}(t+\Delta,t+\alpha(\Delta) \cdot \Delta) + \lim_{\Delta \to 0} \frac{\partial f}{\partial t}(t+\beta(\Delta) \cdot \Delta,t) = \frac{\partial f}{\partial s} (t,t) + \frac{\partial f}{\partial t} (t,t)$
($0 \le \alpha(\Delta), \beta(\Delta) \le 1$ , Lagrange mean value theorem)

REPLY [49 votes]: In short:
Non-smoothness at the diagonal is inevitable but that is the only obstruction.
(I added the second part much later.)
Diagonal singularity
It is not possible to have a smooth metric.
Non-smoothness at the diagonal is inevitable.
In fact, any smooth semimetric is zero whenever the two points are in the same connected component.
Suppose you had such a metric on a manifold $M$.
Take a smooth curve $\gamma:(-1,1)\to M$ with $\gamma'\neq0$.
Consider the function $f(t,s)=d(\gamma(t),\gamma(s))$, which is now smooth.
Since
$$
\begin{split}
0
&=
\frac{d}{dt}0
\\&=
\frac{d}{dt}f(t,t)
\\&=
\partial_1f(t,t)+\partial_2f(t,t),
\end{split}
$$
we have $\partial_1f=-\partial_2f$ on the diagonal.
But since $f(t,s)=f(s,t)$, we also have $\partial_1f=\partial_2f$ on the diagonal.
Thus $\partial_1f(t,t)=\partial_2f(t,t)=0$.
This implies that $f(t,s)\leq C(t-s)^2$ for some constant $C$, for all $t,s\in[-1/2,1/2]$.
Pick any number $a\in[0,\frac12]$ and a large integer $N$ and observe that by triangle inequality
$$
\begin{split}
f(0,a)
&\leq
f(0,\frac{a}{N})+f(\frac{a}{N},\frac{2a}{N})+\dots+f(\frac{(N-1)a}{N},a)
\\&\leq
NC\left(\frac aN\right)^2
\\&=
\frac{Ca^2}{N}.
\end{split}
$$
This holds for any $N$, so in fact $f(0,a)=0$.
This implies that as long as $x,y\in M$ are in the same connected component, they must satisfy $d(x,y)=0$.
In fact, this argument works for any $C^{1,\alpha}$ semimetric for $\alpha>0$ (a similar calculation leads to an estimate $f(0,a)\lesssim N^{-\alpha}$), and I guess the claim is true for $C^1$, too.
Off-diagonal regularity
For any differentiable manifold $M$ there is a metric $d\colon M\times M\to\mathbb R$ which is smooth everywhere outside the diagonal and gives the usual topology of $M$.
This is based on two observations:

There is a Riemannian metric $g$ on $M$ with injectivity radius at least one.
(If I am mistaken, this is at least possible on compact manifolds. On non-compact manifolds one should be able to start with any metric and multiply it with a slowly varying conformal factor to force injectivity radius above one everywhere.)
There is a smooth concave function $\phi\colon[0,\infty)\to[0,\infty]$ so that $\phi(0)=0$ and $\phi(x)=1$ for $x\geq1$.

Now if $d_g$ is the distance function of $g$, the metric $d(x,y)=\phi(d_g(x,y))$ is smooth outside the diagonal.
The distance from $x$ to nearby points is smooth (except at $x$) within the injectivity radius.
Outside that radius $d_g$ may be singular, but $\phi$ is constant at that scale, removing all singularities from $d$.
The composition of a metric and a concave function is always a metric.
It follows from the assumptions that $\phi$ is a strictly increasing bi-Lipschitz diffeomorphism in some neighborhood of zero, and thus $d$ and $d_g$ give the same topologies.
Any Riemannian metric gives the original manifold topology.
The metric $d$ is non-smooth at the diagonal, but its square $d^2$ is smooth everywhere.