# Composition of two functions - Bijection

I keep going around in circles with this problem:

Given the functions $f:X\to Y$ and $g:Y\to Z$, if $g\circ f:X\to Z$ is bijective, then prove $f$ must be one-to-one and $g$ must be onto. I was able to prove this without difficulty. However the second part of the problem has me stumped:

a) Find functions $f,g$ where $g\circ f$ is bijective but $f$ fails to be onto.

b) Find functions $f,g$ where $g\circ f$ is bijective but $g$ fails to be one-to-one.

My attempt for (a): Let $f:\mathbb{R}\to \mathbb{R}^+$ be defined by $f(x)=e^x$ and $g:\mathbb{R}^+\to \mathbb{R}$ be defined by $g(x)=\ln(x)$. Then $g\circ f(x)=g(f(x))=g(e^x)=\ln(e^x)=x$ which is bijective, $g$ is onto and $f$ fails to be onto... or so I thought. Upon closer inspection $f$ $\underline{is}$ onto for the given codomain $\mathbb{R}^+$.

And now I'm stuck in a rut. Anyone out there have any hints?

• Now that I think about it, I may be making things more complicated than they need to be. Instead of a function with real variables, I could be using simple finite sets as domain and codomain and go from there. Feb 5, 2017 at 16:58

Consider the function $g:\mathbb{R} \times \mathbb{R} \to \mathbb{R}$ by $g(x,y) = x$ and $f:\mathbb{R} \to \mathbb{R} \times \mathbb{R}$ by $f(x) = (x,0)$ then $g \circ f : \mathbb{R} \to \mathbb{R}$ is bijective but $g$ is not injective and $f$ is not surjective. Here the function $g \circ f$ is infact identity and hence bijective!