Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a function that that takes a matrix and returns a scalar, $f : \mathbb{R}^{m\times n} \rightarrow \mathbb{R}$. I know how to calculate the derivative of this function with respect to the matrix argument. For example, if $f(X) = -\log \det X$, then $\nabla_X f(X) = -X^{-1}$. If $f(X) = tr(X^{-1} Y)$, $\nabla_X f(X) = -X^{-1} Y X^{-1}$ (assuming $X$ and $Y$ are symmetric for now).

What I don't know how to do is compute the second derivative (Hessian?) of $f$ with respect to $X$. I'm assuming it'll be messy, as the result might require four indices, if I'm not mistaken?

Here's the reason I'm curious: I'm trying to prove a function $f : \mathbb{R}^{m\times n} \rightarrow \mathbb{R}$ (specifically $f(X) = \log \det X + tr(X^{-1} Y)$) is convex; one way to do so is to prove that $\nabla^2_X f(X) \succeq 0$ everywhere. At least, this is true for functions $g : \mathbb{R}^n \rightarrow \mathbb{R}$, I haven't been able to find any generalizations of this to matrices, but I think it must be true for the correct notion of "Hessian."

share|cite|improve this question
Your function $f$ is perfectly well defined on the open subset $GL(n,\mathbb{R})$ of $M_n(\mathbb{R})$, consisting of all invertible matrices, but not on $M_n(\mathbb{R})$. Moreover, $GL(n,\mathbb{R})$ is not a convex subset of $M_n(\mathbb{R})$, since the straight line between $I_n$ and $-I_n$ contains $0$, so that you can't use the (generalised) second derivative test to conclude convexity of $f$ on all of $GL(n,\mathbb{R})$... – Branimir Ćaćić Apr 5 '13 at 8:48
Your second $f$ is not convex. Consider the scalar case with $Y=-1$. – user1551 Apr 5 '13 at 13:07

Many times, convexity for these types of functions can be checked by proving convexity of $f(Z+tV)$ in $t$, for arbitrary $Z,V$ (see Boyd & Vandenberghe "Convex Optimization" p.74).

The general Hessian for $\log\det(X)$ would require 4 indices. See p.644 for an approximation.


share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.