TITLE: To show that $\operatorname{Rank}(\mathbf{A}-\mathbf{I})=\operatorname{Nullity}(\mathbf{A})$
QUESTION [7 upvotes]: Problem is:

Let $\mathbf{A}$ be $n\times n$ matrix with real entries such that $\mathbf{A}^{2} = \mathbf{A}$. If $\mathbf{I}$ denotes the identity matrix, then how do I prove the result: $$\operatorname{Rank}(\mathbf{A}-\mathbf{I})=\operatorname{Nullity}(\mathbf{A})$$ 

I have trivially shown by taking $\mathbf{A}=\mathbf{I}$, but in general I do not know how to prove this, thanks for help.

REPLY [3 votes]: here is what i think is a shorter proof of $$ A^2 = A \implies ker(A) = image(A-I)  $$ 
proof: write $A^2 = A$ as $A(A-I) = 0$ this means that every column of $A-I$ is in $ker(A),$ therefore $image(A-I) \subset ker(A).$ 
to show the other direction, pick $x \in ker(A),$ so that $Ax = 0.$ 
then $x = x - Ax = (I-A)x$ that is $x \in image(A-I)$ that proves $\ker(A) \subset image(A-I)$
now the result $$rank(A-I) = dim(ker(A)) = nullity(A)$$  follows.
p.s.: this seems too good to be true. i hope i did not make any logical errors.