TITLE: Homomorphisms from a unital ring to a ring with no zero divisors preserve unity?
QUESTION [13 upvotes]: I'm having a bit of trouble with a problem from Hungerford's Algebra concerning ring homomorphisms.

Let $f\colon R\to S$ be a homomorphism of rings such that $f(r)\neq 0$ for some nonzero $r\in R$. If $R$ has an identity and $S$ has no zero divisors, then $S$ is a ring with identity $f(1_R)$.

I've worked out a bit of an argument. Take $r$ to be as in the problem, so 
$$
f(r)=f(1_R)f(r)=f(r)f(1_R)\implies f(r)-f(1_R)f(r)=0_S.
$$
This shows that $f(1_R)$ is the identity of $f(R)$, but I'm not sure if that's much use. However, if $1_S$ exists, then from $f(r)-f(1_R)f(r)=1_Sf(r)-f(1_R)f(r)=0_S$ and the distributive law, I would have
$$
\bigl(1_S-f(1_R)\bigr)f(r)=0_S\implies 1_S=f(1_R)
$$
since $S$ has no zero divisors, and $f(r)\neq 0_S$. But I don't see a way to prove $1_S$ exists, so if it's no bother, I'm hoping to get a hint on how to show that, or perhaps a prod in the right direction if I'm off track. Thank you.

REPLY [8 votes]: Since the answer was not obvious to me immediately, I just want to post an answer so that the question has a full answer. 
Putting it together, $f(1_R)s=f(1_R)^2s\implies f(1_R)[s-f(1_R)s]=0_S$. But $f(1_R)\neq 0$ since $f(1_R)f(r)=f(r)\neq 0$, so $s=f(1_R)s$ since $S$ has no zero divisors. Since $sf(1_R)=sf(1_R)^2$ as well, the same argument shows $s=sf(1_R)$, so $f(1_R)=1_S$.