If $g(f(x))$ is continuous if and only if $g$ is continuous, then $f$ is a homeomorphism Let $f : M \rightarrow N$ and $g : N \rightarrow \mathbb{R}$, where M and N are metric spaces. Let $f$ be one to one and onto. Suppose $g$ is continuous if and only if $g\circ f$ is continuous. 
I have proven that $f$ is continuous, but I can't figure out how to show that $f^{-1}$ is continuous. Help would be appreciated.

Let $\theta$ be the metric on $M$ and $x\in N$. Take $g:N\to \mathbb{R}, y\mapsto \theta(f^{-1}(x),f^{-1}(y))$, hence $g\circ f:M\to \mathbb{R}, y\mapsto \theta(f^{-1}(x),y)$ is continuous. So $g$ is continuous, i.e. $f^{-1}$ continuous at $x$.
