Prove that the rank of a block diagonal matrix equals the sum of the ranks of the matrices that are the main diagonal blocks. 
*

*If $A$ and $B$ are matrices, $0$ is a zero matrix, and \begin{equation*}
X=
\begin{pmatrix}
A& 0
\newline
0& B
\end{pmatrix},
\end{equation*}
prove that $\mathrm{rank}(X)=\mathrm{rank}(A)+\mathrm{rank}B)$.

*Also, if the upper right zero matrix would be replaced with matrix $C$, that is, 
\begin{equation*}
X=
\begin{pmatrix}
A& C
\newline
0& B
\end{pmatrix}
\end{equation*}
would it still be true that $\mathrm{rank}(X)=\mathrm{rank}(A)+\mathrm{rank}B)$?

Suppose $A$ is $n \times n$ and $B$ is $m \times m$.
Looking at it row-wise, if you put together a maximal subset of linearly independent rows among the first $n$, and another such set among the second $m$ rows, then you get a subset of linearly independent rows for $X$. This shows $\operatorname{rank}(X) \ge \operatorname{rank}(A) + \operatorname{rank}(B)$. Reverse the argument to get the other inequality.
If you now allow
$$
\begin{equation*}
X=
\begin{pmatrix}
A& C
\newline
0& B
\end{pmatrix}
\end{equation*}
$$
just take $A = B = 0$, and $C \ne 0$ to see that the equality need not hold.
