Gradient and Hessian of function on matrix domain Let $A \in R^{k \times p}$. Define $f(X) : R^{p \times k} \rightarrow R$ to be $f(X) = \log \det(XA + I_{p})$, where $I_{p}$ is a $p \times p$ identity matrix. I want to know what is the gradient and hessian of $f(X)$ with respect to $X$. Thank you!

Let $f(X)=\log(|\det(I+XA)|)$; we calculate $Df_X$ in a point $X$ s.t. $I+XA$ is invertible, that is, $-1$ is not an eigenvalue of $XA$.
$Df_X:H\in M_{p,k}\rightarrow tr(HA(I+XA)^{-1})=tr((I+XA)^{-T}A^TH^T)$ or
$Df_X(H)=<(I+XA)^{-T}A^T,H>$ (the scalar product over the matrices). In other words, the gradient of $f$ is $\nabla(f)(X)=(I+XA)^{-T}A^T$, the lynn's result.
The Hessian is the bilinear symmetric function:
$Hess(f)(X):(H,K)\in M_{p,k}\times M_{p,k}\rightarrow -tr(HA(I+XA)^{-1}KA(I+XA)^{-1})$, that is equivalent to 
$\dfrac{\partial^2f}{\partial x_{i,j}\partial x_{k,l}}=-tr(E_{i,j}A(I+XA)^{-1}E_{k,l}A(I+XA)^{-1})$ where $X=[x_{i,j}]$ and $E_{i,j}=e_ie_j^T$.
