Inverse Function

If $f$ is a function, then the function $g$ is the inverse function of $f$ if
$$g(f(x))=x$$ for all $x$ in which $f(x)$ can be calculated
Details
The inverse of a function $f$ is denoted by $f^{-1}$, i.e. $$f^{-1}(f(x))=x $$
Examples
\begin{xmpl}
If $f(x) = x^2$ for $x<0$
then the function $g$, defined as $g(y)=\sqrt{y}$ for $y>0$, is not the inverse of $f$ since
$g(f(x))=\sqrt{x^2}= |x|= -x$ for $x<0$.

\end{xmpl}