Chain rule for gradient on a Riemannian manifold

I have that $f$ and $h$ are two smooth functions on a Riemannian manifold $(M,g)$ and am told that $$\int_M\langle\nabla f,\nabla|\nabla h|^4\rangle_g\,dv_g = \int_M 4|\nabla h|^2\,\nabla^2h\big(\nabla f,\nabla h\big)\,dv_g.$$ It seems that this follows from some sort of chain rule on $\nabla|\nabla h|^4$, but I don't understand how the inner product $\langle\cdot,\cdot\rangle_g$ in the integral on the left becomes the action of the Hessian $\nabla^2h$ on the vectors $\nabla f$ and $\nabla h$ in the integral on the right. Could someone please explain what is going on here, perhaps in more generality than just this particular example - I can't seem to find anything online corresponding to 'chain rule for gradient on Riemannian manifolds'. Thanks in advance.

• Do either or both of $f, h$ have compact support? If so then this is a consequence of the Divergence theorem. – Kevin Feb 9 '18 at 13:00
• @Kevin the manifold is without boundary so in the divergence theorem there would be no boundary terms. But I still don't understand exactly how it follows? – kt77 Feb 9 '18 at 13:39
• Looks to me like no integration by parts is necessary - this should be a pointwise identity. Start by applying the usual chain rule to write $\nabla \left((|\nabla h|^2)^2\right)$ in terms of $\nabla |\nabla h|^2 = \nabla\langle\nabla h,\nabla h\rangle,$ and then expand the latter using metric compatibility. – Anthony Carapetis Feb 10 '18 at 4:30
• @AnthonyCarapetis I still don't understand how the Hessian comes in and the inner product disappears. Applying the chain rule I get $\nabla\big( (|\nabla h|^2)^2\big) = 2|\nabla h|^2\nabla\langle\nabla h,\nabla h\rangle$ and thus $\langle\nabla f,\nabla|\nabla h|^4\rangle = \langle\nabla f,2|\nabla h|^2\nabla\langle\nabla h,\nabla h\rangle\rangle$. I'm not sure how using metric compatibility here then helps? In fact I'm not even sure how to apply it here (I know it in the form $D_Z\langle X,Y\rangle = \langle\nabla_Z X,Y\rangle + \langle X,\nabla_Z Y\rangle$). – kt77 Feb 10 '18 at 16:54

I think the main confusion here is in the various ways the symbol $\nabla$ is being used: it's simultaneously the differential, gradient and covariant derivative. Inner products can appear/disappear when we swap differentials for gradients. This usage is very standard in Riemannian geometry (and the different interpretations of any expression turn out to be equal thanks to metric-compatibility), but for the purposes of learning it's helpful to start with different notations. Thus I would instead write this equation as $$\def\g{\operatorname{grad}}\def\n{\nabla}\def\ip#1#2{\left\langle #1, #2 \right\rangle} \ip{\g f}{\g |d h|^4} = 4 |d h|^2 \,\operatorname{Hess} h(\g f, \g h).\tag 1$$
Here the one-form $dh$ is the usual differential of a function, the vector $\g h$ is the gradient defined by $\ip{\g h}X = dh(X)=D_X h$ and $\operatorname{Hess}h(X,Y)=(\n \n h)(X,Y) = \ip{\n_X \g h}{Y}$ is the Hessian.
To show this identity, first note that by definition of the gradient we have $$\ip{\g f}{ \g |dh|^4}=d(|dh|^4)(\g f) = D_{\g f}(|dh|^4).\tag 2$$ Applying the chain rule to $|dh|^4 = (|dh|^2)^2$ yields $$d(|dh|^4)=2|dh|^2 d\ip{\g h}{\g h}$$ since $\left|\g h\right|=|dh|$; so $$D_X(|dh|^4)=2|dh|^2D_X\ip{\g h}{\g h}=4|dh|^2\ip{\nabla_X \g h}{\g h}$$ by metric compatibility. Recognizing the Hessian here, we can write this as $$D_X(|dh|^4)=4|dh|^2\operatorname{Hess} h(X,\g h).$$Now just substitute $X = \g f$ and combine with $(2)$ to arrive at $(1).$