Let $f: (M,d) \rightarrow (N,\rho)$ be a one-one and onto mapping. Prove that the following are equivalent: 

1. $f$ is a homeomorphism.
2. $g: N\rightarrow \mathbb{R}$ is contiuous if and only if $gof: M
 \rightarrow \mathbb{R}$ is continuous.

To show $1 \implies 2$ I have proceeded in the following manner. 

$f$ is a homeomorphism $\implies$ $f$ is continuous from $M \rightarrow N$ $\implies$ For any sequence $(x\_{n})$ in $M$ converging to $x$ we have $f(x\_{n}) \rightarrow f(x)$. **Let,** $g$ is continuous from $N \rightarrow \mathbb{R}$ Therefore, $g(f(x\_{n}) \rightarrow g(f(x))$. Hence, $gof(x)$ is continuous in $M$. 

Since, the statement **2** had an **iff** next, I assumed that $f$ is a homemomrphism and $gof$ is continuous and proved that $g$ is continuous. 

Now, I am not sure how I have to show $2 \implies 1$

**Source:Real Analysis by N.L Carothers Page 72, Problem 54**