Show that $\dim \operatorname{im}(f) + \dim \ker(f) = \dim V$ Let $V,W$ be two finite dimensional vector spaces and $f$ is linear mapping from $V$ to $W$. Show that $\dim \operatorname{im}(f) + \dim \ker(f) = \dim V.$

Here is what I did. Please kindly give me a recommendation or help me to show this. Thank in advance!
Let $(e_1,e_2, \dots, e_n)$ be a basis for $V$ and $(e_1,e_2, \dots, e_k)$ be a basis for $\ker(f),k<n$.
We can get $$\dim V=n,\quad \dim \ker(f)=k$$
Then we need to prove that $\dim \operatorname{im}(f)=n-k$
Since $(e_1,e_2, \dots,e_n)$ is basis for $V$. $(e_1,e_2, \dots,e_n)$ spans V.
Let $x\in V$.There exists $\lambda_1,\lambda_2,\dots,\lambda_n\in\mathbb{K}$ such that
$$x=\lambda_1e_1+\lambda_2e_2+\cdots+\lambda_ne_n$$
$f$ is linear mapping
$$f(x)=f(\lambda_1e_1+\lambda_2e_2+\cdots+\lambda_ne_n)$$
$$f(x)=\lambda_1f(e_1)+\lambda_2f(e_2)+\cdots+\lambda_nf(e_n)$$
Which that $\operatorname{im}(f)=\{f(v)\in W | v\in V\}$
$$\operatorname{im}(f)=\operatorname{span}\{f(e_1),f(e_2),\dots,f(e_n)\}$$
Since $(e_1,e_2,\dots,e_n)$ is linearly independent.There exists $\alpha_1,\alpha_2,\dots,\alpha_k,\dots\alpha_n\in\mathbb{K},\quad k<n$
Which $\alpha_1=\alpha_2=\dots=\alpha_n=0$
$$\alpha_1e_1+\alpha_2e_2+\cdots+\alpha_ke_k+\alpha_{k+1}e_{k+1}+\cdots+\alpha_ne_n=0$$
$$f(\alpha_1e_1+\alpha_2e_2+\cdots+\alpha_ke_k+\alpha_{k+1}e_{k+1}+\cdots+\alpha_ne_n)=f(0)$$
$$\alpha_1f(e_1)+\alpha_2f(e_2)+\cdots+\alpha_kf(e_k)+\alpha_{k+1}f(e_{k+1})+\cdots+\alpha_nf(e_n)=0$$
Since $\ker(f)=\operatorname{span}\{e_1,e_2,\dots,e_k\}\Longrightarrow f(e_1)=f(e_2)=\dots=f(e_k)=0$.We can get
$$\alpha_{k+1}f(e_{k+1})+\cdots+\alpha_nf(e_n)=0$$
So that $\{f(e_{k+1}),\dots,f(e_n)\}$ is linearly independent.
We can get $\{f(e_{k+1}),\dots,f(e_n)\}$ is a basis for $\operatorname{im}(f)\Longrightarrow \dim \operatorname{im}(f)=n-k$.
 A: Unsure what you're allowed to assume, but I think about it like this. $\mathrm{Ker}(f) = K$ is a linear subspace and together with its orthogonal complement, the direct product spans $V$:
$$
V = K \oplus K^\perp
$$
Since $f$ restricted to $K^\perp$ is a linear function with trivial kernel, it is necessaritly true that $\left. f \right|_{K^{\perp}}$ is injective. This implies that $\mathrm{dim} \, K^\perp = \mathrm{dim} \, f(K^\perp)$.
The desired result follows from the fact that the dimension of $V$ is equal to the sum of the dimensions of the spaces in any equivalent direct product.
So:
$$
\begin{aligned}
\mathrm{dim}  \, V & = \mathrm{dim}  \, K \oplus K^\perp \\
 & =  \mathrm{dim}  \, K + \mathrm{dim} \, K^{\perp} \\
 & = \mathrm{dim} \, K + \mathrm{dim} \, f(K^{\perp}) \\
 & = \mathrm{dim} \, K + \mathrm{dim} \, f(V) \\
 & = \mathrm{dim} \, \mathrm{Ker}(f) + \mathrm{dim} \, \mathrm{Im}(f) 
\end{aligned}
$$
A: Your proof is better than mine because yours deals with linear transformations. I'm just giving you another perspective. Let $A$ be the $m\times n$ matrix for $f$ (wrt any choice of bases). Let $r$ be the rank of $A.$
$$\dim \operatorname{im}(f)=\dim(\text{column space of }A)=r$$
$\dim \ker(f) = n-r= $ the number of parameters when solving $AX=0.$
