TITLE: Simple characterization of integers among abelian groups
QUESTION [5 upvotes]: This is part of an early exercise in Freyd's abelian categories. Let $\mathscr{G}$ be the category of abelian groups. The group of integers is distinguished, up to isomorphism, by the facts that:

For every $A\in\mathscr{G}$ that is not a zero object, Hom$(\mathbb{Z},A)$ has more than one element.
If $f:\mathbb{Z}\rightarrow\mathbb{Z}$ is such that $f^2 = f$, then either $f$ is the identity or it is the zero map.

I am trying to prove that if $A\in\mathscr{G}$ satisfies these two properties, then it is isomorphic to $\mathbb{Z}$. From condition (1), I get two nontrivial maps $\alpha: A\rightarrow\mathbb{Z}$ and $\zeta:\mathbb{Z}\rightarrow A$. The composition $\alpha\circ\zeta:\mathbb{Z}\rightarrow\mathbb{Z}$ is also nontrivial so is necessarily an embedding hence $\zeta$ is injective. Next, since the image of $\alpha$ is a subgroup of $\mathbb{Z}$, it is cyclic, generated by $n$, say. Post-composing $\alpha$ with the map $p\mapsto\frac{p}{n}$ allows me to assume that $\alpha$ surjects.
At this point I'm stuck. I need to use property (2) but I do not see how.

REPLY [3 votes]: Let $G$ be an abelian group satisfying the above two properties.  Then there is a nonzero homomorphism $\phi: G \rightarrow \mathbb{Z}$.  The image of $G$ is a nonzero subgroup of $\mathbb{Z}$, say $n\mathbb{Z}$ for $n \geq 1$.  So as you say, we can choose to be $\phi$ surjective.  So there is an exact sequence of abelian groups $$0 \rightarrow \textrm{Ker } \phi \rightarrow G \xrightarrow{\phi} \mathbb{Z} \rightarrow 0$$ Now $\mathbb{Z}$ is a free $\mathbb{Z}$-module, so any exact sequence with $\mathbb{Z}$ on the right splits.  So there is a homomorphism $\iota: \mathbb{Z} \rightarrow G$ such that $\phi \circ \iota = 1_{\mathbb{Z}}$.  But then $$(\iota \circ \phi)^2 = \iota \circ \phi \circ \iota \circ \phi = \iota \circ 1_{\mathbb{Z}} \circ \phi = \iota \circ \phi$$ so either $\iota \circ \phi = 1_G$ or $\iota \circ \phi = 0$.  But we can't have $\iota \circ \phi = 0$.