1.) Prove that $f$ has a left inverse if and only if $f$ is injective.
2.) Prove that $f$ has a right inverse if and only if $f$ is surjective.
My first attempt for 1.):
$$f\text{ is injective.}$$ $$\iff$$ $$f(a)=f(b)\implies a=b$$ $$\iff$$ $$g(f(a))=g(f(b))$$