I see that in some websites like Wikipedia, and even in some answers given in this site, they affirm that an invertible function must necessarily be bijective. But reviewing the book The Calculus by Louis Leithold, it is only necessary that the function be one-to-one. I have this example:
Let $f$ be $f:\mathbf{R}^+ \cup$ {$0$} $\to\mathbf{R}$, $f(x) = x^2$,
and $g$ be $g(x) = \sqrt x$ with its natural domain.
$f$ and $g$ are one-to-one. The image of $f$ is not all its codomain, since it's only $\mathbf{R}^+ \cup$ {$0$}, then it is not onto. Of course, if we had defined it as $f:\mathbf{R}^+ \cup$ {$0$} $\to\mathbf{R}^+ \cup$ {$0$}, the function would have been bijective, but we would be forcing the target set to be equal to the image, so we would be forcing the surjectivity.
Now, the domain of $g$ is not all the target set of $f$, only its image, but I don't know if there is a conceptual problem with this. Apart from this, it is obvious that one function undoes the effect of the other for every element of their domains, so they should be mutually inverse.
Generally speaking, you can always say that a function is surjective onto its image. Given $f:A \to B$, we can view $f$ as a surjective function $f:A\to f(A)$. Therefore, if $f:A\to B$ is injective, then $f:A\to f(A)$ is bijective, and therefore invertible, which means that there is some $g:f(A) \subseteq B \to A$ such that $f(g(x)) = x$ for all $x \in f(A)$ and $g(f(y)) = y $ for all $y\in A$.
In this case we view both $f(x) = x^2$ and $g(x) = \sqrt{x}$ as functions $\mathbb{R}^+ \cup \{0\} \to \mathbb{R}^+ \cup \{0\}$.