# Find the maximum value of this form

Let $A,B$ be $n\times n$ real symmetric matrices such that $B$ is positive definite. Show that $G$ defined below attains a maximum value at an eigenvector related to $A$ and $B$. Also find the maximum value of $G$. $$G(x)=\dfrac{\langle Ax,x\rangle}{\langle Bx,x\rangle},\hspace{5 mm} x \ne 0$$

My thought: since $A$ is symmetric, its eigenvalues are real. The solution should be involving making $A,B$ simultaneously similar to diagonal matrix. But I don't know how to make $A,B$ simultaneously similar to diagonal matrix in this case.

By Spectral Theorem, $B$ is orthogonally similar to a diagonal matrix, i.e $$Q^{T}BQ=\pmatrix{\mu_1 \\ & \ddots \\ && \mu_n}=D$$ where $\space Q^{T}Q=Q^{-1}Q=I$, $\mu_i$ is eigenvalues of $B$. Since $B$ is positive definite, $\mu_i>0$.
Let $P=\sqrt{D}Q^{T}$. Then $$B=P^TP$$
And $$\langle Bx,x\rangle=x^TBx=y^Ty$$ where $y=Px$.
Consider matrix $AB^{-1}$. Since $$|\lambda I-AB^{-1}|=|\lambda B-A||B^{-1}|=|\lambda P^TP-A||B^{-1}|=|P^T||\lambda I-(P^T)^{-1}AP^{-1}||P||B^{-1}|$$ $AB^{-1}$ and $(P^{-1})^{T}AP^{-1}$ have same eigenvalues.
Let $\lambda_i$ be eigenvalues of $AB^{-1}$ and $\lambda_{max}=\max\{\lambda_1,\cdots,\lambda_n\}$. Then $$\langle Ax,x\rangle=x^TAx=y^T(P^{-1})^{T}AP^{-1}y=\sum_{i=1}^n\lambda_iy_i^2$$ And thus $$G(x)=\dfrac{\langle Ax,x\rangle}{\langle Bx,x\rangle}=\dfrac{\sum\limits_{i=1}^n\lambda_iy_i^2}{y^Ty}\leqslant \dfrac{\lambda_{max}y^Ty}{y^Ty}=\lambda_{max}$$ So the maximum value of $G$ is the maximum eigenvalue of $AB^{-1}$, attained at that eigenvector.