TITLE: Why is this formula positive definite?
QUESTION [6 upvotes]: I have a formula
$$A(I+GQ)^{-1}(G+GQG)(I+QG)^{-1}A^{\mathrm T}+G$$
where $A,Q,G,I\in\mathbb R^{n\times n}$, $A$ nonsingular, $G$ positive semi-definite, $Q$ positive definite, $I$ the identity matrix, and $(A,G)$ controllable. It is obvious that both the first and second terms are positive semi-definite, but why this formula is positive definite in fact? Thanks in advance.

REPLY [2 votes]: The sum is not necessarily positive definite. For a counterexample, consider
$$
A = \pmatrix{5&2&0\\ 2&2&1\\ 0&1&1},\quad Q=I,\quad G=\pmatrix{1\\ &0\\ &&0}.
$$
It is straightforward to verify that $A$ is nonsingular (it has unit determinant) and $(A,G)$ is  controllable (the matrix $\pmatrix{G&AG&A^2G}$ has full row rank). Yet,
$$
A(I+GQ)^{-1}(G+GQG)(I+QG)^{-1}A^T+G = \pmatrix{\tfrac{27}2&5&0\\ 5&2&0\\ 0&0&0},
$$
which is singular.
However, the sum is positive definite when $\operatorname{rank}(G)\ge n-1$ (in particular, it is always PD for $2\times2$ matrices), essentially because the null space of $G$ is at most one-dimensional.
Edit.
To prove that the above rank condition is sufficient, we do some absorptions of matrices first, with $G\leftarrow Q^{1/2}GQ^{1/2}$ and $A\leftarrow Q^{1/2} A Q^{-1/2}$. Note that the new $(A,G)$ is also controllable; the new $A$ is still full-rank and the new $G$ is still PSD. With these absorptions, the given expression reduces to $Q^{-1/2}\left[A(I+G)^{-1}G A^T + G\right]Q^{-1/2}$. It is positive definite if and only if
$$P=A(I+G)^{-1}G A^T + G$$
is positive definite. As the OP mentions, the sum is always PSD. So the remaining question is when is $P$ singular. As both summands in $P$ are PSD, if $Px=0$, we must have $A(I+G)^{-1}G A^Tx=0$ and $Gx=0$. As $A(I+G)^{-1}$ is nonsingular, this set of conditions, when transposed, reduces to $x^TAG=0$ and $x^TG=0$.
However, by the PBH test of controllability, if $x^TG=0$ has a nontrivial solution, $x$ cannot be a left eigenvector of $A$. In other words, if $P$ is singular, $x^TA$ and $x^T$ are linearly independent and the left null space of $G$ is at least two-dimensional. Therefore, if $\operatorname{rank}(G)\ge n-1$ (i.e. $\operatorname{nullity}(G)\le1$), then $P$ is nonsingular, thus positive definite.