Let us consider the following cost function:
$$J(\mathbf{A},\mathbf{B}) = \frac{\mathbf{u}^T\mathbf{Au}}{\mathbf{u}^T\mathbf{Bu}}$$
where, $\mathbf{A}$ and $\mathbf{B}$ are given symmetric positive definite matrices and variable $\mathbf{u}$ is a unit vector. I want to know the steps for finding the value of $\mathbf{u}$ that maximizes $J$. Additionally, I have the following queries:
- Is maximizing $J$ equivalent to maximizing the numerator?
- Is maximizing $J$ equivalent to minimizing denominator?
- Is it possible to get two different answers for points 1 and 2?
Define a few scalar variables and their differentials $$\eqalign{ \alpha &= A:uu^T &\implies d\alpha = 2Au:du \cr \beta &= B:uu^T &\implies d\beta = 2Bu:du \cr }$$ where a colon denotes the trace/Frobenius product, i.e. $\,\,\,A\!:\!B={\rm tr\,}(A^TB)$
Write the cost function in terms of these, then find its differential and gradient $$\eqalign{ J &= \frac{\alpha}{\beta} \cr dJ &= \beta^{-2}({\beta\,d\alpha-\alpha\,d\beta}) \cr &= 2\beta^{-2}({\beta Au-\alpha Bu}): du \cr &= 2\beta^{-1}(Au-JBu) : du \cr \frac{\partial J}{\partial u} &= 2\beta^{-1}(Au-JBu) \cr }$$ Set the gradient to zero and solve $$\eqalign{ Au &= JBu \cr (B^{-1}A)u &= Ju \cr }$$ This is just an eigenvalue equation. So $J$ is the largest eigenvalue of $\,(B^{-1}A)$ and $u$ is the associated eigenvector.