$f \circ g =\operatorname{ id}$ and $g \circ f \neq \operatorname{id}$? Are there two functions $f$ and $g$ s.t.
$$f \circ g = \operatorname{id}$$
but
$$g \circ f \neq \operatorname{id}?$$
Could someone give an example or a proof that this is impossible?

This must be trivial, but I can't figure it out. :) Thanks!
Hint: Consider the two functions on the integers:
$$
f(x)=\left\lfloor\frac x2\right\rfloor
$$
and
$$
g(x)=2x
$$
It is possible to define the functions via matrices, in which case the product of the matrices is not commutative - I don't know if that is quite what you are looking for. You could also define the functions by $f(x) = x^2$, $g(x) = \sqrt{x}$, where $f:\mathbb{R} \to [0 , \infty)$ and $g: [0 , \infty) \to [0 , \infty)$. Here, $f(g(x)) = x $ but $g(f(x)) = |x|$. There are of course other examples of similar type.