Having trouble on proving this topological continuous question in Hatcher's Notes. 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$.
 A: Hint:
You have to show that $f^{-1}(U)$ is open in $X$. So:
$$f^{-1}(U) = f^{-1}(U) \cap X$$
Now, rewrite $X$ in a different way, do some set-theoretic mumbo-jumbo and use what you have so far to conclude that $f^{-1}(U)$ is open.
A: I think I got it, 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}}$. Since $(f|O_{\alpha})^{-1}(U) \in \mathcal{O}_{X_{\alpha}}$, then there exists an open set $U \in \mathcal{O}_X$ such that $(f|O_{\alpha})^{-1}(U) = U \cap O_{\alpha} \in \mathcal{O}_X$(closed under finite intersections). From inverse properties, we know that $(f|O_{\alpha})^{-1}(U) = f^{-1}(U) \cap O_{\alpha}$ for all $\alpha \in I$. Then, $\bigcup_{\alpha \in I} (f|O_{\alpha})^{-1}(U) = \bigcup_{\alpha \in I} (f^{-1}(U) \cap O_{\alpha}) = f^{-1}(U) \cap \bigcup_{\alpha \in I} O_{\alpha} = f^{-1}(U) \cap X = f^{-1}(U)$. Therefore, $f^{-1}(U) \in \mathcal{O}_X$ since $\bigcup_{\alpha \in I} (f|O_{\alpha})^{-1}(U) \in \mathcal{O}_X$.
