TITLE: If $f^*:\mathrm{Hom}(H, R) \to \mathrm{Hom}(G, R)$ is an iso for all $R$, is $f: G\to H$ an iso?
QUESTION [6 upvotes]: Let $G$, $H$ be abelian groups and $f: G\to H$ a homomorphism. Assume that $f^*: \mathrm{Hom}(H, R) \to \mathrm{Hom}(G, R)$ (as morphisms of abelian groups, taking $R$ with its additive group structure) is an isomorphism for all commutative rings (with 1) $R$. Is then $f$ an isomorphism as well?
The question is motivated by a question on homological algebra, see here.

REPLY [2 votes]: For any abelian group $A$, take $R=\mathbb{Z}\oplus A$ with multiplication given by $(m,a)\cdot(n,b)=(mn,mb+na)$.  Then there are isomorphisms $\operatorname{Hom}(G,R)\cong\operatorname{Hom}(G,\mathbb{Z})\oplus\operatorname{Hom}(G,A)$ which are natural in $G$.  Thus a map $f:G\to H$ induces an isomorphism $\operatorname{Hom}(H, R) \to \operatorname{Hom}(G, R)$ iff it induces isomorphisms $\operatorname{Hom}(H, \mathbb{Z}) \to \operatorname{Hom}(G, \mathbb{Z})$ and $\operatorname{Hom}(H, A) \to \operatorname{Hom}(G, A)$.
In particular, a map satisfying your hypotheses induces isomorphisms $\operatorname{Hom}(H, A) \to \operatorname{Hom}(G, A)$ for all abelian groups $A$.  By Yoneda, it follows that such a map is an isomorphism.