Prove that (G, *) is an abelian group if an only if f:G--->G defined by f(x)=x^-1 is a homomorphism.

I understand that I need to prove two things.

1) If (G, *) is abelian, then the function is a homomorphism.

2) If the function is a homomorphism, then (G, *) is abelian.

I know that abelian means that for every a, b in G, a*b=b*a.

I also know that a function is a homomorphism if for every a, b in G, f(ab)=f(a)f(b).

I just don't know how to start...