Finding the rank of an non-invertible matrix I have a $3\times3$ matrix with three different eigenvalues $0,1, 2$. 
The question is: what is the rank of this matrix? If the matrix was invertible, I could say that the rank was equal to $n=3$. But as zero is an eigenvalue of this matrix, this matrix does not satisfy the Invertible Matrix Theorem. 
How should I determine the rank? Thanks in advance. 

*

*All eigenvalues are different, then the matrix is diagonalizable. 

*The corresponding diagonal matrix has the eigenvalues on the diagonal, i.e.
$$
S^{-1}AS=D=\left[\matrix{2 & 0 & 0\\0 & 1 & 0\\0 & 0 & 0}\right].
$$

*The matrices $A$ and $D$ have the same rank.

