Can someone explain:

how to take the Hessian of a function with respect to a riemannian metric? In other words, in Euclidean space, the hessian of a function $f: \mathbb{R}^n \to \mathbb{R}$ is simply $\text{Hess}f(x) = \nabla^2 f(x)$, what is the difference when I move to $(\mathbb{R}^n, g)$?

For instance:

suppose I have a manifold $(\mathbb{R}^n, g)$, $x \in \mathbb{R}^n$, where $g$ is given by $g_{ij} = \dfrac{1}{x_i}\delta_{ij}$. Then what is the Hessian of $f(x) = \sum\limits_{i = 1}^n x_i\log(x_i)$ with respect to this metric? Even better, if someone can tell me how to compute the gradient of $f$ under this metric!

Any reference on examples to compute the gradient and hessian of functions on Riemannian manifolds will be greatly appreciated!

Disclaimer: know almost nothing about riemannian geometry


2 Answers 2


On a Riemannian manifold $(M,g)$ the gradient $\text{grad} f$ of a real-valued function $f$ is the unique vector field satisfying $g(\text{grad} f, X) = \Bbb d f (X)$ for every tangent field $X$. Working in coordinates and letting $X = \partial_j$ we obtain

$$g\left( \sum_i (\text{grad} f)^i \partial_i, \partial_j \right) = (\Bbb d f) (\partial_j)$$

which means that

$$\sum_i (\text{grad} f)^i \ \underbrace{ g( \partial_i, \partial_j) } _{g_{ij}} = \frac {\partial f} {\partial x_j} ,$$

whence, if we multiply the equality by $(g^{ij})$, the matrix inverse to $(g_{ij})$, we get

$$(\text{grad} f)^i = \sum _j g^{ij} \frac {\partial f} {\partial x_j} ,$$

so that finally (and after an interchange of indices, for purely cosmetic reasons)

$$\text{grad} f = \sum _{i,j} g^{ij} \frac {\partial f} {\partial x_i} \partial _j.$$

Concerning the Hessian, remember that the metric $g$ gives birth to the Levi-Civita connection $\nabla$: according to Koszul's formula, $\nabla_X Y$ is the unique tangent field satisfying

$$g(\nabla _X Y, Z) = \frac 1 2 g \Big( X g(Y,Z) + Y g(Z,X) - Z g(X,Y) + g([X,Y],Z) - g([Y,Z],X) - g([Z,X],Y) \Big) .$$

Next, for $T$ a $p$-covariant tensor field, one defines

$$(\nabla T) (X_1, \dots, X_p, X) = (\nabla_X T) (X_1, \dots, X_p) = X \cdot \Big( T(X_1, \dots, X_p) \Big) - \\ T(\nabla_X X_1, X_2, \dots, X_p) - T(X_1, \nabla_X X_2, \dots, X_p) - \dots - T(X_1, X_2, \dots, X_{p-1}, \nabla_X X_p) .$$

This finally allows us to define the Hessian of $f$ as $\nabla^2 f = \nabla (\nabla f) = \nabla \Bbb d f$.


$$(\nabla^2 f) (Y,X) = (\nabla \Bbb d f) (Y,X) = (\nabla_X \Bbb d f) (Y) = X \cdot (\Bbb d f (Y)) - \Bbb d f (\nabla_X Y) .$$

In coordinates, taking $Y = \partial_i$ and $X = \partial_j$ and remembering that $\nabla_{\partial_i} \partial_j = \sum_k \Gamma_{ij}^k \partial_k$,

$$(\nabla^2 f) (\partial_i, \partial_j) = \partial_j (\partial_i f) - \Bbb d f (\sum_k \Gamma_{ji}^k \partial_k) = \frac {\partial^2 f} {\partial x_j \partial x_i} - \sum_k \Gamma_{ij} ^k \frac {\partial f} {\partial x_k} .$$

Remembering that the Euclidean metric has $\Gamma_{ij}^k = 0$ shows that in the Euclidean case we get what we already know from calculus.

An interesting fact is that the trace of the Hessian (after having raised an index with the help of $(g^{ij})$) is precisely the Beltrami Laplacian $\Delta f$.

  • $\begingroup$ Sorry, maybe a silly question: in $\text{grad} f = \sum _{i,j} g^{ij} \frac{\partial f}{\partial x_i} \partial_j$, what are $\frac{\partial f}{\partial x_i}$ and $\partial_j$? $\endgroup$
    – Migalobe
    Commented Feb 12, 2021 at 0:33

Hint: In smooth coordinates the gradient $\mathrm{grad}\ f$ has the expression $$\mathrm{grad}\ f = g^{ij} \frac{\partial f}{\partial x^i} \frac{\partial}{\partial x^j}$$

where $g^{ij}$ is the inverse matrix of $g_{ij}$. This is valid for any Riemmanian manifold $(M,g)$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .