TITLE: An unusual metric reconstruction problem
QUESTION [6 upvotes]: $\newcommand{\bR}{\mathbb{R}}\newcommand{\pa}{\partial}$This questions has some nebulous roots in Morse theory. The most general version goes as follows. Fix an integer $n\geq 2$. Suppose that we have a smooth function  $f$ defined on an open neighborhood $U$ of $0$ in $\bR^n$. To a smooth Riemannian metric $g$ defined on  $U$  we associated the gradient $\nabla^g f$.  

For which smooth functions  $f$ is the correspondence 
$$g\mapsto \nabla^g f $$
injective, i.e., from the  knowledge that $\nabla^{g_0} f=\nabla^{g_1} f$
  on $U$ we can conclude that $g_0=g_1$ on some neighborhood $V$ of
  $0$ in $\bR^n$, $V\subset U$.

Clearly, the above correspondence is not injective if $f\equiv const$, or $f(x)$ is linear in $x$.
The next interesting case is when $q$ is quadratic.  Suppose that
$$
f(x)=q(x):=\frac{1}{2}(x_1^2+\cdots +x_n^2).
 $$
Denote by $g_0$ the canonical Euclidean metric on $\bR^n$ so that
$$\nabla^{g_0}q =\sum_i x_i\pa_{x_i}. $$
The special case of the question goes as follows. 

If $g$ is a real analytic Riemann metric defined on a neighborhood $U$
  of $0$ and  $\nabla^g q(x)= \nabla^{g_0} q(x)$, $\forall x\in U$, can
  we conclude that  $g=g_0$ in a neighborhood of $0$?

I was not able to track results of this kind in the literature, and  I would appreciate any   pointers.

REPLY [9 votes]: If $V$ is a vector field such that $Vf=0$ at every point, then the 2-tensor
$$
h^{ij}=g^{ij}+V^iV^j
$$
is also an inverse metric and satisfies $\nabla^gf=\nabla^hf$.
In a coordinate chart this amounts to finding a vector field orthogonal (in the Euclidean sense on the chart) pointwise orthogonal to the gradient of $f$.
In the case of your second example such a vector field has to vanish at the origin but need not vanish elsewhere.
Examples of such vector fields are not hard to find.
Just take $V=(\partial_2f,-\partial_1f,0,\dots,0)$ and change the indices if needed.
If this simple idea doesn't give a nonzero vector field, then $\nabla f\equiv0$ and any $V$ will do.
In any neighborhood one can find a nonzero vector field and therefore a distinct metric with the same gradient of $f$.
Therefore one function $f$ is never enough.
If you have a collection of functions, you need any vector field orthogonal to every one of them to vanish identically.
You need at least $n$ functions in $n$ dimensions.
If you take a non-analytic function $f$ and ask the question for analytic metrics, the answer may be different, but that's another story…