I am currently reading Hatcher's notes on point set topology. I am trying to do his exercises. I am stuck on this question.
1.14 Suppose a space $X$ is the union of a collection of open sets $O_{\alpha}$. Show that a map $f:X \rightarrow Y$ is continuous if its restriction to each subspace $O_{\alpha}$ is continuous.
I have tried, Let $(X,\mathcal{O}_X)$, $(Y,\mathcal{O}_Y)$, and $\{O_{\alpha}\}_{\alpha \in I} \subset \mathcal{O}_X$ where $\bigcup_{\alpha \in I} O_{\alpha} = X$. Suppose for all $\alpha \in I$, $f|O_{\alpha}:O_{\alpha} \rightarrow Y$ is continuous(Note, $(O_{\alpha}, \mathcal{O}_{X_{\alpha}})$ is a topological space). Let $U \in \mathcal{O}_Y$. Clearly, for all $\alpha \in I$, $(f|O_{\alpha})^{-1}(U) \in \mathcal{O}_{X_{\alpha}}$. From inverse properties, we know that $(f|O_{\alpha})^{-1}(U) = f^{-1}(U) \cap O_{\alpha}$ for all $\alpha \in I$.