Show that $\operatorname{rank}(A)=\operatorname{rank}(B)$ Let $A$ and $B$ be two $n\times n $ real matrices, satisfying $A^2=A,\,\, B^2=B$. Suppose $A+B-I$ is invertible. Show that $\operatorname{rank}(A)=\operatorname{rank}(B)$.
Since $ A^2=A,\,\, B^2=B$ we see that $A$, $B$ are either singular matrices or matrices with determinant $1$.
Any ideas on how to proceed from here?
 A: If $A^2=A$ we have that the minimum polynomial of $A$ has distinct roots and so $A$ is diagonalizable and its only eigenvalues are $1$ and $0$.
We conclude the geometric multiplicities of eigenvalues $1$ and $0$ add $n$.
So if we suppose $\dim(\ker(A)) < \dim(\ker(B))$ we conclude the eigenspace of $1$ of $A$ and the kernel of $B$ intersect non-trivially.
Any such non-zero vector in this intersection is an eigenvector for the eigenvalue $1$ of $A+B$. Or equivalently, is in the kernel of $A+B-I$.
A: Let $C=I-A$. Then $$C^2 =(I-A)^2=I-2A+A^2=I-A=C\ .$$
So $C$ is a projection onto its image. An element $v$ in the vector space $V=\Bbb R^n$ has then the unique decomposition $v=(I-A)v+Av$ as a sum of an element in the kernel of $A$, $(I-A)v$, and an element in the image of $A$, $Av$. The kernel of $A$ is the image of $C$ and conversely. So we have to show that if $B-C$ is invertible, the $B,C$ have complementary dimensions for the kernels. Or for the images, whatever we prefer.
If the kernels have sum of dimensions $>n$, we find a non-zero $v$ in the intersection of these kernels, so $(B-C)v=Bv-Cv=0-0=0$, contradiction.
If the kernels have sum of dimension $<n$, then the images exceed, we find  a non-zero $w$ with $w=Bw=Cw$, so $(B-C)w=0$. Contradiction again.
