We have the sets $X,Y$ and $f:X\to Y, \ g: Y\to X $
Prove if $f$ has a right inverse function: $f\circ g=id_Y$ $\iff$ $f$ is onto $Y$ (surjective).
$\Leftarrow \forall y\in Y : \exists x\in X$ then $f(y)=x$ I need to show that $f\circ g(x)=x$ but I don't know how.
I have no clue on to start in the other direction.
BTW, I found below similar question but they're either not quite the same as this one or I didn't understand the answers: