Munkres p30 prob. 6: "$\displaystyle Let X = A \cup B$, where A and B are subspaces of X. Let $\displaystyle f:X \rightarrow Y$; suppose that the restricted functions $\displaystyle f|A:A \rightarrow Y $ and $\displaystyle f|B \rightarrow Y $are continuous. Show that if both A and B are closed in X, then f is continuous." Please let me know if the proof below is sound. I would also appreciate help on how to write it better. Thank you.

Assume x_{0}$\displaystyle \epsilon A$. By the definition of continuity, for every open set $\displaystyle V \subset Y$ containing f(x_{0}) there is an open set Y_{a}$\displaystyle \subset A$ containing x_{0}s.t. f|Y_{a}$\displaystyle \subset V$. If x_{0}$\displaystyle \epsilon Ext B$, then Y_{a}$\displaystyle \subset X$ satisfies the condition for continuity. Otherwise, x_{0}$\displaystyle \epsilon B$. In that case there is similarly an open set Y_{b}containing x_{0}s.t. f|Y_{b}$\displaystyle \subset V$. Choose Y_{x}= Y_{a}$\displaystyle \cap $Y_{b}. The same reasoning applies with the sets A and B reversed. Therefore for every x_{0}$\displaystyle \epsilon (A \cup B)$ there is an open set (i.e. Y_{x)}containing x_{0}s.t. f|Y_{x}$\displaystyle \subset V$. Then f is continuous on X.