Assume the contrary and see what happens. If f is not one-to-one, there exist such that and . Then, while , which violates the fact that g(f( )) is one-to-one. Therefore it's impossible for f to not be one-to-one.
If you need to prove IF-THEN statements, always try assuming that it's not necessarily the case, and see if it leads to a contradiction. If it does, you have found a proof.