If $f:M\to N$, $g:N\to P$ continuous and $g\circ f: M\to P$ are homeomorphism, and $g$ is injective, then $g, f$ both are homeomorphisms 
If $f:M\to N$, $g:N\to P$ continuous and $g\circ f: M\to P$ is a homeomorphism. And $g$ is injective (or $f$ is surjective) then $g, f$ both are homeomorphisms.

I don't know how to prove it. I tried to use the left inverse of $g$ (or right inverse of $f$), but I can't follow it up.
 A: Suppose that $g$ is injective. It’s also continuous, so it’s a homeomorphism iff it is open. To show that $g$ is open, let $U$ be any open subset of $N$. The map $f$ is continuous, so $f^{-1}[U]$ is open in $M$. The map $g\circ f$ is a homeomorphism, so $g[U]=(g\circ f)[f^{-1}[U]]$ is open in $P$, and therefore $g$ is open.
Note that since $g\circ f$ is injective, $f$ must be injective as well. Thus, to show that $f$ is a homeomorphism, you need only show that it is open. For this you can use the same sort of reasoning as I used above.
A: Suppose $g$ is injective.


*

*Since $g\circ f$ is onto, $g$ is onto. Since $g$ is a bijection, it has an inverse $g^{-1}$

*From $Id_P=g\circ f\circ(g\circ f)^{-1}$ it follows that $g^{-1}=g^{-1}\circ g\circ f\circ(g\circ f)^{-1}=f\circ(g\circ f)^{-1}$. Since the right hand side is a composition of continuous functions, $g^{-1}$ is also continuous.

*Hence, $g$ is a continuous bijection with a continuous inverse, aka a homeomorphism.

*$f$ is surjective since $f=g^{-1}\circ(g\circ f)$ is a composition of surjections, and injective since $g\circ f$ is injective.

*As before, $f^{-1}=(g\circ f)^{-1}\circ g$ follows from $Id_M=(g\circ f)^{-1}\circ g\circ f$.  Thus, $f^{-1}$ is also continuous.


A similar proof will work if $f$ is assumed to be surjective.
