# Can a function have more than one left inverse?

Given two non-empty sets $A$ and $B$, and given a function $f \colon A \to B$, a function $g \colon B \to A$ is said to be a left inverse of $f$ if the function $g o f \colon A \to A$ is the identity function $i_A$ on $A$, that is, if $g(f(a)) = a$ for each $a \in A$. Similarly, a function $h \colon B \to A$ is a right inverse of $f$ if the function $f o h \colon B \to B$ is the identity function $i_B$ on $B$.

I know that if $f$ has a left inverse, then $f$ is injective, and if $f$ has a right inverse, then $f$ is surjective; so if $f$ has a left inverse $g$ and a right inverse $h$, then $f$ is bijective and moreover $g = h = f^{-1}$.

I also know that a function can have two right inverses; e.g., let $f \colon \mathbf{R} \to [0, +\infty)$ be defined as $f(x) \colon = x^2$ for all $x \in \mathbf{R}$. Then both $g_+ \colon [0, +\infty) \to \mathbf{R}$ and $g_- \colon [0, +\infty) \to \mathbf{R}$ defined as $g_+(x) \colon = \sqrt{x}$ and $g_-(x) \colon = -\sqrt{x}$ for all $x\in [0, +\infty)$ are right inverses for $f$, since $$f(g_{\pm}(x)) = f(\pm \sqrt{x}) = (\pm\sqrt{x})^2 = x$$ for all $x \in [0, +\infty)$.

Can a (non-surjective) function have more than one left inverse?

If you don't require the domain of $g$ to be the range of $f$, then you can get different left inverses by having functions differ on the part of $B$ that is not in the range of $f$.
Let $A=\{0,1\}$, $B=\{0,1,2\}$ and $f\colon A\to B$ be given by $f(i)=i$. We see that $f$ has exactly $2$ inverses given by $g(i)=i$ if $i=0,1$ and $g(2)=0$ or $g(2)=1$.
• Well what do you mean by 'need'? If you're being asked for a continuous function, or for a function $\mathbb{R}\to\mathbb{R}$ then this example won't work, but the question just asked for any old function, the simplest of which I think anyone could think of is given in this answer. Aug 18, 2015 at 13:20