Flip Isomorphism for Groups

Given a group $G$ and a group $H$ suppose there exists a bijective function

$$f: G \rightarrow H$$

such that

$$f(xy) = f(y)f(x)$$

then must it be the case that $G$ is isomorphic to $H$?

I am thinking the answer is yes but i'm not sure how to show it. My question in some sense reduces to whether given a group $G$ with operation $f(a,b) = ab$ if we define another operation $g(a,b) = ba$ is $G$ under the new operations the same group?

Something to observe is that if two elements are inverses in one then they are inverses here as well. Furthermore for any expression $a_1^{k_1} a_2^{k_2} ... a_r^{k_r}= M$ in the original group there is a unique expression of the form $a_r^{k_r} a_{r-1}^{k_{r-1}} ... a_1^{k_1}$ in the new group. But this doesn't convince me they are isomorphic.

• @Stoof: you mean a bijective homomorphism, which $f$ is not. – Qiaochu Yuan Dec 9 '15 at 23:53
• Opps, did not see that. – Stoof Dec 9 '15 at 23:53

Given any group $G$, you can construct its opposite group $G^{op}$, which has the same elements as $G$ but multiplication is in the reverse order. Your condition is equivalent to requiring that $H$ is isomorphic to $G^{op}$.
Now, the reason you've never heard about opposite groups before is that every group is canonically isomorphic to its opposite group, via the map $g \mapsto g^{-1}$. So the answer is yes.