Solution (source code)

= Solution

For a <linear map> $T:V\to W$ with $V$ finite-dimensional,
$$
\dim V=\operatorname{rk}T+\dim\ker T.
$$
Now
$$
\operatorname{rk}(\alpha\beta)=\dim\operatorname{im}\beta-dim(\ker\alpha\cap\operatorname{im}\beta)
\ge\operatorname{rk}\beta-\dim\ker\alpha,
$$
which is the required inequality after rank-nullity for $\alpha$.

If $X$ and $Y$ represent the same map, then $Y=C^{-1}XB$, where $B$ changes new domain coordinates to old ones and $C$ does the same in the codomain.

Invertible block row and column operations reduce
$$
\begin{pmatrix}P&Q\\R&S\end{pmatrix}
$$
to $\operatorname{diag}(P,S-RP^{-1}Q)$, proving the rank formula. Apply it to $\begin{pmatrix}I_n&Q\\R&I_m\end{pmatrix}$ first with the upper-left block and then with the lower-right block. Equating the results gives
$$
\boxed{\operatorname{rk}(I_n-QR)=\operatorname{rk}(I_m-RQ)+n-m.}
$$