# Gradient and hessian of $\log(1+x^TAx)$

I want to find Gradient and hessian of $$log(1+x^TAx)$$ where $$A$$ is positive semi definite.

My attempt: $$\nabla = x^T(A+A^T)/1+x^TAx$$

Hessian = $$(A+A^T)(1+x^TAx)-(x^T(A+A^T))^Tx^T(A+A^T)/(1+x^TAx)^2$$

Is that correct?

• the last numerator cannot be computed due to a dimension mismatch – LinAlg Oct 11 '18 at 21:59
• @LinAlg thanks! Edited, is that correct now? – Studying Optimization Oct 11 '18 at 22:04
• seems like it, but if you are unsure you can always check the answer numerically – LinAlg Oct 11 '18 at 22:20
• You could use more parentheses. – amd Oct 11 '18 at 22:43
• Sounds correct to me..... – Mostafa Ayaz Oct 11 '18 at 23:16