[Math] Proving functions are injective and surjective

discrete mathematicsfunctions

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.

Best Answer

Claim. $f: A \to B$ is injective.

Assume for $a, b \in A$ that $f(b) = f(a)$. Then, $g(f(b)) = g(f(a))$, which implies that $(g \circ f)(b) = (g \circ f)(a)$, or $b = a$ by the definition of the identity function. Hence, $f$ is injective.

I'll have you try the other one.

Related Question