TITLE: Solution to a Sylvester equation with positive definite coefficients
QUESTION [3 upvotes]: Consider the following Sylvester equation, where each of the known coefficient matrices ($A$, $B$, $C$) is symmetric positive definite and has dimensions $n \times n$
\begin{align*}
C = A^TXA + B^TXB.
\end{align*}
In my case, the coefficient matrices are such that the equation has a unique real solution which is also symmetric.
I have been trying to prove that the solution must also be positive definite and I am struggling. The struggle makes me think that this is actually not true.
I would be grateful for either a pointer to related literature, a way to prove my hypothesis or a counterexample. If it is not true in general, are there any known conditions on $A$ and $B$ which make this true?

REPLY [7 votes]: This is not true. For example, if
$$
A = \begin{bmatrix}
1 & 0 \\ 0 & 4
\end{bmatrix}, B = \begin{bmatrix}
4 & 0 \\ 0 & 1
\end{bmatrix}, C = \begin{bmatrix}
17 & 16 \\ 16 & 17
\end{bmatrix}
$$
then each of $A$, $B$, and $C$ is symmetric and positive definite. However, it is straightforward to check that the unique solution to the Sylvester equation is
$$
X = \begin{bmatrix}
1 & 2 \\ 2 & 1
\end{bmatrix},
$$
which is not positive (semi)definite.
{"set_name": "stack_exchange", "score": 3, "question_id": 428315}