Find $\mathrm{tr}(AX^{-1}A'X)$ Given $A=\begin{bmatrix}
a_1 &  & \\
 & a_2 & \\
&&a_2
\end{bmatrix}$ and $B\in\mathbb{R}^{3\times2}$, where $a_1,a_2>1$, and $X=AX(I+BB'X)^{-1}A$. 
1) Find $\mathrm{tr}(AX^{-1}AX)$ in terms of $a_i$.
2) Show that $\frac{x_1\cdot\begin{vmatrix}
x_2 & x_{23}\\
x_{23}&x_3
\end{vmatrix}}{|X|}$ is independent of $B$, where $|X|=\mathrm{det}X$.

My attempt: $X$ is the solution to discrete-time algebraic Riccati equation. 
Let $X=\begin{bmatrix}
x_1 & x_{12} & x_{13}\\
x_{12} & x_2 & x_{23}\\
x_{13}&x_{23}&x_3
\end{bmatrix}$ and $z=x_1\cdot\begin{vmatrix}
x_2 & x_{23}\\
x_{23}&x_3
\end{vmatrix}$, then I found that
\begin{align}
\mathrm{tr}(AX^{-1}AX)
=(a_1-a_2)^2\frac{z}{|X|}+(2a_1a_2+a_2^2).
\end{align}
I did simulation by fixing $A$ and found out that $\frac{z}{|X|}$ doesn't depend on $B$, thus $\mathrm{tr}(AX^{-1}AX)$ also doesn't depend on $B$ (as long as $B$ is full rank).

Observation 1: $A=\begin{bmatrix}
7 &  & \\
 & 2 & \\
&&2
\end{bmatrix}$ and $A=\begin{bmatrix}
2 &  & \\
 & 7 & \\
&&7
\end{bmatrix}$ has equal $\frac{z}{|X|}$.
Observation 2: The larger the gap between $a_1$ and $a_2$, the smaller $\frac{z}{|X|}$ and vice-versa.

Assume that $\det X \ne 0$. 
From $X = AX(I + BB^\mathsf{T}X)^{-1}A$,
we have $I + BB^\mathsf{T}X = AX^{-1}AX$
and $BB^\mathsf{T} = AX^{-1}A - X^{-1}$.
Let $Y = X^{-1}$. We have $BB^\mathsf{T} = AYA - Y$.
Let
$$Y=\begin{bmatrix}
y_1 & y_{12} & y_{13}\\
y_{12} & y_2 & y_{23}\\
y_{13}&y_{23}&y_3
\end{bmatrix}, \quad 
B = \begin{bmatrix}
b_1 & b_2 \\
b_3 & b_4 \\
b_5 & b_6
\end{bmatrix}.
$$
From $BB^\mathsf{T} = AYA - Y$, we solve $Y$ uniquely 
\begin{align}
y_1 &= \frac{b_1^2 + b_2^2}{a_1^2 - 1}, \quad y_{12} = \frac{b_1b_3 + b_2b_4}{a_1a_2 - 1}, \quad 
y_{13} = \frac{b_1b_5 + b_2 b_6}{a_1a_2 - 1}, \\
y_2 &= \frac{b_3^2 + b_4^2}{a_2^2 - 1}, \quad y_{23} = \frac{b_3b_5 + b_4b_6}{a_2^2-1}, \quad 
y_3 = \frac{b_5^2+b_6^2}{a_2^2-1}.
\end{align}
By using the well-known relation $M^{-1} = \frac{1}{\det M} \mathrm{adj}(M)$, from $Y = X^{-1}$ and $X = Y^{-1}$, we have
\begin{align}
y_1 &= \frac{\begin{vmatrix}
x_2 & x_{23}\\
x_{23}&x_3
\end{vmatrix}}{\det X}, \\
x_1 &= \frac{\begin{vmatrix}
y_2 & y_{23}\\
y_{23}&y_3
\end{vmatrix}}{\det Y}.
\end{align}
Thus, we have
$$\frac{z}{\det X} = y_1x_1 = y_1 \frac{\begin{vmatrix}
y_2 & y_{23}\\
y_{23}&y_3
\end{vmatrix}}{\det Y} = \frac{(a_1a_2-1)^2}{(a_1-a_2)^2}.$$
Then, we have
$$\mathrm{Tr}(AX^{-1}AX) = (a_1-a_2)^2\frac{z}{\det X}+(2a_1a_2+a_2^2) = a_1^2a_2^2 + a_2^2 + 1.$$
