Relation between rank and number of distinct eigenvalues of a matrix
Since the nullity of $T$ is $n-k$, that means that the geometric multiplicity of $\lambda=0$ as an eigenvalue of $T$ is $n-k$; hence, the algebraic multiplicity must be at least $n-k$, which means that the characteristic polynomial of $T$ is of the form $x^{N}g(x)$, where $N$ is the algebraic multiplicity of $0$, hence $N\geq n-k$ (so $n-N\leq k$), and $\deg(g) =n-N$. Thus, $g$ has at most $n-N$ distinct roots, none of which are equal to $0$, and that means that the characteristic polynomial of $T$ has exactly: $$1 + \text{# distinct roots of }g \leq 1 + n-N \leq 1 + k$$ distinct eigenvalues.
Note that in fact we can say a bit better that $T$ has at most $\min\{k+1,n\}$ distinct eigenvalues (when the rank is $n$).
Here is an outline of one way to solve the problem.
- Eigenvectors for distinct eigenvalues are linearly independent.
- Eigenvectors for nonzero eigenvalues are in the range of $T$.
- The range of $T$ cannot contain a linearly independent set with more than $k$ vectors.