TITLE: Lower bound for $\|A-B\|$ when $\operatorname{rank}(A)\neq \operatorname{rank}(B)$, both $A$ and $B$ are idempotent
QUESTION [5 upvotes]: Let's first focus on $k$-by-$k$ matrices. We know that rank is a continuous function for idempotent matrices, so when we have, say, $\operatorname{rank}(A)>\operatorname{rank}(B)+1$, the two matrices cannot be close in norm topology.
But I wonder whether there is an explicit lower bound of the distance between two idempotent matrices in terms of their difference in their ranks. 
Thanks!

REPLY [3 votes]: Here is a generalization of a special case, namely the case of self-adjoint idempotents.  
Suppose that $p$ and $q$ are self-adjoint idempotents (projections) in a C*-algebra $A$.  If $\|p-q\|<1$, then there is a continuous path of projections in $A$ from $p$ to $q$.  If $A$ is unital, this implies that $p$ and $q$ are unitarily equivalent.  In general, it implies that there is a partial isometry $v\in A$ such that $v^*v=p$ and $vv^*=q$. This is shown in Chapter 2 of Rørdam et al.'s An introduction to K-Theory for C*-algebras
In the case where $A=M_n(\mathbb C)$, this tells us that $\|p-q\|<1$ implies that $\mathrm{rank}(p)=\mathrm{Tr}(v^*v)=\mathrm{Tr}(vv^*)=\mathrm{rank}(q)$, a special case of Robert Israel's answer.  
On a related note, it isn't too hard to show that if $p$ and $q$ are arbitrary projections in a C*-algebra, then $\|p-q\|\leq 1$.  More generally, if $a\geq 0 $ and $b\geq 0$ in a C*-algebra, then $\|a-b\|\leq \max\{\|a\|,\|b\|\}$.  In particular, if $p$ and $q$ are self-adjoint idempotent matrices of different ranks, then $\|p-q\|=1$.