Rank of Matrix Determination $X=(I+ab^T)A(I+ba^T)$;
$A$ is symmetric and positive definite matrix of $n \times n$. $I$ is the Identity matrix of $n \times n$.
$a$ and $b$ are vectors of $n \times 1$. 
$a.b \neq -1$ and $a.b \neq 0$
$a$ is not parallel to $Ab$
How do we show that $X-A$ is a rank $2$ matrix ?
Efforts:
$$X-A= ab^T A + Aba^T+ ab^T A ba^T$$
Hence each of the terms are having rank $1$. so the sum of all the terms can have rank $\leq 3$
But I am not getting how it can be exactly of rank $2$..
 A: We can write $X - A$ as
$$
X - A = ab^T[A + Aba^T] + Aba^T = ab^TA[I + ba^T] + Aba^T
$$
Noting that $\operatorname{rank}(PQ) \leq \min\{\operatorname{rank}(P),\operatorname{rank}(Q)\}$, we can see that each term has rank at most $1$, which means that $X - A$ has rank at most $2$.

It now remains to be shown that the rank is not $1$ or $0$. 
First, we must show that the first matrix in the sum is non-zero.  That is, we wish to show that the product
$$
b^T A[I + ba^T]
$$
is not the zero matrix.  To that end, we note that
$$
(b^T A[I + ba^T])b = b^T A[b + b(a^Tb)] = (1 + a^Tb)(b^TAb)b \neq 0
$$
From there, it suffices to note that the first term has the span of $a$ as its column space, while the second term has the span of $Ab$ as its column space.  Thus, the two column spaces are distinct and one-dimensional.  It follows that the sum of the two non-zero rank $1$ matrices must have rank $2$.
A: $(X-A)$ is spanned by two vectors only
We can solve this using projector matrices, i.e. matrices of the form 
\begin{equation}
 P = Z(Z^TZ)^{-1}Z^T
\end{equation}
The number of columns of $X$ will determine the rank of the matrix $X -A $. If we stack in $Z$, 
\begin{equation}
 Z = 
 \begin{bmatrix}
  a & Ab
 \end{bmatrix}
\end{equation}
We are sure that $Z$ is full column rank because $a$ is not parallel to $Ab$, Hence it is easy to see that 
\begin{equation}
 Pa = a \tag{1}
\end{equation}
and 
\begin{equation}
 PAb = Ab \tag{2}
\end{equation}
Hence 
$$P(X-A) = P(ab^T A + Aba^T+ ab^T A ba^T)$$
which is 
$$P(X-A) =  Pab^T A + PAba^T+ Pab^T A ba^T$$
Using equations $(1,2)$, we get
$$P(X-A) =  ab^T A + Aba^T+ ab^T A ba^T = X-A$$
Hence $X-A$ is spanned by two vectors, i.e. rank $2$.
Therefore $P$ spans a two dimensional space, which is the span of the column space of $X -A$. On the other hand, we can also show that 
\begin{equation}
 (I-P).(X-A) = 0
\end{equation}
where $I-P$ is of rank $n-2$.
