TITLE: Composition of Inverse Functions
QUESTION [7 upvotes]: $f$ and $g$ are inverses of each other when $f(g(x)) = x = g(f(x))$. However, can there be 2 functions where $f(g(x)) = x$ but $g(f(x))$ does not equal to $x$? I feel like there are but I cannot find it. Could you please post examples of this?

REPLY [3 votes]: My favorite example is $g(x)=e^x$ and $f(x)=\log(x)$ if $x>0$, but $f(x)=17$ if $x\le0$. Then $f\circ g$ is the identity, but $g\circ f$ has $g(f(x))=e^{17}$ if $x\le0$, and $g(f(x))=x$ if $x>0$.