Prove:

Let $\displaystyle f$ be a function. If there exists a function $\displaystyle g$ such that $\displaystyle g \circ f = Id_{dom f} $ then $\displaystyle f$ is invertible and $\displaystyle f^{-1}=g \upharpoonright ran f $. If there exists a function $\displaystyle h$ such that $\displaystyle f \circ h = Id_{ran f} $ then $\displaystyle f$ may fail to be invertible.