Homeomorphism and Borel sets Suppose that $X,Y,Z$ are metric spaces, equipped with the Borel $\sigma$-algebra.
Assume that $f:X\rightarrow Y$ is a homeomorphism, and that $g:Y\rightarrow Z$ is a measureable map (with respect to the Borel $\sigma$-algebra).
Is it necessarily true that $g\circ f$ is measureable?
Note: this is not as easy as it seems, the obvious proof is not working, let $U$ be open in $Z$, then $(g\circ f)^{-1}(U) = f^{-1}\circ g^{-1}(U)$, $g^{-1}(U)$ is a measureable set, is it necessarily true that a pre-image of a Borel set under a homeomorphism is measureable?
Thanks!
 A: Here's the result mentioned in the comments:

Let $X$ and $Y$ be topological spaces. If $f:X\to Y$ is continuous and $B$ is a Borel subset of $Y$, then $f^{-1}(B)$ is a Borel subset of $X$.

It's proof relies on the fact that the preimage of a function respects complements, unions, and intersections, as well as the fact that the preimage of an open set under a continuous function is open. From this we obtain that every continuous function is Borel measurable. Then the question follows immediately from the fact that the composition of Borel measurable functions is Borel measurable. In particular, we see that either composition $f\circ g$ and $g\circ f$ will work, provided that the domains are setup so that the composition is defined.
However, one must be careful when considering the Lebesgue measure on $\mathbb{R}$. This is because when we say a function $f:\mathbb{R}\to\mathbb{R}$ is Lebesgue measurable, we mean that $f$ is Lebesgue-to-Borel measurable; i.e., $f^{-1}(B)$ is Lebesgue measurable for every Borel subset $B$ of $\mathbb{R}$.
Now if $f$ is Lebesgue measurable and $g$ is Borel measurable (in particular, continuous), we know that $g\circ f$ is Lebesgue measurable (by the same argument and the fact that Borel sets are Lebesgue measurable). But $f\circ g$ need not be, even if $g$ is assumed to be continuous.

Edit: It's not immediately clear why the composition of Borel measurable functions is Borel measurable (or why the result above is needed to conclude that continuous functions are Borel measurable) if one defines a Borel measurable function as one such that the preimage of open sets are Borel, as opposed to one such that the preimage of Borel sets are Borel. However, these definitions are equivalent:

If $f:X\to Y$ is such that $f^{-1}(U)$ is Borel for every open $U\subseteq Y$, then $f^{-1}(B)$ is Borel for every Borel $B\subseteq Y$. (The converse is trivial because open sets are Borel sets).

Proof:
Let $\mathcal{M}:=\{E\subseteq Y \mid f^{-1}(E)\ \text{is Borel}\}$. By hypothesis, $\mathcal{M}$ contains the open sets. It is also a $\sigma$-algebra because the Borel subsets of $X$ form a $\sigma$-algebra and the preimage respects unions, intersections, and complements. Since the Borel $\sigma$-algebra $\mathcal{B}_Y$ is the smallest $\sigma$-algebra containing the open sets, we conclude $\mathcal{B}_Y\subseteq\mathcal{M}$. Therefore $f^{-1}(B)$ is Borel for every Borel subset $B$ of $Y$.
