Proof (rank-nullity)
Write $\dim U = N$ and $n(f) = m$. We have $m\leq N$ since $\mrm{kernel}(f)$ is a subspace of $U$. Also if $m=N$, then $f$ sends everything to $\vec 0$ so this is trivially true. Therefore we assume $m<N$.
Let $(\vec e_1, \vec e_2, \ldots, \vec e_m$) be a basis of $\mrm{kernel}(f)$. Extend this to a basis of $U$, $$ (\vec e_1, \vec e_2, \ldots, \vec e_m, \vec e_{m+1}, \vec e_{m+2}, \ldots, \vec e_N). $$
To prove the theorem, we need to show that $$ \big(f(\vec e_{m+1}), f(\vec e_{m+2}), \ldots, f(\vec e_N)\big) $$ is a basis of $\mrm{image(f)}$.
Firstly, we will show that this spans $\mrm{image}(f)$. For all $\vec y\in\mrm{image(f)}$, we have $\vec x\in U$ such that $f(\vec x) = \vec y$. Since $(\vec e_1, \ldots, \vec e_N)$ is a basis of $U$, $$\begin{align*} \vec y &= f(\vec x) \\ &= f(\alpha_1\vec e_1 + \ldots + \alpha_m\vec e_m + \alpha_{m+1}\vec e_{m+1} + \ldots + \alpha_N\vec e_N) \\ &= \underbrace{\alpha_1 f(\vec e_1) + \ldots + \alpha_m f(\vec e_m)}_{\vec 0 \text{ since } (\vec e_1,\ldots,\vec e_m) \text{ is a basis of } \mrm{kernel}(f)} + \alpha_{m+1} f(\vec e_{m+1}) + \ldots + \alpha_N f(\vec e_N) \\ &= \alpha_{m+1} f(\vec e_{m+1}) + \alpha_{m+2} f(\vec e_{m+1}) + \ldots + \alpha_N f(\vec e_N) \\ &\in \mrm{span}\{f(\vec e_{m+1}), f(\vec e_{m+2}), \ldots, f(\vec e_N)\} \end{align*}$$ so $(f(\vec e_{m+1}), f(\vec e_{m+2}), \ldots, f(\vec e_N))$ spans $\mrm{image}(f)$.
Next, we will show that this is linearly independent. Suppose for some scalars $\alpha_i$, $$ \alpha_{m+1} f(\vec e_{m+1}) + \ldots + \alpha_N f(\vec e_N) = \vec 0. $$ Then since $f$ is a linear map, $$ f(\alpha_{m+1}\vec e_{m+1} + \ldots + \alpha_N \vec e_N) = \vec 0. $$ This means that $\alpha_{m+1}\vec e_{m+1} + \ldots + \alpha_N \vec e_N \in \mrm{kernel}(f)$. Therefore it can be written as a linear combination of its basis, $(\vec e_1, \ldots, \vec e_m)$, $$\begin{align*} \alpha_{m+1}\vec e_{m+1} + \ldots + \alpha_N \vec e_N &= \alpha_1\vec e_1 + \ldots + \alpha_m \vec e_m \\ \vec 0&= \alpha_1\vec e_1 + \ldots + \alpha_m \vec e_m - \alpha_{m+1}\vec e_{m+1} - \ldots - \alpha_N \vec e_N. \end{align*}$$ But since $\vec e_1, \ldots, \vec e_N$ is a basis of $U$, they are linearly independent, so $$ \alpha_1 = \alpha_2 = \ldots = \alpha_{m+1} = \ldots = \alpha_N = 0. $$ Thus, $f(\vec e_{m+1}), \ldots, f(\vec e_N)$ are linearly independent, as required.