I am quite confused about this. I know that zero eigenvalue means that null space has non zero dimension. And that the rank of matrix is not the whole space. But is the number of distinct eigenvalues ( thus independent eigenvectos ) is the rank of matrix?
Well, if $A$ is an $n \times n$ matrix, the rank of $A$ plus the nullity of $A$ is equal to $n$; that's the rank-nullity theorem. The nullity is the dimension of the kernel of the matrix, which is all vectors $v$ of the form: $$Av = 0 = 0v.$$ The kernel of $A$ is precisely the eigenspace corresponding to eigenvalue $0$. So, to sum up, the rank is $n$ minus the dimension of the eigenspace corresponding to $0$. If $0$ is not an eigenvalue, then the kernel is trivial, and so the matrix has full rank $n$. The rank depends on no other eigenvalues.