If $A,B$ are Hermitian, how to show that $\lambda_\max(AB^{-1}) =\max_{x\ne 0} \frac{x^*Ax}{x^*Bx}$ if A,B have only positive eigenvalues?

If $A,B$ are Hermitian, how to show that $\lambda_\max(AB^{-1}) =\max_{x\ne 0} \frac{x^*Ax}{x^*Bx}$ if A,B have only positive eigenvalues? My idea is to use the Rayleigh theorem, but I don't know if $\lambda_{max}(AB^{-1})=\lambda_{max}A\lambda_{max}B^{-1}$.


Here is a trick: if $B$ has only positive eigenvalues, then $B$ is invertible and has a positive square root $\sqrt{B}$ (satisfying $\sqrt{B}^2 = B$ with $\sqrt{B}$ also Hermitian, invertible, and with all positive eigenvalues). Then \begin{equation*} \max_{x \not = 0} \frac{x^* A x} {x^* B x} = \max_{x \not = 0} \frac{x^* A x} {(\sqrt{B} x)^* (\sqrt{B} x)} = \max_{x \not = 0} \frac{(\sqrt{B}^{-1} x)^* A (\sqrt{B}^{-1} x)} {x^* x} = \max_{x \not = 0} \frac{x^* \sqrt{B}^{-1} A \sqrt{B}^{-1} x} {x^* x}. \end{equation*} Thus you can now apply the Rayleigh theorem to $A' := \sqrt{B}^{-1} A \sqrt{B}^{-1}$ and obtain that the the original expression $\max_{x \not = 0} \frac{x^* A x} {x^* B x}$ is equal to $\lambda_\text{max}(\sqrt{B}^{-1} A \sqrt{B}^{-1})$.

It finally remains to check that the matrix $\sqrt{B}^{-1} A \sqrt{B}^{-1}$ has the same eigenvalues as $A B^{-1}$. To see thus just note that we have the following chain of if-and-only-ifs: \begin{align*} &\phantom{\iff} \sqrt{B}^{-1} A \sqrt{B}^{-1} x = \lambda x\\ &\iff \forall y, (\sqrt{B}^{-1} A \sqrt{B}^{-1} x, y) = (\lambda x, y)\\ &\iff \forall y, (A \sqrt{B}^{-1} x, \sqrt{B}^{-1} y) = (\lambda x, y)\\ &\iff \forall y, (A \sqrt{B}^{-1} x, y) = (\lambda x, \sqrt{B} y)\\ &\iff \forall y, (A \sqrt{B}^{-1} x, y) = (\lambda \sqrt{B} x, y)\\ &\iff A \sqrt{B}^{-1} x = \lambda \sqrt{B} x \\ &\iff A \sqrt{B}^{-1} \sqrt{B}^{-1} (\sqrt{B} x) = \lambda (\sqrt{B} x) \\ &\iff A B^{-1} x = \lambda x. \end{align*} Thus (again since $\sqrt{B}$ is invertible) $x$ is an eigenvalue for $\sqrt{B}^{-1} A \sqrt{B}$ with eigenvalue $\lambda$ if and only if $\sqrt{B} x$ is an eigenvalue for $A B^{-1}$ with eigenvalue $\lambda$. This completes the proof.