"Term Rewriting and All That" - Exercise 3.10 I am studying Term Rewriting by reading Baader/Nipkow's book &quot;Term Rewriting and All That&quot;. I am in chapter 3 - Universal Algebra, in the section 3.2 - Algebras, homomorphism and congruences. I am trying to do exercise 3.10:

Let $\mathcal{Z}$ be the additive group of integers.
(a) - Determine all subalgebras of $\mathcal{Z}$ and all congruences on $\mathcal{Z}$.
(b) - Characterize those subsets of $\mathbb{Z}$ of cardinality 2 that generate $\mathcal{Z}$.
(c) - Given the integers $a, b, c \in \mathbb{Z}$, we define the mapping $h_{}: \mathbb{Z} \rightarrow \mathbb{Z}$ by: $$h_{(a, b, c)}(z) := az^2 + bz + c.$$
For what triples (a, b, c) is $h_{(a, b, c)}$ an endomorphism of $\mathcal{Z}$?
(d) - Given the integers $a, b$, we define the mapping $g_{(a, b)}: \mathbb{Z} \times \mathbb{Z} \rightarrow \mathbb{Z}$ by $$ g_{(a, b)}(z_1, z_2) := a z_1 + b z_2 .$$
Show that $g_{(a, b)}$ is a homomorphism of the direct product $\mathcal{Z} \times \mathcal{Z}$ into $\mathcal{Z}$. For what tuples $(a, b)$ is $g_{(a, b)}$ onto?

I think I was able to do items (a), (b) and (c), but I am having problems with item (d).
For item (a):

The subalgebras of $\mathcal{Z}$ are all of the form $\mathcal{nZ}$ where the carrier is $\mathbb{nZ} \ := \ \{ n z \ |\ z \in \mathbb{Z} \}$. This subalgebra is generated by $\{ n \}$.
The congruences on $\mathcal{Z}$ are all of the form $\equiv_{n} := \ \{(z_1, z_2) \ | \ n \text{ is a divisor of } z_1 - z_2 \}$.

For item (b):

A subset of cardinality 2 $\{ z_1, z_2 \}$ generates $\mathbb{Z}$ if and only if it generates {1}. This happens if and only if $gcd(z_1, z_2) = 1$. So, the subsets of $\mathbb{Z}$ of cardinality 2 that generate $\mathcal{Z}$ are of the form $\{z_1, z_2 \ | \ gcd(z_1, z_2) = 1 \}$.

For item (c):

It suffices to guarantee that $h(z_1) + h(z_2) = h(z_1 + z_2)$ for all $z_1, z_2$. Notice that:
$h(z_1) + h(z_2) = a (z_{1}^{2} + z_{2}^2) + b (z_1 + z_2) + c $
$h(z_1 + z_2) = a (z_{1} + z_{2})^2 + b (z_1 + z_2) + c$
Since this equality must hold for all $z_1, z_2$, we must have $a (z_{1}^{2} + z_{2}^2) = a (z_{1} + z_{2})^2$ for all $z_1, z_2$. This is only possible if $a = 0$. There are no restrictions on $b$ and $c$. So, the triples $\{(0, b, c) \}$ make $h_{(a, b, c)}$ an endomorphism of $\mathcal{Z}$.

For item (d), I was able to prove that $g(a, b)$ is a homomorphism of the direct product $\mathcal{Z} \times \mathcal{Z}$ into $\mathcal{Z}$:

Taking arbitraries $z = (z_1, z_2)$ and $z' = (z'_1, z'_2)$ in $\mathcal{Z} \times \mathcal{Z}$ we have:
$$g(z) + g(z') = (a z_1 + b z_2) + (a z'_1 + b z'_2) = a (z_1 + z'_1) + b (z_2 + z'_2) = g(z + z')$$

But I couldn't prove for what tuples $(a, b)$ we have that $g_{(a, b)}$ onto.
Can anyone help me with this part of item (d)?
Also, are my proofs of items (a), (b) and (c) correct? Thanks in advance.
If we can find $(z_1, z_2)$ such that $a z_1 + b z_2 = 1$ then we can take $(k z_1, k z_2)$ to obtain an arbitrary number $k (a z_1 + b z_2) = k \in \mathbb{Z}$ and then it is proved that $g_{(a, b)}$ is onto. However, every linear combination of two numbers $(a, b)$ is a multiple of their $gcd$. So, $g_{(a, b)}$ is onto if and only if $gcd(a, b) = 1$.