Inverse Function in terms of Surjective and Injective Functions Here is my intuition of the proof listed after

The mapping of A to A is an inverse function. The mapping of A to B is injective and the mapping from B to A is surjective.

I'm confused as to where the $s$ comes from in the proof and why it's there and I've seen other people proof on here but none have explained why the $s$ is there. Why is its chosen randomly? Aren't we supposed to throw the $s$ away?
Thanks,
Jackson
 A: A lot of the answering took place in the comments.  Here is a summary of what was said:
In order to prove that every injective $f$ has a left-inverse, it suffices to take an arbitrary such function $f$, construct one function $g$ that satisfies $g(f(x)) = x$ for all $x$ in $A$.  In particular, it is okay to make arbitrary decisions in constructing $g$ (such as the decision that each element outside the image of $f$ should be mapped to a fixed element $s \in A$) as long as:


*

*we have made no assumptions about $f$ other than the fact that which is given (i.e. that it is injective)

*we can show that $g$ acts as a left-inverse to this arbitrary $f$


In this context, there will be many possible inverses $g$ unless $f$ happens to also be surjective.  If $f$ fails to be surjective, then we have not constructed $g$ as a function from $B$ to $A$ until we have stated what $g$ does to elements outside the image of $f$.  Since this part of the definition (so long as we define $g$ somehow) doesn't affect whether $g$ acts as an inverse, we go with the simplest possible definition.  In particular, we find a single element of $A$, call it $s$, and map all the things we don't care about to that element.
