When does $V = \ker(f) \oplus \operatorname{im}(f)$?

For a vector space $V$ and a linear operator $f : V \to V$, under what conditions does $V = \ker(f) \oplus \operatorname{im}(f)$?

Is it always true, or only in special cases?

Edit: $V$ is finite dimensional.

Solutions Collecting From Web of "When does $V = \ker(f) \oplus \operatorname{im}(f)$?"

$\def\im{\operatorname{im}}$As from the rank-nullity theorem as Matt remarked we always have
$$ \dim\ker f + \dim\im f = \dim V $$
the only thing that is missing in the finite-dimensional case, is $\ker f \cap \im f = 0$, that is $f|_{\im f}\colon \im f \to V$ has to be one-to-one.

This is sometimes true, for example for projections (that is idempotent) $f$ where you have $f^2 = f$, and hence a $y =f(x)\in \im f$ with $f(y) = 0$ has $$0 = f(y) = f^2(x) = f(x) = y.$$
Sometimes it is not true, consider for example
$$ f = \begin{pmatrix} 0 & 1 \\ 0 & 0\end{pmatrix} \colon \mathbb R^2 \to \mathbb R^2 $$
Here you have $\ker f = \im f = \operatorname{span} e_1$, so $f|_{\im f} = 0$ is not one-to-one.

I’m not quite sure if something general can be said in the infinite-dimensional-case.

This is true if and only if $\dim\ker f$ equals the multiplicity of $0$ as (possible) eigenvalue of $f$, in other words if the geometric and algebraic multiplicites of this eigenvalue are equal.

One may assume the base field to be algebraically closed (so for instance interpret some matrix of $f$ as a complex matrix if the base field was $\mathbf R$), in which case one has an $f$-stable direct sum decomposition into generalised eigenspaces $E_\lambda$ for $f$, and we can consider the question separately on each subspace $E_\lambda$. For any $\lambda\neq0$, the restriction $f|_{E_\lambda}$ of $f$ to $E_\lambda$ is invertible, so $\ker(f|_{E_\lambda})=0$ and $\operatorname{im}(f|_{E_\lambda})=E_\lambda$, and we have $ E_\lambda=\ker(f|_{E_\lambda})\oplus \operatorname{im}(f|_{E_\lambda})$ trivially. However for $\lambda=0$ we have $E_0=\ker(f^k)$ for some $k\geq1$; if $E_0\supset \ker(f)$ strictly (so one cannot take $k=1$) then for $v\in E_0\setminus \ker(f)$ the last non-zero vector among $f(v)\neq0,f^2(v),\ldots,f^k(v)=0$ lies in $\ker(f)\cap \operatorname{im}(f)$ proving that the sum is not direct. So a necessary and sufficient condition for the sum to be direct is that $E_0=\ker(f)$. And $\dim E_0$ is the algebraic multiplicity of $\lambda=0$.

In Hilbert spaces (spaces with scalar product) you have that

$$\ker (B^*) = (\operatorname{ran} B)^\perp,$$

Where $\operatorname{ran}$ is the range, i.e., what you call image;
the $B^*$ is the adjoint operator, defined by the prescription $$(Bx,y)=(x,B^*y);$$
and $U^\perp$ is the orthogonal complement to $U$, i.e.
$$U^\perp=\{v:(\forall u\in U)((u,v)=0)\}.$$

There is a wide class of Hermitean operators, i.e. such that $B=B^*$. All these satisfy $\ker B = (\operatorname{ran} B)^\perp$ therefore $\ker B\oplus \operatorname{ran} B=V$.

In the finite-dimensional case, every Hermitean matrix (i.e., $a_{ij}=\overline{a_{ji}}$) satisfies this property.

Consider Jordan matrix form, what you need is that $W_0=V_0$ where $W_0$ is the generalized eigenspace for the eigenvalue $0$.
So $f_{|_{W_0}}$ must be diagonalizable, that’s it.