# Prove the following: $f:X \to Y$ is 1-1 if and only if it has a left inverse: that is, a function $g:Y \to X$ such that $g \circ f = 1_X$

$f:X \to Y$ is 1-1 if and only if it has a left inverse: that is, a function $g:Y \to X$ such that $g \circ f = 1_X$.

I have been trying to solve this question with injection function but I still can't solve it. Can anyone show me how to do it?

• 1-1 means injection. They are same thing. To show $\Rightarrow$, for each $x$, write $y = f(x)$ and define $g(y) = x$. Let $g(y)$ to be some element in $X$ if $y$ is not in the range of $f$. Now you can check that g is well defined and is a left inverse – Li Chun Min May 11 '17 at 9:33
• For $\Leftarrow$, suppose $x_1 \neq x_2$ but $f(x_1)=f(x_2)$. Derive contradiction from $g \circ f = 1_X$ – Li Chun Min May 11 '17 at 9:36
• @hpotter54 Without the hypothesis $X\ne \emptyset$, the "only if" part is false. – user228113 May 11 '17 at 9:48
• @G.Sassatelli Almost, the hypothesis need only be $X\ne\emptyset$ or $f$ is surjective (if $X=Y=\emptyset$ the "only if" part is true anyway). – skyking May 11 '17 at 10:42
• @skyking Why not writing directly "$X\ne\emptyset\vee Y=\emptyset$", then? – user228113 May 11 '17 at 15:03

It's quite straight forward because if $f(x) = f(y)$ then we have $x = g(f(x)) = g(f(y)) = y$ which means that $f$ is injective. However there's no guarantee that $f$ is surjective (take for example the $Y\supset X$ and $f$ as the identity map).
For the converse you have to assume that $X\ne\emptyset$ or that $f$ is surjective.
Then the converse is also simple as if $f$ as we can define $g_{f(X)}$ from the domain of $f$ to $X$ as the inverse of $f$. For arguments outside $f(X)$ we can simply assign any value in $X$ (which is why we need $X\ne\emptyset$).