Let $G$ and $H$ be groups. The function $f:G\times H \to H\times G$ with $f(g,h) = (h,g)$ defines an homomorphism?
I think it does, because if $(g_1,h_1),(g_2,h_2) \in G \times H$, we have: $$f((g_1,h_1)(g_2,h_2)) = f((g_1g_2,h_1h_2))=(h_1h_2,g_1g_2) = (h_1,g_1)(h_2,g_2) = f(g_1,h_1)f(g_2,h_2)$$ But is my thought right? Thanks.
Yes, your proof is fine. Well done!
You can improve it by using the $\rm\LaTeX$
aligncommand.