A rank identity Let $A,B$ be $n\times n$ matrix, $A^2=A$, $B^2=B$, how to show $\operatorname{rank}(A-B)=\operatorname{rank}(A-AB)+\operatorname{rank}(B-AB)$.
It seems impossible to reduce $\left(\begin{array}{cc}
 A-AB&0\\
0&B-AB
\end{array}\right)$ to be $\left(\begin{array}{cc}
A-B&0\\
0&0
\end{array}\right).$ 
 A: Since $A^2=A$, $\operatorname{range}(A)\cap\operatorname{range}(I-A)=0$. Therefore
\begin{align}
\operatorname{rank}(A-B)
&=\operatorname{rank}\left[A(A-B)+(I-A)(A-B)\right]\\
&=\operatorname{rank}(A(A-B))+\operatorname{rank}((I-A)(A-B))\\
&=\operatorname{rank}(A-AB)+\operatorname{rank}(B-AB).
\end{align}
A: The mistake I made is that when doing row operation matrix has to be multiplied on the left, when column operation it's on the right.

It seems like
$$\begin{align*}
\pmatrix{
 A-AB & 0\\
 0 & B-AB
}&\to\pmatrix{
 A-AB & (A-AB)+-(B-AB)\\
 0 & B-AB
}\\
&\to\pmatrix{
 A-AB & A-B\\
 0 & B-AB
}\\
&\to\pmatrix{
 A(A-B) & A-B\\
 0 & (B-A)B
}\\
&\to\pmatrix{
 0 & A-B\\
 -A(B-A)B & (B-A)B
}\\
&\to\pmatrix{
 0 & A-B\\
 -AB+AB & (B-A)B
}\\
&\to\pmatrix{
 0 & A-B\\
 0 & 0
}
\end{align*}$$
In your question \begin{array} $\mapsto$ \begin{array}{cc} to fix $-AB\mapsto A-AB$, and $-B\mapsto A-B$. I made an edit suggest but it didn't show.

Edit:
As OP pointed out I have made a mistake but let me keep it there. Now let me fix it
$$\begin{align*}
&\to\pmatrix{
 A(A-B) & A-B\\
 0 & (B-A)B
}\\
&\to\pmatrix{
 A(A-B)+(A-B)B & A-B\\
 (B-A)B & (B-A)B
}\\
&\to\pmatrix{
 A-B & 0\\
 (B-A)B & 0\\
}\\
&\to\pmatrix{
 A-B & 0\\
 -A(A-B)+(B-A)B & 0
}\\
&\to\pmatrix{
 A-B & 0\\
 B-A & 0
}\\
&\to\pmatrix{
 A-B & 0\\
 0 & 0
}\end{align*}$$
