Given $f:A\to B$, and $g:f(A)\to A$, show that if $g \circ f = I_A$ and $f \circ g = I_{f(A)}$, then $f$ is one-to-one and $g=f^{-1}$
$I_A$ denotes the identity element in $A$ and $I_{f(A)}$ denotes the identity element of $f(A)$
I want to somehow get from $g \circ f = I_A$ to $\forall a_1, a_2 \in A, f(a_1)=f(a_2)\implies a_1=a_2$
I'm pretty lost...