TITLE: If $g \circ f$ is the identity function, then which of $f$ and $g$ is onto and which is one-to-one? 
QUESTION [7 upvotes]: Say $f:X\rightarrow Y$ and $g:Y\rightarrow X$ are functions where $g\circ f:X\rightarrow X$ is the identity. Which of $f$ and $g$ is onto, and which is one-to-one?

REPLY [3 votes]: You already have several answers which can help you remember the theorem. If you're looking for a proof (and have problems with showing it yourself), you might try to have a look at these links:

http://www.proofwiki.org/wiki/Injection_if_Composite_is_an_Injection 
http://www.proofwiki.org/wiki/Surjection_if_Composite_is_a_Surjection

or these questions/answers:

If g(f(x)) is one-to-one (injective) show f(x) is also one-to-one (given that...)
Surjection on composed function?
Injective and Surjective Functions

More general results are here:

http://www.proofwiki.org/wiki/Injection_iff_Left_Inverse
http://www.proofwiki.org/wiki/Surjection_iff_Right_Inverse