# Example of function between monoids that preserves operations but does not preserve identity [duplicate]

A function $f$ between monoids is a homomorphism if $f$ preserves operations and the identity. Then, there is some function between monoids that preserves operations but does not preserve the identity. I've tried to get it thinking about $(\mathbb N,+)$, $(\mathbb N\backslash\{0\} ,\times)$ and other elementary monoids, but without success. Could someone help me with some hint? Thank you!

## marked as duplicate by Leucippus, Daniel W. Farlow, Community♦Mar 21 '17 at 16:50

• Poking in the dark, but $f(x) = f(0 + x) = f(0) + f(x)$, and similarly $f(x) = f(x) + f(0)$. Does that not make $f(0)$ an identity? – Andrew Mar 16 '17 at 19:55
• @Andrew: it makes $f(0)$ an identity for the image of $f$, but you have no control over how $f(0)$ behaves with respect to the rest of the codomain. In general $f(0)$ can be any idempotent in the codomain. – Qiaochu Yuan Mar 16 '17 at 19:59
Consider the embedding $\iota:\mathbb{Z}\times\{0\}\hookrightarrow\mathbb{ Z}\times\mathbb{Z}$. This is clearly a homomorphism of semigroups, but it does not preserve the identity, because it maps $(1,0)\mapsto (1,0)$.