If a function is onto, does the function also have an inverse? [duplicate]

Say a function is defined and we find that it is indeed onto (surjective). Does this mean the function also has an inverse function?

• To have an inverse, it must be a bijection (both injective and surjective) since if it fails to be injective then it “loses” information by mapping two points into one, and there is no way of inverting this. – Jack Crawford Jul 3 at 5:31

If $$f\colon A\to B$$ is onto, then there exists a function $$g\colon B\to A$$ such that $$g\circ f=\operatorname{id}_A$$ (given $$b\in B$$, let $$g(b)$$ be any $$a\in A$$ with $$f(a)=b$$, which exists per surjectivity). But this function need not be unique, nor do we have $$f\circ g=\operatorname{id}_B$$ (i.e., $$g$$ is only a left inverse), and in fact the existence of $$g$$ is not "constructive" in that in general it requires the Axiom of Choice.