Show if $A^2 = A$ then $\textrm{rank}(A) + \textrm{rank}(A - I) = n$ suppose $n \in \mathbb{N}$ and $A$ is a $n \times n$ idempotent matrix, meaning $A^2 = A$.
show that:
$$
\textrm{rank}(A) + \textrm{rank}(A - I) = n
$$

I think we should first use rank-nullity theorem:
$$
\textrm{rank}(A) + \textrm{dim}(\textrm{null}(A)) = n
$$
then show that:
$$
\textrm{dim}(\textrm{null}(A)) = \textrm{rank}(A - I)
$$
but I don't know how to show the second phrase.

Since $A(A-I) = 0$, the eigenvalues of $A$ are $0,1$, and the matrix is diagonalizable. The rank of $A$ is the number of non-zero eigenvalues, which is the multiplicity of the eigenvalue $1$. Similarly, the rank of $A-I$ is the number of eigenvalues different from $1$, which is the multiplicity of the eigenvalue $0$. The sum of these multiplicities must be $n$.
