Give an example of three functions $f:A\rightarrow B, g:B\rightarrow C, h:C\rightarrow D$ such that $h \circ g\circ f$ is a bijection, but $g$ is neither injective or surjective.

I know that in order for the composition to be bijective, this means that every domain element of $f$ must be mapped to exactly one element of the range of the whole composition, and also that every range element of the composition must be paired with some domain element.

I have tried and failed to find an example. My first try was let $f:\mathbb{N}\rightarrow\mathbb{N}, g:\mathbb{N}\rightarrow\mathbb{N},h:\mathbb{N}\rightarrow\{1\},$ $f(x)=x, g(x)=1, h(x) =1$. In this scenario then the domain of $f$ is all natural numbers and they all just get mapped to themselves under $f$. Then, once you put those all into $g$, the output is just 1 - this means that $g$ is not one-to-one. Also, if $g:\mathbb{N}\rightarrow\mathbb{N}$, then it is also not surjective because 1 is the only element of the range that gets obtained. So this is okay so far. Finally, under $h$, the output from $g$ gets mapped to 1, which is the entire range of $h$. So I think this means this is surjective. However, then it fails to be injective because every element we put into $f$ at the beginning ends up just being mapped to 1 at the very end so this did not work.

My other thought was let $f:\mathbb{R}\rightarrow\mathbb{R},g:\mathbb{R}\rightarrow\mathbb{R},h:\mathbb{R+}\rightarrow\mathbb{R+},$ where $f(x)=x,g(x)=x^2 ,h(x)=x$. This way, $g$ fails to be injective and surjective because it does not obtain every value of the real numbers and also more than one input gets mapped to the same output. So that gets satisfied. All of these results get mapped to themselves under $h$, seeming to make it surjective. However, I run into the same issue where the inputs of $f$ don't end up being mapped to unique values under $h$.

Any suggestions are welcome. Thank you in advance.


4 Answers 4


Take $A=D=\{0\}$, $B=C=\{0,1\}$





Your attempt was almost right:


$f:\Bbb R_{\ge 0} \to \Bbb R,\ f(x)=x$

$g:\Bbb R\to \Bbb R,\ g(x)=x^2$

$h:\Bbb R\to \Bbb R_{\ge 0},\ h(x)=|x|$


Let all domains and codomains be $\mathbb{R}$.

Let $f(x)=\arctan(x)$. Note that $f$'s range is $(-\pi/2,\pi/2)$.

Let $g(x)=\arcsin(\sin(x))$. Note $g$ is a "saw-tooth" function, not injective, and not surjective if we consider the codomain to be $\mathbb{R}$.

Let $h(x)=\tan(x)$ where $\tan(x)$ is defined, and $h(x)=0$ otherwise.

  • $\begingroup$ $\tan$ is not defined on $\Bbb R$ $\endgroup$
    – jjagmath
    Apr 20, 2022 at 3:16
  • $\begingroup$ @jjagmath We can overcome that. See updated answer. $\endgroup$
    – 2'5 9'2
    Apr 20, 2022 at 3:17

$$\begin{matrix} &f&&g&&h&\\ \bullet & \to & \bullet &\to&\bullet&\to&\bullet\\ &&&\nearrow&&\nearrow\\ &&\bullet&&\bullet\\ A&&B&&C&&D\end{matrix}$$


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .