Residually finite not implies Hopfian

Statement
A residually finite group need not be a Hopfian group.

Related facts

 * Finitely generated and residually finite implies Hopfian
 * Hopfian not implies residually finite

Proof
Consider an infinite-dimensional vector space over a field, or more generally, any infinite external direct power or restricted external direct power of a nontrivial finite group


 * 1) This is residually finite: For any non-identity element, find any coordinate where it takes a non-identity value and consider the normal subgroup of those elements that are the identity at that coordinate. (Equivalently, the quotient map here is projection on that coordinate).
 * 2) This is not Hopfian: Suppose $$I$$ is the indexing set. Pick $$i \in I$$ and consider a bijection $$I \setminus \{ i \} \to I$$. By coordinate shifting, this induces an isomorphism from the quotient by the $$i^{th}$$ coordinate subgroup to the whole group, and hence, a surjective endomorphism of the whole group that is not injective. Explicitly, if $$H_j, j \in I$$ are all copies of a nontrivial finite group $$H$$, and $$G$$ is the product of the $$H_j$$s, then a bijection $$I \setminus \{ i \} \to I$$ induces an isomorphism $$G/H_i \to G$$ which thus gives a surjective endomorphism from $$G$$ to $$G$$ with nontrivial kernel.