Prove of function is surjective iff it has a right inverse using the well-ordering Theorem

set-theorywell-orders

As mentioned in the title I should prove that a function $f\colon X\to Y$ is surjective if and only if there exists a function $g\colon Y\to X$ such that $f\circ g=id_Y$ using the well ordering Theorem (i.e. that every set can be well-ordered).

Of course the statement is well known and not so difficult to prove but I don't know how to use the well ordering Theorem for the proof.

Best Answer

By the well-ordering principle, $X$ can be well-ordered.

"$\Rightarrow$" For every $y\in Y$, consider $f^{-1}(y)\subset X$ which is a non-empty subset, because $f$ is surjective. Using the well-order it has a least element $x_y$. Now, define $g(y):=x_y$. Then $f(g(y))=f(x_y)=y$, so $f\circ g=id_Y$.

"$\Leftarrow$" $id_Y$ is surjective, so $f\circ g$ is surjective, so $f$ must be surjective. No need of the well ordering principle here.