Left Inverse and Surjectivness

I just needed to clarify something.

I read the following proposition and something didn't make sense:

"The map $f$ is injective if and only if $f$ has a left inverse"

Now $f$ having a left inverse implies there is a function $g$ whose domain is the codomain of $f$.

Every element of the domain of $g$ must have a specified value (by definition), then surely $f$ is also surjective since the codomain of $f$ is its range.

My question is, does $f$ having a left inverse imply that $f$ is bijective?

• No, $f$ has a left (right) inverse iff $f$ is injective (respectively, surjective). So $f$ has both a left and right inverse iff $f$ is bijective, and then the left and right inverses are the same and equal $f^{-1}$, the inverse of $f$. Dec 7, 2015 at 22:51
• Typo, fixed it. Re your 2nd to last paragraph, if $f\colon X\to Y$, then the range of $f$ doesn't have to equal all of its codomain $Y$. The codomain of a function is not unique, though the domain is. Dec 7, 2015 at 22:56
• If also $g\colon Y\to X$ and $g\circ f = id_X$, then $g$ can take any values on elements in $Y\setminus range(f)$, and none of them come into play when evaluating $g\circ f$. Dec 7, 2015 at 22:58
• But doesn't every element in $Y$ have a specified unique value mapped by $g$ onto $X$ since $Y$ is the domain of $g$? Dec 7, 2015 at 23:01
• In a word, the codomain is not the range. Two different concepts. You’ll see the importance of the distinction when you do commutative algebra, where the quotient (codomain)/(range) is an important construct, called the cokernel. Dec 7, 2015 at 23:04

The left inverse does not prove surjectivity. Take $$X = \{0,1,2\}, Y = \{0,1,2,3\}$$ and $$f(x) = x$$. This has a left inverse $$g(x) = x, g(4) = \text{anything in }\{0,1,2\}$$ from $$Y$$ to $$X$$. The value 4 is not assumed, so it does not matter what value $$g$$ has there. What matters is that when we start with a value in $$X$$, we get in $$f[X]$$ and $$g$$ has to be defined there to go back to the (must be) unique $$x$$ again. Yes, $$g$$ must be defined on $$Y$$, but anything outside $$f[X]$$ is irrelevant. We only need $$g(f(x)) = x$$ for all $$x$$.
Your counterexample is the function $\exp:\Bbb R\to\Bbb R$, injective but not surjective. For its left inverse take $L:\Bbb R\to\Bbb R$ by: If $t>0$, $L(t)=\log t$ (natural logarithm of course), and if $t\le0$, then $L(t)=17$ (my favorite value).
You’ll notice that the domain of $L$ is the codomain of $\exp$ (not the range (“image”, in the language I grew up with)) and that the codomain of $L$ is the domain of $\exp$. That’s what’s necessary for $L$ to be a left inverse of $\exp$.