For a given $A \in \mathbb{R}^{n \times n}$ and $B \in \mathbb{R}^{n \times m}$, where $(A,B)$ is controllable
$$\begin{array}{ll} \underset{X \in \mathbb{R}^{n\times n}}{\text{minimize}} & \mathrm{tr} \left( B' X B \right)\\ \text{subject to} & X = A'XA - A'XB(B'XB + I)^{-1}B'XA\end{array}$$
For a specific $A$ and $B$, I can use Matlab to solve the DARE (discrete-time algebraic Riccati equation) and insert the resulting $X$ to find $\mathrm{tr}(B'XB)$. Is it possible to get the general answer in terms of $A$ and $B$?
EDIT:
Lagrangian:
$$L(X, \Lambda) := {\rm Tr}\left(B^T XB \right) - {\rm Tr}\left(\Lambda^T \left[ X - A^TXA + A^TXB \left( B^TXB + I \right)^{-1} B^T X A \right] \right)$$
Taking the gradient:
$$\frac{\partial{L(X, \Lambda)}}{\partial{X}}=BB'-\Lambda+A\Lambda A'-\frac{\partial{\mathrm{tr}\Lambda A'XB(B'XB+I)^{-1}B'XA}}{\partial{X}}$$
FURTHER EDIT: I think $X$ is symmetric, then
$$\begin{align} \frac{\partial{L(X, \Lambda)}}{\partial{X}}&=BB'-\Lambda+A\Lambda A'- A \Lambda \left( B M^{-1} B^T X^T A \right)^T \\&+ \left( A^T X B M^{-1} B^T \right)^T \Lambda \left( B M^{-1} B^T X^T A \right)^T - A \Lambda^T \left( B M^{-1} B^T X^T A \right)^T\\&=BB'-\Lambda+(I-B(B'XB+I)^{-1}B'X)A\Lambda A'(I-XB(B'XB+I)^{-1}B') \end{align}$$
Equating the last expression to zero, we get Lyapunov equation:
\begin{equation} \Bigg[(I-B(B'XB+I)^{-1}B'X)A\Bigg]\Lambda \Bigg[A'(I-XB(B'XB+I)^{-1}B')\Bigg]-\Lambda+\Bigg[BB'\Bigg]=0. \end{equation}
Solving for $\Lambda$, we get $\Lambda=\sum_{k=0}^\infty\Big[(I-B(B'XB+I)^{-1}B'X)A\Big]^kBB'\Big[(I-B(B'XB+I)^{-1}B'X)A\Big]^{k^*}$.
Any tips how I can continue?