Union of continuous functions on closed (or open) subsets is continuous Good morning, I'm doing Problem III.2.13 from textbook Analysis I by Amann.



My attempt:
Let $C \subseteq Y$ be closed in $Y$. Because $g$ is continuous, $g^{-1}[C]$ is closed in $A$. As such, there is $X_1 \subseteq X$ such that $X_1$ is closed in $X$ and $g^{-1}[C] = X_1 \cap A$. Similarly, there is $X_2 \subseteq X$ such that $X_2$ is closed in $X$ and $h^{-1}[C] = X_2 \cap B$. We have $$\begin{aligned}f^{-1}[C] &= g^{-1}[C] \cup h^{-1}[C]= (X_1 \cap A) \cup (X_2 \cap B) \\ & = (X_1 \cup X_2) \cap (X_1 \cup B) \cap (X_2 \cup A) \cap (A \cup B)\end{aligned}$$
It follows from $X_1,X_2,A,B$ are closed in $X$ that $(X_1 \cup B), (X_2 \cup A), (A \cup B)$ are closed in $X$. As such, $D := (X_1 \cup B) \cap (X_2 \cup A) \cap (A \cup B)$ is closed in $X$. Hence $f^{-1}[C] = (X_1 \cup X_2) \cap D$ is closed in $X_1 \cup X_2$. Thus $f$ is continuous.

My questions:

*

*Could you please verify if my proof look fine or contains logical gaps/errors? Any suggestion is greatly appreciated.


*I found that my proof only relies on topological concepts such as open and closed. As such, I think that the theorem holds for not only metric spaces but also for topological spaces. Is my understanding correct?


*If we change the assumption from $A,B$ are closed subsets to $A,B$ are open subsets, then the theorem still holds true. This is because I can adjust my proof by starting with open subset $C \subseteq Y$ rather than closed subset $C \subseteq Y$. More specifically,

Let $C \subseteq Y$ be open in $Y$. Because $g$ is continuous, $g^{-1}[C]$ is open in $A$. As such, there is $X_1 \subseteq X$ such that $X_1$ is open in $X$ and $g^{-1}[C] = X_1 \cap A$. Similarly, there is $X_2 \subseteq X$ such that $X_2$ is open in $X$ and $h^{-1}[C] = X_2 \cap B$. We have $$\begin{aligned}f^{-1}[C] &= g^{-1}[C] \cup h^{-1}[C]= (X_1 \cap A) \cup (X_2 \cap B) \\ & = (X_1 \cup X_2) \cap (X_1 \cup B) \cap (X_2 \cup A) \cap (A \cup B)\end{aligned}$$
It follows from $X_1,X_2,A,B$ are open in $X$ that $(X_1 \cup B), (X_2 \cup A), (A \cup B)$ are open in $X$. As such, $D := (X_1 \cup B) \cap (X_2 \cup A) \cap (A \cup B)$ is open in $X$. Hence $f^{-1}[C] = (X_1 \cup X_2) \cap D$ is open in $X_1 \cup X_2$. Thus $f$ is continuous.

Is this generalization correct?
Thank you so much for your help!
 A: As @Matematleta pointed out in his/her comment. I need to show that $f^{-1}[C]$ is closed in $A\cup B$, not $X_1\cup X_2$.
Here is my fixed proof in case $A,B$ are closed in $X$.

Let $C \subseteq Y$ be closed in $Y$. Because $g$ is continuous, $g^{-1}[C]$ is closed in $A$. As such, there is $X_1 \subseteq X$ such that $X_1$ is closed in $X$ and $g^{-1}[C] = X_1 \cap A$. Similarly, there is $X_2 \subseteq X$ such that $X_2$ is closed in $X$ and $h^{-1}[C] = X_2 \cap B$. We have $$\begin{aligned}f^{-1}[C] &= g^{-1}[C] \cup h^{-1}[C]= (X_1 \cap A) \cup (X_2 \cap B) \\ & = (X_1 \cup X_2) \cap (X_1 \cup B) \cap (X_2 \cup A) \cap (A \cup B)\end{aligned}$$
It follows from $X_1,X_2,A,B$ are closed in $X$ that $(X_1 \cup X_2),(X_1 \cup B), (X_2 \cup A)$ are closed in $X$. As such, $D := (X_1 \cup X_2) \cap (X_1 \cup B) \cap (X_2 \cup A)$ is closed in $X$. Hence $f^{-1}[C] = D \cap (A\cup B)$ is closed in $A \cup B$. Thus $f$ is continuous.

Here is my fixed proof in case $A,B$ are open in $X$.

Let $C \subseteq Y$ be open in $Y$. Because $g$ is continuous, $g^{-1}[C]$ is open in $A$. As such, there is $X_1 \subseteq X$ such that $X_1$ is open in $X$ and $g^{-1}[C] = X_1 \cap A$. Similarly, there is $X_2 \subseteq X$ such that $X_2$ is open in $X$ and $h^{-1}[C] = X_2 \cap B$. We have $$\begin{aligned}f^{-1}[C] &= g^{-1}[C] \cup h^{-1}[C]= (X_1 \cap A) \cup (X_2 \cap B) \\ & = (X_1 \cup X_2) \cap (X_1 \cup B) \cap (X_2 \cup A) \cap (A \cup B)\end{aligned}$$
It follows from $X_1,X_2,A,B$ are open in $X$ that $(X_1 \cup X_2),(X_1 \cup B), (X_2 \cup A)$ are open in $X$. As such, $D := (X_1 \cup X_2) \cap (X_1 \cup B) \cap (X_2 \cup A)$ is open in $X$. Hence $f^{-1}[C] = D \cap (A\cup B)$ is open in $A \cup B$. Thus $f$ is continuous.

