# Can someone show me how to prove that $f:X \rightarrow Y$ is onto if and only if it has a right inverse? [duplicate]

$f:X \rightarrow Y$ is onto if and only if it has a right inverse: that is, a function $g:Y \rightarrow X$ such that $f \circ g = 1_y$

## marked as duplicate by user99914, kingW3, Martin Sleziak, Henrik, ArnaldoMay 12 '17 at 12:36

• This question is missing context or work. Do you have any thoughts on the problem? If $f$ is, indeed, onto, how could you define $g$? If $f$ is not onto, how can you prove that $g$ can't exist? Also, the title of the question should be informative (right now, the answer to your question is "yes" someone can prove this, but that's likely not what you meant). – Michael Burr May 11 '17 at 10:51
You probably mean the map of sets. If $f: X\to Y$ is onto then for any $y\in Y$ there exists $x\in X$ such that $f(x) = y$. Choose for every $y\in Y$ such an $x$ and call it $x_y$. Define $g:Y\to X$ as $g(y) = x_y$. It obviously follows that $(f\circ g) (y) = y$.
If there exists a right inverse $g:Y\to X$ then for any $y\in Y$ take $x = g(y)\in X$. Since $f\circ g = 1_Y$ $f(x) = f(g(y)) = y$ and hence $f$ is onto.