Rank of the Homomorphic image of a finitely generated abelian group I have been trying to find a relatively simple proof of the following result:

let $f$ be a group homomorphism such that $f: G \to K$ where $G$ and $K$ are groups. Then, $rank(f(G))\leq rank(G)$.

Could somebody please provide me with one? 
Thank you.
 A: I know two definitions of rank, one is the one for all groups, $\newcommand{\rank}{\operatorname{rank}}\rank(G)=\min \{|X| : X\subset G\text{ generates $G$.}\}$. The other is for abelian groups, and is defined by $\rank(G)=\max\{|X| : \not\exists_{a_i\in\mathbb{Z},x_i\in X} \sum_{i=0}^r a_i x_i =0\text{ unless all the $a_i=0$}\}$.
In the first case, if $X$ generates $G$, then $f(X)$ generates $f(G)$ since if $f(g)\in f(G)$, $g=\prod_{i=1}^n x_i$ for $x_i\in X$ since $X$ generates $G$. Thus $f(g)=\prod_{i=1}^n f(x_i)$, and $f(X)$ generates $f(G)$. $|f(X)|\le |X|$, so $\rank(f(G))\le \rank(G)$.
Otherwise, if $X$ is a set of linearly independent elements in $f(G)$, then for each element of $X$, choose a preimage in $G$, call this set $Y$.
Then if for some $a_i,y_i$ we had $$\sum_{i=0}^r a_iy_i=0,$$ we can take $f$ of both sides to get $$ f\left(\sum_{i=0}^r a_i y_i\right)=
\sum_{i=0}^ra_if(y_i) = f(0)=0.$$ However, this is a linear dependence among the elements of $X$, so all the $a_i$ must be 0. Thus $Y$ is linearly independent, with the same cardinality as $X$, so $\rank(G)\ge \rank(f(G))$.
Note that we need AC to choose the set $Y$ here, and possibly to show $|f(X)|\le |X|$ although I'm not sure about that part.
