Example where $f\circ g$ is bijective, but neither $f$ nor $g$ is bijective Can anyone come up with an explicit example of two functions $f$ and $g$ such that: $f\circ g$ is bijective, but neither $f$ nor $g$ is bijective?
I tried the following: $$f:\mathbb{R}\rightarrow \mathbb{R^{+}}
$$ $$f(x)=x^{2}$$
and  $$g:\mathbb{R^{+}}\rightarrow \mathbb{R}$$
$$g(x)=\sqrt{x}$$
$f$ is not injective, and $g$ is not surjective, but $f\circ g$ is bijective
Any other examples?

The simplest example:

*

*$X=\{0\},Y=\{0,1\}$, $f(0)=0$, $g(0)=g(1)=0$.

(Here $g\circ f$ is the bijection, since I inadvertently reversed the names of the functions.)
Everything else is an elaboration of this idea.
