If $G,H$ are monoids and not groups, prove that $f(e_G)=e_H$ may be wrong. Problem: If $f:G\longrightarrow H$ is a homomorphism of groups, then $f(e_G)=e_H$ and $f(a^{-1})=f(a)^{-1}, \forall a\in G$. Show by example that the first conclusion may be false if $G, H$ are monoids that are not groups.

Solution: By contrary, let $\forall a\in G; f(e_G)=e_H$. But we have $f(a^{-1})=f(a)^{-1}$, so $f(a)f(a^{-1})=f(a)f(a)^{-1}\Longrightarrow f(aa^{-1})=f(a)f(a)^{-1}$, therefore $e_G=aa^{-1}$ and $e_H=f(a)f(a)^{-1}$ which is in contradiction with the assumption which says $G$ and $H$ are not groups.
I think my proof is a little shaky or maybe wrong. What is your solution?
 A: Usually we impose $f(e_G)=e_H$ as part of the definition of a monoid homomorphism, but for the purposes of this exercise let's assume instead a semigroup homomorphism only.
Your argument assumes the second part of the original propsition does hold true even if $G,H$ are not groups (you used $f(a)f(a)^{-1}=e_H$), but you cannot assume that.
The idea is that the image $f(G)\subset H$ should have a "local identity" which acts as an identity on the image $f(G)$ but not on the whole of $H$. An easy way to accomplish this: let $h\in H$ be idempotent (that is, $h^2=h$) but not $e_H$, and let $f(g)=h$ be a constant function.
A: The example given below shows that if $G $ , $H$ both are monoids then  the conclusion be false. 
A ring with $1$ is a monoid under multiplication, and ring homomorphisms do not have to send $1$ to $1$ (unless explicitly defined to do so). One example is the following:
$$M=(\Bbb Z\times\Bbb Z,\cdot)\\(a,b)\cdot(c,d)=(ac,bd)$$together with the function $$h:M\to M\\(a,b)\mapsto (a,0)$$ This function clearly satisfies the homomorphism property, but it doesn't send $e_M=(1,1)$ to $(1,1)$. 
