Prove that $T^2 = T \iff \text {rank}\ (T) + \text {rank}\ (I - T) = \dim V.$

Let $$V$$ be a finite dimensional vector space over $$\Bbb C$$ or $$\Bbb R$$ and let $$T$$ be a linear operator on $$V.$$ Prove that $$T^2 = T$$ if and only if $$\text {rank}\ (T) + \text {rank}\ (I - T) = \dim V.$$

"$$\implies$$" part $$:$$ By rank nullity theorem it follows that $$\text {rank}\ (T) + \text {nullity}\ (T) = \dim V.$$ So If we can show that $$\text {nullity}\ (T) = \text {rank}\ (I - T)$$ then we are through. Now since $$T^2 = T$$ it follows that $$T(I - T) = 0$$ which in turn implies that $$\text {Im}\ (I - T) \subseteq \text {Ker}\ (T).$$ Hence we have $$\text {rank}\ (I - T) \leq \text {nullity}\ (T).$$ Also for $$v \in \text {Ker}\ (T)$$ we have $$(I - T) (v) = v$$ i.e. $$v \in \text {Im} (I - T).$$ So $$\text {Ker}\ (T) \subseteq \text {Im}\ (I - T)$$ and hence we have $$\text {nullity}\ (T) \leq \text {rank}\ (I - T).$$ Combining this with the previous inequality we find that $$\text {rank}\ (I - T) = \text {nullity}\ (T),$$ as required.

Now how do I prove "$$\impliedby$$" part?

Any help will be highly appreciated. Thanks in advance.

If $$\operatorname{rank}(T) + \operatorname{rank}(I - T) = \dim V$$, then using the rank-nullity theorem on both $$T$$ and $$I - T$$, $$\operatorname{null}(T) + \operatorname{null}(I - T) = \dim V.$$ Note that $$v \in \operatorname{ker}(T) \cap \operatorname{ker}(I - T)$$ implies that $$Tv = 0$$ and $$0 = v - Tv = v$$, hence the two kernels sum directly to $$V$$. Hence, we can adjoin bases for each kernel together to make a full basis $$B$$ for $$V$$.
For the vectors $$v \in B$$ from $$\operatorname{ker}(T)$$, we note that $$(T - T^2)v = (I - T)Tv = (I - T)0 = 0$$.
For the vectors $$v \in B$$ from $$\operatorname{ker}(I - T)$$, we note that $$(T - T^2)v = T(I - T)v = T0 = 0$$.
Therefore, $$T - T^2$$ maps the basis $$B$$ to $$0$$, and thus by linearity, maps every vector to $$0$$. Therefore, $$T = T^2$$.