When does the Hessian on a Riemannian manifold vanish? The Hessian tensor of a smooth function $f:M\rightarrow \mathbb{R}$ on a Riemannian manifold $M$ with respect to the Levi-Civita connection $\nabla$ is given, globally and in local coordinates $\{x^i\}$, as:
$$H(f)=\nabla(\nabla f) = \left( \frac{\partial^2 f}{\partial x^i \partial x^j} - \Gamma_{ij}^k \frac{\partial f}{\partial x^k} \right) dx^i \otimes dx^j$$
My question is: when does the Hessian vanish identically on the entire manifold? More generally, what does it mean for the Hessian of $f$ to have small "global value,"
$$\mathcal{H}(f) := \int_{p\in M} \lVert H(f)_p \rVert^2 d\mu(p)$$ (for some appropriate tensor norm)? Of course, $\mathcal{H}(c)=0$ for the constants; my intuition is that $\mathcal{H}$ should be a measure of how nonlinear or curvy $f$ is. For example, for $M$ isometric to a subset of $\mathbb{R}^n$, the nullspace of $\mathcal{H}$ with the Frobenius norm is spanned by the linear functions, which forms the basis of the Hessian Eigenmap algorithm. I was wondering how these ideas extend to, say, flat manifolds which are not subspaces of $\mathbb{R}^n$, or non-flat manifolds in general (where to my knowledge the Frobenius norm in local coordinates is not even well-defined).
 A: Throughout, assume $M$ is connected and $n$-dimensional.
Note that a function $f$ of vanishing Hessian is uniquely determined by its value and derivative at a single point $f(p),d_pf$. This means that the space of "linear" functions has dimension at most $n+1$. However, it is often the case that there are no nonconstant functions with vanishing Hessian. In order for such functions to exist, $M$ must be locally isometric to a Riemannian product of an $n-1$ dimensional manifold and a $1$-dimensional one, putting significant restrictions on curvature (see here). Even if this splitting is possible, there are also global obstructions. One special case where you do get the full $n+1$-dimensonal set is when $M$ is flat and simply connected.
As for the integral $\mathcal{H}(f)$, it is not guranteed to converge at all, but when it does, we can note that $\mathcal{H}(cf+b)=c\mathcal{H}(f)$ for $c,b\in\mathbb{R}$, so you can obtain lots of functions with arbitrarily small $\mathcal{H}(f)$ simply by finding functions for which $\mathcal{H}(f)$ converges (e.g. compactly supported ones as noted in Ivo Terek's comment) and scaling.
Edit: A note on the flat case
If $M$ is flat, then the fundamental group $\pi_1(M,p)$ acts on $M$ by Euclidean transformations: given a loop $\gamma:[0,1]\to M$ based at $p$, we define $[\gamma]\cdot v=V(1)$, where $V$ is a vector field along $\gamma$ satisfying $V(0)=v$, $\dot{V}=\dot{\gamma}$. $d_pf$ must be invariant under this action, in that $d_pf(v)=d_pf([\gamma]\cdot v)$. In particular, the Hessian has the full $n+1$ dimensional kernel iff this action is trivial (it turns out this occurs iff $M$ can be isometrically immersed in $\mathbb{R}^n$). This is the only obstruction in the flat case, but this action tends to have few invariant 1-forms (e.g. none for flat compact space forms).
