Composition of Inverse Functions $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?
 A: 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$.
A: E.g. $\sin$ and $\arcsin$ on their natural domains.
A: Here is an example (but it does take a bit of calculation). Let $f(x),g(x)$ be functions on $\mathbb{R}$ defined by 
\begin{align*}
f(x) &= \dfrac{x}{1+|x|} \\
g(x) &= \begin{cases} \frac{x}{1-|x|}\, & |x|<1 \\ 0 & |x|\ge 1 \end{cases}\,.
\end{align*}
Then $g(f(x))=x$ but $f(g(x))\neq x$.
A: Let $A=\{a\}$ and $B=\{b,c\}$. Define $f:A\rightarrow B$ by $f(a)=b$ and $g:B\rightarrow A$ as $g(b)=g(c)=a$. Then $g\circ f=1_A$ but $f\circ g\neq 1_B$.
A: Two functions f,g are inverses of each other in the sense that $g(f(x))=x=f(g(x))$ iff f, and g are bijections. If f is an injection but not a bijection , it will have only  a 1-sided inverse, while if g is a non-injective surjection, it will also have only a 1-sided inverse. 
Examples: $f: (-\infty, \infty ) \rightarrow [0, \infty) $  given by $f(x)=x^2$is a non-injective surjection.
It has a 1-sided inverse $g(x)\sqrt x$ , so that $\sqrt (x^2)=x$ , and $g \circ f(x)= x$ , but  $ f \circ g \neq x$.
If you consider the aspect of differentiability, if $f: X \rightarrow Y $ is a differentiable map with $J(f)(x)$ , the Jacobian of $f$ at $x \in X$ invertible, then there is locally  (but not necessarily globally) a function $g$ with $g \circ f(x) = f \circ g(x) =x$ 
