Direct sums and idempotent transformations

Let T:VV be a linear transformation on a finite-dimensional vector space. Prove that if T2=T, then

V=ker(T)im(T).