# Hessian and metric tensors on riemannian manifolds

First, a bit of notation (I'm assuming Einstein's convention on summation of index):

$\text{Hessian}(f):=\nabla^2(f):=\nabla\nabla(f)=\left(\partial_i\partial_j(f)-\Gamma_{ij}^k\partial_k(f)\right)dx^i\otimes dx^j$

Where $\nabla$ is the Levi-Civita connection on a riemannian manifold $(M,g)$ and $\Gamma$ are the Christoffel symbols. By definition and a bit of computation, it is easy to note that $\nabla^2(f)\in\ \text{TM}^*\otimes\text{TM}^*$, as $g$, the metric tensor. My questions are:

As it never been analyzed the function $f:\nabla^2(f)=g$ for a general manifold (that is: we can associate to a function $f$ a metric, but can we do the opposite in general?) How? Has this $f$ any kind of application? If so, where?

I would really appreciate any kind of suggestion, expecially books or articles (I've found something, like https://arxiv.org/pdf/1312.1103.pdf, but is a bit too advanced for me, talking about transformations I haven't studied yet).

If $\nabla^2 f = g$ then we have $\nabla^3 f = 0$ (because $\nabla g=0$), so the Ricci identity tells us that $$R(\cdot, \cdot,\nabla f,\cdot) = 0.$$ Thus, for many choices of $g$ we can immediately rule out finding such an $f$: for example, if $g$ has all non-zero sectional curvatures in some neighbourhood, we can only satisfy this equation if $\nabla f=0$ there, but then of course $\nabla^2 f = 0\ne g.$
It might be possible to engineer interesting pairs $(f,g)$ together to avoid this problem—some solutions exist, like the obvious $f=\frac12 |x|^2$ on $(\mathbb R^n,dx_1^2+\cdots+dx_n^2)$—but I would expect that the obstruction due to curvature is fairly generic if you just pick a random $g$.
A particularly concrete case is when $M$ is compact: then we have $\int_M \Delta f = 0,$ which contradicts $\Delta f = \operatorname{tr}_g \nabla^2 f = n>0,$ so there are no solutions. This idea should also rule out solutions whenever $M$ contains a compact minimal submanifold.