I am struggling on the following question. Let $A$ be a semidefinite positive matrix ($A\in\mathscr{S}_n^+(\mathbb{R})$) and let consider the Rayleigh quotient defined as:
$$\forall x\in\mathbb{R}^n\backslash 0,~f(x):=\frac{\langle x,Ax\rangle}{\langle x,x\rangle}. $$
How can we compute the Hessian of $f$ ? I have tried to do the Taylor expansion but couldn't get anything from there...
Thank you very much!
$ \def\a{\alpha} \def\b{\beta} \def\l{\lambda} \def\BR#1{\Big(#1\Big)} \def\LR#1{\left(#1\right)} \def\op#1{\operatorname{#1}} \def\trace#1{\op{Tr}\LR{#1}} \def\frob#1{\left\| #1 \right\|_F} \def\qiq{\quad\implies\quad} \def\mt{\mapsto} \def\p{\partial} \def\grad#1#2{\frac{\p #1}{\p #2}} \def\hess#1#2#3{\grad{^2 #1}{#2\,\p #3}} \def\Hess#1#2{\grad{^2 #1}{#2^2}} \def\c#1{\color{red}{#1}} \def\CLR#1{\c{\LR{#1}}} $Consider the scalar functions (aka quadratic forms) $$\eqalign{ \a &= x^TAx &\qiq d\a = \LR{2Ax}^Tdx \\ \b &= x^TBx &\qiq d\b = \LR{2Bx}^Tdx \\ }$$ whose ratio is a generalized Rayleigh quotient and whose gradient can be calculated as $$\eqalign{ \l &= \frac{\a}{\b} \\ d\l &= \frac{\b\,d\a-\a\,d\b}{\b^2} \;=\; 2\b^{-1}\LR{Ax-\l Bx}^Tdx \\ \grad{\l}{x} &= 2\b^{-1}\BR{A-\l B}x \;\doteq\; \c{g} \\ }$$ The Hessian is the gradient of $g$ $$\eqalign{ dg &= 2\b^{-1}\LR{A-\l B}\c{dx} - 2\b^{-1}\c{d\l}Bx - 2\b^{-2}\c{d\b}\LR{A-\l B}x \\ &= 2\b^{-1}\LR{A-\l B}\c{dx} - 2\b^{-1}Bx\CLR{g^Tdx} - 2\b^{-2}\LR{A-\l B}x\CLR{2x^TB\,dx} \\ &= 2\b^{-1}\BR{A-\l B - Bxg^T - gx^TB}\,dx \\ \grad gx &= 2\b^{-1}\BR{A-\l B - Bxg^T - gx^TB} \;\doteq\; \c{H} \\ }$$ Setting $B=I$ yields the gradient and Hessian for a simple Rayleigh quotient.