Finitely generated and residually finite implies Hopfian

Statement
Any finitely generated residually finite group (i.e., a group that is both finitely generated and  residually finite) is a Hopfian group.

Facts used

 * 1) uses::Finitely generated implies finitely many homomorphisms to any finite group
 * 2) uses::Residually finite and finitely many homomorphisms to any finite group implies Hopfian

Proof from given facts
The proof follows directly by piecing together facts (1) and (2).

Hands-on proof
Given: A finitely generated group $$G$$ that is also residually finite. A surjective homomorphism $$\varphi:G \to G$$.

To prove: $$\varphi$$ is an automorphism of $$G$$.

Proof: We prove this by contradiction.

ASSUMPTION THAT WILL LEAD TO CONTRADICTION: Suppose $$\varphi$$ is not an automorphism of $$G$$. Then, since it is surjective, it must fail to be injective, so there exists an non-identity element $$g$$ in its kernel.