TITLE: Number of onto and into group homomorphisms between $\mathbb Z$ and $\mathbb Z$
QUESTION [8 upvotes]: How many homomorphisms are there of

$\mathbb Z$ onto $\mathbb Z$
$\mathbb Z$ into $\mathbb Z$

These two questions are from exercise 13, from book by John B. Fraleigh.
Answer of 1. is "two homomorphisms" and 2. is "infinite number of homomorphisms". I want to know difference between these, how to approach these problems.

REPLY [3 votes]: For the onto case
since $1$ is a generator of the cyclic group $(Z,+)$, $f(1)$ is also a generator of the image group $Z$. Now there are only two generators of $Z$ and they are $1$ and $-1$. So either $f(1)=1$ or $f(1)=-1$.
If $f(1)=1$, then $f(n)=n$ for all $n$.
If $f(1)=-1$ then $f(n)=-n$ for all $n$.
Thus there are only two homomorphisms