Number of onto and into group homomorphisms between $\mathbb Z$ and $\mathbb Z$ 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.
 A: Note that a homomorphism from $f:\mathbb{Z}\rightarrow G$ to another group $G$ is completely determined by where it maps $1$. Indeed, take $n\in\mathbb{Z}$, then $f(n) = f(1+\cdots+1) = f(1)+\cdots+f(1) = nf(1)$. Now suppose we want a surjective homomorphism $f:\mathbb{Z}\rightarrow\mathbb{Z}$. Then some element must be mapped to $1$. Suppose $|f(1)|>1$. Then $|f(n)| = n|f(1)|>n$, so if we want surjectiveness we must have $|f(1)|\le 1$. The only options left are $-1,0,1$. Check that only two of these work. Can you do the injective part yourself now?
A: If $f\colon\mathbb{Z}\to\mathbb{Z}$ is a group homomorphism, then, setting $n=f(1)$, you have
$$
f(x)=nx
$$
for every $x\in\mathbb{Z}$ (prove it). So the image of $f$ is $n\mathbb{Z}$ and it should be clear for what $n\in \mathbb{Z}$ we have $n\mathbb{Z}=\mathbb{Z}$.
For $f$ being injective you need $\ker f=\{0\}$; but
$$
\ker f=\{x\in\mathbb{Z}:nx=0\}
$$
Can you finish?
For the final counting, note that, when you fix $n\in\mathbb{Z}$, the map $x\mapsto nx$ is a homomorphism of $\mathbb{Z}$ to $\mathbb{Z}$.
A: Just rewriting other people's answers. Let's say that $f(1) = m$ (it's gotta be something and I am just calling that something $m$, so I haven't made any assumptions yet).
I claim we know $f$ on the nose just from this data of $m$. Indeed, $f(2) = f(1 + 1) = 2m$, $f(3) = f(1 + 1 + 1) = 3m$, etc. It's clear that $f(n) = nm$ for $n$ positive (you can prove this by induction if you are feeling excessively formal). I'll leave it to you to prove this for $n$ negative (which is true).
So we have a formula for $f(n)$ automatically, just in terms of $f(1)$. (And conversely, this formula determines a homomorphism, so anything can be $f(1)$). This answers the second question. To see which ones are "onto," consider when $1$ can be in the image. That says that $1 = mn$ for some $n$. Since $m$ and $n$ are integers, the only possibilities are $m = n = -1$ and $m = n = 1$. That answers the first question (if $1$ is in the image, anything is in the image -- do you see why?).
A: 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
A: An onto homomorphism $f$ has the additional requirement that the image of $f$ is $\mathbb{Z}$ itself.
