Suppose that $f: A \to B$ is injective, $A = \{5, 7\}, B = \{9, 10\}$ and $f(5) = 9$, $f(7) = 10$.
Now construct $g: B \to A | g(9) = 7, g(10) = 5$.
Does this function $f$ have a left inverse $g$, i.e. $g(f(a)) = a$ for all $a \in A$?
Suppose that $f: A \to B$ is injective, $A = \{5, 7\}, B = \{9, 10\}$ and $f(5) = 9$, $f(7) = 10$.
Now construct $g: B \to A | g(9) = 7, g(10) = 5$.
Does this function $f$ have a left inverse $g$, i.e. $g(f(a)) = a$ for all $a \in A$?
The function $g(9) = 7, g(10) = 5$ is not an inverse to $f$, as you can easily verify by computing $g(f(5)) = g(9) = 7 \ne 5$. On the other hand both $g$ and $f$ are bijections so they have well-defined inverses: $$f^{-1}(9) = 5, f^{-1}(10) = 7$$ $$g^{-1}(7) = 9, g^{-1}(5) = 10$$ If you want to construct an inverse to a discrete injective function $h:C\rightarrow D$ then $\forall c \in C : h(c) = d \in D$ define $h^{-1}(d) = c$. Then by construction the function $h^{-1}$ satisfies $h^{-1}(d) = h^{-1}(h(c)) = c$.
Then f(a) = b in B.
Let g: B-> A s.t. g(b) = f^-1(b).
If f^-1(b) =/= a then two elements exist in the fiber of B, but that violates the claim that f is injective.
Thus f has a left inverse.
– Jossie Calderon Feb 10 '19 at 19:21Your question caused a lot of confusion. So let us prove the following which is probably that what you really mean:
A function $f : A \to B$ is injective if and only if it has a left inverse $g : B \to A$. Here, $A,B$ are any two sets.
1) Let $f$ be injective. Choose any $a_0 \in A$ and define $$g : B \to A, g(b) = \begin{cases} a & b = f(a) \in f(A) \\ a_0 & b \in B \setminus f(A) \end{cases} $$ Note that by injectivity of $f$ for each $b \in f(A)$ there exists a unique $a \in A$ such that $b = f(a)$. By definition $(g \circ f)(a) = g(f(a)) = a$.
2) Let $g$ be a left inverse for $f$. If $f(a) = f(a')$, then $a = g(f(a)) = g(f(a')) = a'$. This means that $f$ is injective.