Suppose $G$ is a group and $f : G \to G$ is the function $f(x) = x^{-1}$.
Prove that if $f$ is a homomorphism, then $G$ is abelian.
Proceeding by contrapositive suppose $G$ is not abelian then for every $a,b$ in $G$, $$f(ab) = {(ab)^-}^1 = {b^-}^1{a^-}^1 = f(b)f(a);$$
thus $f$ is not a homomorphism since the homomorphism property $f(ab) = f(a)f(b)$ fails.
My question is different from the possible duplicate provided because I want to know if showing that $$f(ab) = {(ab)^-}^1 = {b^-}^1{a^-}^1 = f(b)f(a);$$ is a correct method to show that a function is NOT a homomorphism
No.
It is enough to show that $f(ab)=f(b)f(a)$ for some homomorphism $f$. This holds when the domain group is abelian.
We have for a homomorphism $f:G\to G, x\mapsto x^{-1}$ that
$$f(ab)=f(a)f(b)\tag{1}.$$
From the LHS of $(1)$, we have $f(ab)=(ab)^{-1}=b^{-1}a^{-1}=f(b)f(a)$.
From the RHS of $(1)$, we have $f(a)f(b)=a^{-1}b^{-1}$.
Hence $b^{-1}a^{-1}=a^{-1}b^{-1}$.
Hence $G$ is abelian.