Injective homomorphism between two finite groups with the same order

I want to show given two groups $$G,H$$ and the homomorphism $$f:G\rightarrow H$$ injective with $$\text{ord}(G)=\text{ord}(H)<\infty$$, then $$f$$ is bijective.

Thank you very much in advance.

• Consider $G$ and $H$ as sets. Can you define an inverse? Now show that it is a homomorphism of groups (easy). Commented Jan 16, 2020 at 16:45
• Note that you do not need to use group theory anywhere to answer this question. An injective map between finite sets of equal size must be a bijection, see for example this question Commented Jan 16, 2020 at 17:02
• @TastyRomeo yes, but sometimes you can have a set-inverse that is not a morphism in the category you are looking at. Commented Jan 16, 2020 at 17:05
• The question didn't ask for the inverse to be a homomorphism. Commented Jan 16, 2020 at 18:25

Hint: Since $$f$$ is injective, we know that $$H$$ contains a "copy" of $$G$$. Namely, the image $$\text{im}(f) \le H$$ is a subgroup of $$H$$ isomorphic to $$G$$ (why?). But if $$G$$ and $$H$$ are the same order, what can we conclude about $$\text{im}(f)$$ and $$H$$?
• Aaah, of course. The image of a homomorphism $f:G\rightarrow H$ is a subgroup of H, and if $f$ is injevtive, then $f:G\rightarrow \text{im}(G)$ is bijective (and still a homomorphism) and if a subgroup of a group has the same order, it has to be the group itself. Thank you very much. Commented Jan 16, 2020 at 17:01