I am asking that is $f(g(x))=x$ a sufficient condition for $g(x)=f^{-1}x$ (but I only want $f(x)$ to be an algebraic function)? At school I am learning about inverse functions and my teacher said that to check if a function $g(x)$ is the inverse function of $f(x)$, I need to check if both $f(g(x))=x$ and $g(f(x))=x$. However, I think that just $f(g(x))=x$ is enough to prove that $g(x)$ is the inverse function $f^{-1}x$. Is it true that I must check for both?
A possible duplicate may be $f(g(x))=x$ implies $f(x)=g^{-1}(x)$, but that person is asking if $f(g(x))=x \implies f(x)=g^{-1}(x) \wedge f^{-1}(x)=g(x)$, not if $f(g(x))=x \implies g(x)=f^{-1}x$.
