Minimize $\mathrm{tr}(B'XB)$ where $X$ is solution for DARE 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?
 A: Since you asked for the gradient of one of the components of Lagrangian, here we go.
Let us define the Frobenius product by a colon, for brevity, i.e.,
\begin{align}
{\rm Tr}\left( A^T B C \right) := A: BC
\end{align}
We will use the cyclic property of trace, e.g.,
\begin{align}A: BCD = B^T A: CD = B^TAD^T: C
\end{align}
Let us define for simplicity, 
\begin{align}
M^{-1} := \left( B^T X B + I \right)^{-1}
\end{align}
And the corresponding differential which will be handy later.
\begin{align}
dM^{-1} = -M^{-1} dM M^{-1} = -M^{-1} B^T dX B M^{-1}
\end{align}
Now the part that you are interested to find the gradient can be rewritten as
\begin{align}
\phi &:= {\rm Tr}\left( \Lambda^T \left[ A^T X B \left( B^T X B + I \right)^{-1} B^T X^T A \right] \right) \\
&= \Lambda :  A^T X B M^{-1} B^T X^T A
\end{align}
Compute the differential and then gradient. 
\begin{align}
d\phi 
&= \left\{ \Lambda :  A^T dX B M^{-1} B^T X^T A + A^T X B dM^{-1} B^T X^T A  + A^T X B M^{-1} B^T dX^T A \right\} \\
&= \left\{ \Lambda :  A^T dX B M^{-1} B^T X^T A - A^T X B M^{-1} B^T dX B M^{-1} B^T X^T A  + A^T X B M^{-1} B^T dX^T A \right\} \\
&= \left\{ \left[ A \Lambda \left( B M^{-1} B^T X^T A \right)^T: dX \right] - \left[  \left(  A^T X B M^{-1} B^T \right)^T \Lambda \left( B M^{-1} B^T X^T A \right)^T : dX  \right] + \left[ A  \Lambda^T \left( B M^{-1} B^T X^T A \right)^T : dX \right] \right\}
\end{align}
The gradient is
\begin{align}
\frac{\partial \phi}{\partial X}
&=  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
\end{align}
You can simplify further. I hope this helps
