Structure of the Mapping Cylinder of a Continuous Function

You really do need $f$ to be continuous.

Suppose that $\pi[U]$ is open in $\pi[Y]$; then $\pi[U]=W\cap\pi[Y]$ for some open $W\subseteq M_f$. Since $W$ is open in the quotient $M_f$, $\pi^{-1}[W]$ is open in $(X\times I)\sqcup Y$. Now

$$\begin{align*} \big(f^{-1}[U]\times\{1\}\big)\sqcup U&=\pi^{-1}\big[\pi[U]\big]\\ &=\pi^{-1}\big(W\cap\pi[Y]\big)\\ &=\pi^{-1}[W]\cap\pi^{-1}\big[\pi[Y]\big]\\ &=\pi^{-1}[W]\cap\big((X\times\{1\})\sqcup Y\big)\,, \end{align*}$$

so $U=\pi^{-1}[W]\cap Y$, and $f^{-1}[U]\times\{1\}=f^{-1}[W]\cap(X\times\{1\}$. Thus, $f^{-1}[U]\times\{1\}$ is open in $X\times\{1\}$, and hence $f^{-1}[U]$ is open in $X$.


The subspace topology $\pi(Y)$ inherits from $M_f$ consists exactly of sets of the form $\pi(V)$ where $V \subseteq Y$ is an open set such that $f^{-1}(V)$ is open in $X$. Thus, $\pi|_Y : Y \to \pi(Y)$ is a homeomorphism if and only if $f$ is continuous.

The basic point is to understand a bit more about the topology of $M_f$ by deciding what are the saturated open subsets of $(X \times I) \sqcup Y$. Open subsets of $(X \times I) \sqcup Y$ are exactly the sets of the form $U \sqcup V$ where $U \subseteq X \times I$ and $V \subseteq Y$ are open. I claim that the sets $V$ which occur in open sets $U \sqcup V$ that are saturated with respect to $\sim$ are exactly the open subsets of $Y$ with $f^{-1}(V)$ open in $X$. Indeed, if $V$ is such a set, then taking $U = f^{-1}(V) \times I$ gives $U \sqcup V$ saturated and open. On the other hand, one easily sees that $U \sqcup V$ is saturated with respect to $\sim$ if and only if $U \cap (X \times \{1\}) = f^{-1}(V) \times \{1\}$ and the latter condition implies $f^{-1}(V)$ is open in $X$.