Group of mappings containing an injective map is a subset of symmetric group 
Let $G$ be a group of mappings on a set $X$ with respect to function composition. Show that if $G$ contains some injective function, then $G\subseteq \text{Sym}(X)$.

What I did: If $X$ is finite, then the injective mapping $g\in G$ is also bijective. Suppose the identity $i\in G$ is not bijective. Then $gi=g$ is not bijective, impossible, so $i$ must be bijective. Then any $h\in G$ must be bijective because of the existence of $h^{-1}$ such that $hh^{-1}=i$. So $G\subseteq\text{Sym}(X)$ indeed.
But when $X$ is infinite, the injective mapping is no longer necessarily bijective, and the whole argument breaks down.
 A: Here's a recipe for how you can do it:


*

*Prove that $i$ is injective

*Prove every $h\in G$ is injective

*Prove that $i$ is surjective (consider $i=i^2$)

*Prove every $h\in G$ is surjective


At each stage, employ proof by contradiction. Spoiler:

 Suppose $g\in G$ is injective. Suppose that $i$ is not injective. Then $gi=g$ is not injective, absurd, so $i$ is injective. Suppose $h\in G$ is not injective. Then $h^{-1}h=i$ is not injective, absurd, so every element of $G$ is an injective function. Suppose $i\in G$ is not surjective. Then $\exists x\in X$ such that $x\not\in i(X)$. But then $i(x)\in i(X)$, but $i(x)=i^2(y)\implies x=i(y)$ hence $i(x)\not\in i^2(X)$, hence $i\ne i^2$, a contradiction. Hence $i$ is surjective. Suppose now that $h\in G$ is not surjective. Then $h h^{-1}=i$ is not surjective, a contradiction. Hence every element is surjective as well as injective.

A: If $G$ contains an injective map then it suffices to show that the identity of $G$ must be the identity of the monoid $X^X$, i.e. the identity map.
Let $e$ be the identity of $G$ and $f$ an injective function in $G$, then $f(e(x)) = e(x)$ for all $x \in X$. 
Hence, $e$ is also injective. 
This is sufficient to show that $e(x) = x$ for all $x \in G$ since $e(e(x)) = e(x)$. 
