Theoretical question about the rank and existence of an inverse of a block matrix, Let A and B be two $n \times n$ square matrices with complex coefficients, and consider the $2n \times 2n$ matrix $M$ given by 
$$ M =
        \begin{bmatrix}
        A & A  \\
        A & B \\
        \end{bmatrix}
$$


*

*Determine the rank of $M$ in terms of $A$ and $B$.

*What is the condition for $M$ to have an inverse $M^{-1}$?  Compute $M^{-1}$ when it exists.
Any ideas on how to get started on this problem are welcome.
Thanks,
 A: Note that
$$
M=
\underbrace{\begin{bmatrix}I&0\\I&I\end{bmatrix}}_{=P}
\underbrace{\begin{bmatrix}A&0\\0&B-A\end{bmatrix}}_{=M^\prime}
\underbrace{\begin{bmatrix}I&I\\0&I\end{bmatrix}}_{=Q}
$$
But $P$ and $Q$ are invertible so $\DeclareMathOperator{rank}{rank}\rank M=\rank M^\prime$. Since $M^\prime$ is block-diagonal we have
$$
\rank M=\rank A+\rank(B-A)
$$
To see why $\rank M=\rank M^\prime$, note the two facts:

Fact 1. Let $A$ be an $m\times n$ matrix. If $B$ is an $n\times k$ matrix of rank $n$, then $\rank(AB)=\rank(A)$.

In our case take $A=M$ and $B=Q^{-1}$. This implies that $\rank(MQ^{-1})=\rank(M)$.

Fact 2. Let $A$ be an $m\times n$ matrix. If $C$ is an $l\times m$ matrix of rank $m$, then $\rank(CA)=\rank(A)$.

In our case take $A=M^\prime$ and $C=P$. This implies that $\rank(PM^\prime)=\rank(M^\prime)$.
Since $MQ^{-1}=PM^\prime$ we see that 
$$
\rank(M)=\rank(MQ^{-1})=\rank(PM^\prime)=\rank(M^\prime)
$$
For more about rank, see wikipedia. Also, try to prove these facts yourself!
A: \begin{align}
[ M \mid I ] &=
\left[
\begin{array}{cc|cc}
A & A & I & 0 \\
A & B & 0 & I 
\end{array}
\right] \\
&\to
\left[
\begin{array}{cc|cc}
A & A   & I  & 0 \\
0 & B-A & -I & I 
\end{array}
\right] \\
& \to
\left[
\begin{array}{cc|cc}
I & I & A^{-1} & 0 \\
0 & I & -(B-A)^{-1} & (B-A)^{-1}
\end{array}
\right] \\
& \to
\left[
\begin{array}{cc|cc}
I & 0 & A^{-1} +(B-A)^{-1} & -(B-A)^{-1} \\
0 & I & -(B-A)^{-1} & (B-A)^{-1}
\end{array}
\right] = [ I \mid M^{-1} ]
\end{align}
A: In this case we have rank($M$) = rank($A$) + rank($B-A$).  So we can say a lot about the rank of $M$, just not in terms of rank($A$) and rank($B$).
A: First note that
$$  \begin{bmatrix} A & A \\ A & B \\ \end{bmatrix} =
\begin{bmatrix} A & 0 \\ 0 & I \\ \end{bmatrix}
\begin{bmatrix} I & 0 \\ A & I \\ \end{bmatrix}
\begin{bmatrix} I & 0 \\ 0 & (B-A) \\ \end{bmatrix}
\begin{bmatrix} I & I \\ 0 & I \\ \end{bmatrix}
$$
(You can derive this by doing the steps in Gaussian elimination and then writing them as multiplications by "primitive" operation matrices.)
So you can immediately see that $M$ is invertible if and only if both $A$ and $B-A$ are invertible.
Now in that product, the second and fourth matrices are of full rank.  Thus the product of the three rightmost matrices will have the same rank deficiency as that of $B-A$.  And then the rank deficiency of $M$ is always somewhere between 
the sum of the deficiencies of $A$ and $B-A$ as an upper bound, and the minimum of those two deficiencies as a lower bound.
