I have learned in linear algebra that if $M,N$ are vector spaces, $M$ is $n-$dimensional and $f:M \rightarrow N$ is linear, then $\text{dim} (\text{ker}f) + \text{dim}(\text{Im}f)=n$. This is a consequence of:
$\text{ker}f \bigoplus \text{Im}f \cong M$
How can this proposition be extended? Here are two ways, supposing $A$ is a ring (with unity), $M,N$ are $A$-modules, $f$ is $A-$linear:
- $\text{Im}f$ is free
- $A$ is a principal ideal domain, $M$ is finitely generated and $N$ is torsion free
This proof works for any ring $A$ (unital or not). Let $f:M\to N$ be a homomorphism from a left $A$-module $M$ to another left $A$-module $N$ (both $M$ and $N$ are not necessarily unitary in the case where $A$ is unital). We have a short exact sequence $$0\to \ker(f)\overset{\subseteq}{\longrightarrow}M\overset{f}{\longrightarrow}\text{im}(f)\to 0\,.\tag{*}$$ Suppose that $\text{im}(f)$ is projective, such as when $A$ is unital and $\text{im}(f)$ is a free $A$-module. Therefore, the short exact sequence above splits, yielding $$M\cong\ker(f)\oplus\text{im}(f)\,.$$ This is also the case if $\ker(f)$ is injective, such as when $A$ is unital and $\ker(f)$ is a cofree $A$-module.
However, the most general answer would probably be that the short exact sequence (*) is splitting. That is, either can you find a section $\sigma:\text{im}(f)\to M$ such that $f\circ \sigma:\text{im}(f)\to\text{im}(f)$ is the identity map, or a retraction $\rho:M\to \ker(f)$ such that $\rho|_{\ker(f)}:\ker(f)\to\ker(f)$ is the identity map. This characterization is not very useful, I think.