Q:

Describe all ring homomorphisms

Describe all ring homomorphisms of:
a) $\mathbb{Z}$ into $\mathbb{Z}$
b) $\mathbb{Z}$ into $\mathbb{Z} \times \mathbb{Z}$
c) $\mathbb{Z} \times \mathbb{Z}$ into $\mathbb{Z}$
d) How many homomorphisms are there of $\mathbb{Z} \times \mathbb{Z} \times \mathbb{Z}$ into $\mathbb{Z}$
Note: These were past homework questions and my professor already gave out answers. I just need someone to help me understand and approach this type of problem.
Thank you.

A:

$1$: All ring homomorphisms from $\mathbb{Z}$ to $\mathbb{Z}$ 
Let  $f: \mathbb{Z} \to \mathbb{Z} $ be a ring homomorphism. Note that for $n \in \mathbb{Z}$,
$f(n) = nf(1)$.
Thus $f$ is completely determined by its value on $1$.
Since $1$ is an idempotent in $\mathbb{Z} $ (i.e. $1^2 = 1$), then $f(1)$
is again idempotent.
Now we need to determine all of the idempotents of $\mathbb{Z} $. To this end, take $x\in \mathbb{Z}$ such that
$x^2 = x$. Thus $x^2 − x = x(x − 1) = 0$. Since $\mathbb{Z} $ is an integral domain, we deduce that either $x = 0$ or $x = 1$. Thus the
complete list of idempotents of $\mathbb{Z} $ are $0$ and $1$. Thus $f(1)$ being idempotent implies that either $f(1) = 0$ or $f(1) = 1$. In the
first case, $f(n) = 0$ for all $n$ and in the second case $f(n) = n$ for all $n$. Thus,
the only ring homomorphisms from $\mathbb{Z} $ to $\mathbb{Z} $ are the zero map and the identity map.
$2$: All ring homomorphisms from $\mathbb{Z}$ to $\mathbb{Z}\times \mathbb{Z}$
Let $f$ be such a ring homomorphism. Suppose that
$f(1) = (a, b) $, with $a, b \in \mathbb{Z} $. Since $f$ is a ring homomorphism it follows that In particular,
$f(m) = f(m · 1) = m · f(1) = m(a, b)$ (follows from the additivity of $f$). On the other hand,  $f$ preserves multiplication. That is, $f(mn) = f(m)f(n)$. Thus, we
have 
$mn(a, b) = m(a, b) · n(a, b)$ iff
$mn(a, b) = mn(a^2, b^2)$ iff
$(a, b) = (a^2, b^2)$ if $mn\neq 0$.
This last inequality only holds if $a = 0, 1$ and $b = 0, 1$. It follows that there are four
ring homomorphisms which are given by
$f_1(1) = (0, 0)$,
$f_2(1) = (1, 0)$,
$f_3(1) = (0, 1)$,
$f_4(1) = (1, 1)$.
More explicitly, these are
$f_1(m) = (0, 0)$,
$f_2(m) = (m, 0)$,
$f_3(m) = (0,m)$,
$f_4 (m) = (m,m)$.
$3$: All ring homomorphisms from  $\mathbb{Z}\times \mathbb{Z}$ to $\mathbb{Z}$
Since $\mathbb{Z}\times \mathbb{Z}$ is generated by $(1, 0)$ and $(0, 1)$, it suffices to find to find $f(1, 0)$ and $f(0, 1)$
Leaving this for you.
$4$: All ring homomorphisms from  $\mathbb{Z}\times \mathbb{Z}\times \mathbb{Z}$ to $\mathbb{Z}$
Hint. Find  $f(1, 0, 0)$ $f(0, 1, 0)$
and $f(0, 0,1)$

A:

There is only one ring homomorphism from $\mathbb{Z}$ to any ring $S$ (assuming that ring homomorphisms preserve $1$).
This homomorphism is uniquely determined because a ring homomorphism $f\colon R\to S$ has the property that
$$f(nx) = n f(x)$$
for all $x\in R$ and $n\in\mathbb{Z}$ (easy induction). Since in $\mathbb{Z}$ we have $n=n\cdot1$, for $f\colon\mathbb{Z}\to S$ we must have $f(n)=nf(1)=n\cdot1$. The assignment
$$f(n)=n\cdot1$$
indeed defines a ring homomorphism from $\mathbb{Z}$ to any ring $S$. Its kernel is an ideal of the form $k\mathbb{Z}$ $(k\ge0)$ and $k$ is the characteristic of $S$.
This answers your first two questions.
Let now $f\colon \mathbb{Z}\times\mathbb{Z}\to \mathbb{Z}$ be a ring homomorphism. Since
$$(1,0)(0,1)=(0,0)$$
we have that $f(1,0)f(0,1)=0$, so either $f(1,0)=0$ or $f(0,1)=0$. Not both, because $(1,1)=(1,0)+(0,1)$ is the identity on $\mathbb{Z}\times\mathbb{Z}$ and we want $f(1,1)=1$. Moreover we see that
$$f(0,1)=1-f(1,0).$$
If $f(1,0)=1$ and $f(0,1)=0$, then $f$ is completely determined: we must have
$$f(m,n)=f\bigl(m(1,0)+n(0,1))=mf(1,0)+nf(0,1)=m$$
It's easy to check that this indeed defines a ring homomorphism. Similarly
$$g(m,n)=n$$
defines another ring homomorphism and the list is complete.
For $\mathbb{Z}\times\mathbb{Z}\times\mathbb{Z}$ the reasoning is similar. Consider
$$(1,0,0)+(0,1,0)+(0,0,1)=(1,1,1)$$
and the fact that two among $f(1,0,0)$, $f(0,1,0)$ and $f(0,0,1)$ must be $0$.

