Is there any way to comment on the quantity,
$$Z (X) = \text{trace}((X^TA_1X)^{-1}X^TA_2X)$$
solely based on $A_1, A_2$?
More clearly, what I mean is, if $A_1 = A_2$, the above quantity is $k$. Can we find out if $Z$ Will be greater or less than $n$, solely based on some kind of matrix difference between $A_1, A_2$? Like looking at trace of $A_1^{-1}A_2$ Or something on that line. $X$ Is an arbitrary matrix of size $n \times k$. $A_1, A_2$ Both are positive definite.
This is only restricted when $A,B,XX^T$ have same eigenvectors
Using SVD, i.e. $X = UDV^T$ where $U,V$ are unitary so $$Z (X) = \text{trace}((X^TA_1X)^{-1}X^TA_2X) = \text{trace}((VD^TU^TA_1UDV^T)^{-1}VD^TU^TA_2UDV^T) $$ which becomes $$Z (X) = \text{trace}((D^TU^TA_1UD)^{-1}D^TU^TA_2UD) $$ Now if $A_1$ and $A_2$ share same eigenvectors $U$ then $A_1 = UD_1U^T$ and $A_2 = UD_2U^T$ $$Z (X) = \text{trace}((D^TU^T UD_1U^TUD)^{-1}D^TU^T UD_2U^TUD) $$ Since $U$ is unitary, then $UU^T=U^TU=I$ $$Z (X) = \text{trace}((D^TD_1D)^{-1}D^TD_2D) =\text{trace}((D^TD_1D)^{-1}D^TD_2D) = \sum\limits_{k=1}^n \frac{\beta_k}{\alpha_k}$$ where $\beta_k$'s are the eigenvalues of $B$ and and $\alpha_k$ are that for $A$. Note your case when $A_1=A_2$, then $\alpha_k=\beta_k$ and hence the above adds to $n$.