Solution (source code)

= Solution

The <rank-nullity theorem> states that a <linear map> $T:V\to W$ with finite-dimensional $V$ satisfies
$$
\boxed{\dim V=\operatorname{nullity}T+\operatorname{rank}T.}
$$
Choose a <basis> $k_1,\ldots,k_r$ of $\ker T$ and use <basis extension> to obtain a <basis> $k_1,\ldots,k_r,u_1,\ldots,u_s$ of $V$. We prove that $Tu_1,\ldots,Tu_s$ is a <basis> of $\operatorname{im}T$.

Every $v\in V$ is a <linear combination> of the extended <basis>. Applying $T$ kills the $k_i$ terms, so $Tv$ is a <linear combination> of $Tu_1,\ldots,Tu_s$. This proves the <linear span> assertion. For <linear independence>, if $\sum_j b_jTu_j=0$, then $\sum_j b_ju_j$ belongs to the <kernel of a linear map>. Hence $\sum_j b_ju_j=\sum_i a_ik_i$ for some <scalars> $a_i$. The <linear independence> of the extended <basis> forces every $a_i$ and $b_j$ to vanish. Consequently $\operatorname{rank}T=s$ and $\operatorname{nullity}T=r$, while $\dim V=r+s$, proving the theorem.