Let's say D is the diagonalized form of A. Then the diagonal elements of D are precisely the eigenvalues of A. The rank of D is the number of linearly independent columns. Obviously this equals the number of non-zero eigenvalues. Since the rank of A and the rank of D are the same, the conclusion follows.