Q:

What is the domain of an inverse function?

If $f:X \to Y$ then if the inverse exists, is the domain the range of $f$ or the codomain of $f$?

A:

I think that it is most easiest to deduce the domain from the definition of inverse function and elementary function theory:
$$
f^{-1}(f(x)) = x
$$
Say that $f$ assigns a value $x$ from $X$ to $Y$. To invert that process, $f^{-1}$ must assign a value $y$ from $Y$ to $X$, so in more formal words, if $X$ is the domain of $f$ and the image is $Y$, $Y$ must be the domain of $f^{-1}$

