TITLE: Can a Riemannian metric be analytic in non-analytically different coordinates?
QUESTION [14 upvotes]: Suppose I have two coordinates on the same (subset of a) Riemannian manifold.
If the metric tensor is analytic in both coordinates, is the change of variables between them necessarily analytic?
In other (and perhaps clearer) words, is this conjecture true?

Let $U,V\subset\mathbb R^n$ be domains.
  Let $g$ be a real-analytic Riemannian metric on $U$ and let $\phi\colon V\to U$ be a smooth diffeomorphism.
  If $\phi^*g$ is a real-analytic metric on $V$, then $\phi$ is real analytic.

I have not been able to prove this or find a counterexample.
The difficulty in using the formula for the metric pulled back over $\phi$,
$$
\phi^*g_{ij}(x)
=
\partial_i\phi^k(x)g_{kl}(\phi(x))\partial_j\phi^l(x),
$$
is that $\phi$ appears several times and in different ways in the right-hand side.
Taking determinants yields $\det(\phi^*g(x))=\det(g(\phi(x)))\det(D\phi(x))^2$, which might help if one could change coordinates analytically on $U$ so that $\det(g(y))$ is constant and show that analyticity of $\det(D\phi)$ implies analyticity of $\phi$.
(Compare this with the one-dimensional proof below.)
The claim is true if $n=1$, but I do not see how to generalize this argument:
A Riemannian metric on $\mathbb R$ is just a positive scalar function.
After a real-analytic change of coordinates on $U$ one can assume that $g\equiv1$ (Euclidean metric).
Then $\phi^*g(x)=\phi'(x)^2$.
Since this is analytic and $\phi'$ never vanishes, the function $\phi$ is analytic.

REPLY [21 votes]: The answer is yes — the change of variables between is necessarily analytic.
The harmonic functions have to be analytic in both of your coordinates. 
So you can pass from one of your coordinates to some harmonic coordinates 
and then pass from the harmonic coordinates to the other of your coordinates.
P.S. This idea is due to Shefel, and it was rediscovered independently by DeTurck and Kazdan. See correspondingly

Шефель, С. З. "Конформное соответствие метрик и гладкость изометрических погружений." Сибирский математический журнал 20.2 (1979): 397—401.
Dennis DeTurck, Jerry Kazdan
Some regularity theorems in Riemannian geometry.
Ann. Sci. École Norm. Sup. (4) 14 (1981), no. 3, 249–260.