Clarification about injectivity of a function Let $f:{X\to Y}$ be a function. 
Show:
$f$ is injective $\Leftrightarrow \exists \space h:{Y\to X} \ni h\circ f=id_X$. 
If we have $f(x)=f(y)$ then $x=y$. My problem is how can we have the function $h$? f is injective but not surjective this means that there might be values of $Y$ that don't correspond to anything in $X$. By the definition of a function h must map all values from $Y$ to $X$. How can I find $h\circ f=id_X$
I am thinking about restriction function here, $ h:{Y/{A}\to X}$ but the problem asks for $Y$.

You can define how $h$ works with those values $\alpha \in Y $ for which does not exists a $x \in X$ such that $f(x)=\alpha$ in this way: $h(\alpha)=x$ if $f(x)=\alpha$ and $h(\beta)=z \in X$ if $\not\exists x \in X \space ,f(x)=\beta.$
This function do what we want.
