Prove that if $f:A\rightarrow B$ and $g:B\rightarrow A$ are such functions, that $gf = I_A$, then $f$ is 1-1 and $g$ is onto.

elementary-set-theory

Prove that if $f:A\rightarrow B$ and $g:B\rightarrow A$ are such functions, that $gf = I_A$, then $f$ is 1-1 and $g$ is onto.
Knowing that $gf = I_A \equiv gf : A\rightarrow A$, I had an idea to present $gf$ function as
$$gf(x) = x$$
Then for any element $x\in A$, function $gf$ is true.
But what should I do next in order to prove that $f$ is 1-1 and $g$ is onto?

Best Answer

For every $x\in A$, $x=gf(x)$, so $g$ in onto.

For every $x,y\in A$, if $f(x)=f(y)$ then $x=gf(x)=gf(y)=y$, so $f$ is 1-1.