A problem regarding the rank of a matrix
We want to show that $$ r(A-B) = r(A - AB) + r(AB - B). $$
By the claim proven below, it suffices to show that $A - AB$, $AB - B$ have trivially intersecting row-spaces and trivially intersecting kernels.
To show that the row-spaces intersect trivially, note that $$ \operatorname{im}(A - AB)^T = \operatorname{im}((I - B)^TA^T) \subset \operatorname{im}(I-B)^T,\\ \operatorname{im}(AB - B)^T = \operatorname{im}(B^T(I - A^T)) \subset \operatorname{im}(B)^T.\\ $$ However, we have $\operatorname{im}(B)^T \cap \operatorname{im}(I-B)^T = \{0\}$. To see this: if $x$ is in the first space, then $(I - B^T)x = 0$ which means that $B^Tx = x$. If $x$ is in the second space, then $B^Tx = 0$. For both to be true, we must have $x = 0$.
We now show that the kernels intersect trivially. Suppose that $x \in \ker(A-B)$, i.e. $(A-B)x = 0$. This can be rewritten as $$ (A - B)x = 0 \implies Ax - Bx = 0 \implies Ax = Bx. $$ It follows that $$ (A - AB)x = Ax - A(Bx) = Ax - A(Ax) = (Ax - A^2)x = 0. $$ Similarly, $$ (AB - B)x = A(Bx) - (Bx) = A(Ax) - (Ax) = (A^2 - A)x = 0. $$ So, $x \in \ker(A-B)$ implies that $x \in \ker(A - AB)$ and $x \in \ker(AB - B)$. The conclusion follows.
Claim: given $P,Q$ with $\operatorname{im}(P^T)\cap \operatorname{im}(Q^T) = \{0\}$, we have $$ r(P + Q) = r(P) + r(Q) \iff \ker(P + Q) = \ker(P) \cap \ker(Q). $$
Proof: $$ \ker(P + Q) = \ker(P) \cap \ker(Q) \iff\\ \operatorname{im}(P^T + Q^T) = \operatorname{im}(P^T) + \operatorname{im}(Q^T) \iff\\ \dim \operatorname{im}(P^T + Q^T) = \dim \operatorname{im}(P^T) + \dim \operatorname{im}(Q^T) - \dim[\operatorname{im}(P^T) \cap \operatorname{im}(Q^T)] \iff\\ \dim \operatorname{im}(P^T + Q^T) = \dim \operatorname{im}(P^T) + \dim \operatorname{im}(Q^T) \implies\\ r(P + Q) = r(P) + r(Q). $$
Let $F$ be the underlying field, $V=F^n,\,A'=I-A$ and $B'=I-B$. Then $A'$ and $B'$ are also projectors and $AA'=A'A=BB'=B'B=0$. We have two observations:
- $r(AB')+r(A'B)=r(AB'-A'B)$:
- Since $AB'V\cap A'BV\subseteq AV\cap A'V=0$, we have $AB'V\cap A'BV=0$. Hence \begin{aligned} r(AB')+r(A'B)&=\dim(AB'V)+\dim(A'BV)\\ &=\dim(AB'V)+\dim(A'BV)-\dim(AB'V\cap A'BV)\\ &=\dim(AB'V+A'BV). \end{aligned}
- For any $x,y\in V$, we have $AB'x+A'By=(AB'-A'B)(B'x-By)$. Hence $AB'V+A'BV\subseteq (AB'-A'B)V$ and $$ \dim(AB'V+A'BV) \le\dim\left((AB'-A'B)V\right) =r(AB'-A'B) \le r(AB')+r(A'B). $$
- $r(AB'-A'B)=r(A-B)$: by rank-nullity thm, it suffices to show that $\ker(AB'-A'B)=\ker(A-B)$:
- Suppose $(AB'-A'B)x=0$. Left-multiply both sides by $A$, we get $AB'x=0$. Subtract this equation from the previous one, we obtain $A'Bx=0$ too. Now $AB'x=0$ and $A'Bx=0$ imply that $Ax=ABx$ and $Bx=ABx$ respectively. Hence $(A-B)x=0$.
- Conversely, suppose $(A-B)x=0$. Then $Ax=Bx$ and $A'x=B'x$. Hence $(AB'-A'B)x=AB'x-A'Bx=AA'x-A'Ax=0$.
The result now follows from 1 and 2.