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