I am having trouble with the following problem:
For nonempty sets $A$ and $B$ and functions $f:A \rightarrow B$ and $g:B \rightarrow A$ suppose that $g\circ f=i_A$, the identity function of $A$. Prove that $f$ is injective and $g$ is surjective.
Work: Since $g\circ f=i_A$, then $g\circ f:A\rightarrow A$.
After this point, I don't know how to proceed.