Minimize $\mathrm{tr}(R^{-1}B^TXB)$ over $R$ subject to $X=A^TXA-A^TXB(R+B^TXB)^{-1}B^TXA$ Given $A\in\mathbb{R}^{n\times n}$ and $B\in\mathbb{R}^{n\times 2}$, I am interested in solving the following problem:
\begin{array}{ll} \underset{R \in \mathbb{R}^{2\times 2}}{\text{minimize}} & \mathrm{tr} \left( R^{-1}B^T X B \right)\\ \text{subject to} & X=A^TXA-A^TXB(R+B^TXB)^{-1}B^TXA.\end{array}
Here $X$ is unique stabilizing solution to DARE, thus X is positive definite. It is required that $R>0$ (i.e. positive definite) and $B^TXB$ to be full rank.
EDIT: For a fixed $A,B,R$, we can get unique $X$ by solving DARE, for example by using matlab "idare" or "dare" command. However, here $R$ is not fixed, it is a variable, thus for each $R$, there is corresponding $X$.

My attempt: I wanted to start with simpler case when we put additional constraints on $R$. Assume that $R$ is diagonal and positive definite. WLOG we can assume that $R=\mathrm{diag}\{r_1,r_2\}$, such  that $r_1+r_2=1$ and $1>r_i>0$ for $i=1,2.$
A=[3 0 0 0; 0 2 1 0; 0 0 2 0; 0 0 0 2];
B=rand(4,2);
Q=zeros(4,4);    
r1=linspace(0.01, 0.99);
for i=1:100  
    R=[r1(i) 0; 0 1-r1(i)];
    [X,~,~] = idare(A,B,Q,R);
    T(i)=trace(inv(R)*B'*X*B);
end 
plot(T)


It looks like that as we increase $r_1$ from $0$ to $1$, then $\mathrm{tr} \left( R^{-1}B^T X B \right)$ is continuous, moreover, it is convex. However, I am unable to prove it.
 A: Given the matrix inner product $(:)$
$$\eqalign{
\def\c#1{\color{red}{#1}}
\def\CLR#1{\c{\LR{#1}}}
\def\LR#1{\left(#1\right)}
\def\trace#1{\operatorname{Tr}\LR{#1}}
\def\p{\partial}
\def\grad#1#2{\frac{\p #1}{\p #2}}
\def\qiq{\quad\implies\quad}
A:B &= \trace{A^TB} \\
}$$
The objective function can be written as
$$\eqalign{
\phi &= \trace{R^{-1}B^T X B} \\
 &= R^{-1}:B^TXB \\
}$$
For typing convenience, define the matrix variable
$$\eqalign{
&M = (R+B^TXB)^{-1} \;=\; M^T \\
&dM = -M\LR{dR+B^TdX\,B}M \\
&\c{dm} = -\LR{M\otimes M}\c{dr} - \LR{MB^T\otimes MB^T}\c{dx} \\
}$$
Use the DARE constraint to relate the differentials of
$M,R,$ and $X,\,$ and vectorize them.
$$\eqalign{
&X = A^TXA-A^TXB\c{M}B^TXA \\
&dX
 = A^TXB\,\c{dM}\,B^TXA
 + A^T\c{dX}\,A
 - A^T\c{dX}\,BMB^TXA
 - A^TXBMB^T\c{dX}\,A
\\
&\c{dx}
 = \LR{A^TXB\otimes A^TXB}\c{dm}
 + \LR{A^T\otimes A^T}\c{dx}
\\
&\qquad\qquad\qquad
 - \LR{A^TXBMB^T\otimes A^T}\c{dx}
 - \LR{A^T\otimes A^TXBMB^T}\c{dx}
\\
&\LR{A^TXB\otimes A^TXB}\LR{M\otimes M}\c{dr}
\\&\qquad\qquad\qquad
 = \LR{A^T\otimes A^T-I\otimes I}\c{dx} \\
&\qquad\qquad\qquad
 - \LR{A^TXB\otimes A^TXB}\LR{MB^T\otimes MB^T}\c{dx}
\\&\qquad\qquad\qquad
 - \LR{A^TXBMB^T\otimes A^T}\c{dx}
\\&\qquad\qquad\qquad
 -  \LR{A^T\otimes A^TXBMB^T}\c{dx}
\\
&P^T\c{dr} = Q^T\c{dx} \\
}$$
Calculate the gradient of the objective function
$$\eqalign{
\phi &= R^{-1}:B^TXB \\
\c{d\phi} &= R^{-1}:B^T\c{dX}\,B - B^TXB:R^{-1}\c{dR}\,R^{-1} \\
 &= BR^{-1}B^T:\c{dX} - R^{-1}B^TXBR^{-1}:\c{dR} \\
 &= E:\c{dX} - F:\c{dR} \\
 &= e:\c{dx} - f:\c{dr} \\
 &= \LR{PQ^{+}e - f}:\c{dr} \\
\grad{\phi}{r} &= {PQ^{+}e - f} \\
}$$
Solving the zero gradient condition for an optimal $R$ value seems hopeless, but a numerical solution via gradient descent is feasible given this closed-form expression for the gradient.
$$\eqalign{
}$$
