For closed subsets $A,B \subseteq X$ with $X = A \cup B$ show that $f \colon X \to Y$ is continuous iff $f|_A$ and $f|_B$ are continuous.
Solution 1:
$f$ is continuous if and only if $f^{-1}(U)$ is open for every open subest $U$ of $Y$. Hence $f$ is continuous if and only if $f^{-1}(F)$ is closed for every closed subset $F$ of $Y$.
Let $F$ be a closed subset of $Y$. Let $G = f^{-1}(F)$. It suffices to prove that $G$ is closed. $G = G \cap X = G \cap (A \cup B) = (G \cap A) \cup (G \cap B)$. Since $f|A$ is continuous, $G \cap A$ is closed in $A$. Since $A$ is closed, $G \cap A$ is closed. Similarly $G \cap B$ is closed. Hence $G = (G \cap A) \cup (G \cap B)$ is closed.
Solution 2:
$X = (A - B) \cup (B-A) \cup (A \cap B)$
$(A - B) \cap (B - A) = \emptyset$
$(B - A) \cap (A \cap B) = \emptyset$
$(A \cap B) \cap (A - B) = \emptyset$
Since $X = (A - B) \cup B$ and $B$ is closed in $X$, $A - B$ is open in $X$.
Since $X = (B - A) \cup A$ and $A$ is closed in $X$, $B - A$ is open in $X$.
Let $x_0 \in X$ .
Case 1
If $x_0 \in A - B$, then there exists $\delta_1 > 0$ such that $\{ x \in X \text{ }|\text{ } d_X(x, x_0) < \delta_1 \} \subset A - B$ because $A - B$ is open in $X$.
Let $\epsilon$ be an arbitrary positive real number.
$f_{|A}:A \rightarrow Y$ is continuous. So there exists $\delta_2 > 0$ such that $d_A(x, x_0) < \delta_2 \implies d_Y(f(x), f(x_0) < \epsilon$
Let $\delta := \min(\delta_1, \delta_2)$.
$\{ x \in X \text{ }|\text{ } d_X(x, x_0) < \delta \} = \{ x \in A \text{ }|\text{ } d_A(x, x_0) < \delta \}$
because $\{ x \in X \text{ }|\text{ } d_X(x, x_0) < \delta \} \subset A$.
And $d_A(x, x_0) < \delta \implies d_Y(f(x), f(x_0)) < \epsilon$.
So $d_X(x, x_0) < \delta \implies d_Y(f(x), f(x_0)) < \epsilon$.
Case 2
If $x_0 \in B - A$, for any real number $\epsilon > 0$, there exists a real number $\delta > 0$ such that $d_X(x, x_0) < \delta \implies d_Y(f(x), f(x_0)) < \epsilon$. The proof is similar to the case 1.
Case 3
Let $x_0 \in A \cap B$.
Let $\epsilon > 0$ be an arbitrary positive real number.
$f_{|A}:A \rightarrow Y$ and $f_{|B}:B \rightarrow Y$ are continuous.
So there exist $\delta_1 > 0, \delta_2 > 0$ such that
$d_A(x, x_0) < \delta_1 \implies d_Y(f(x), f(x_0)) < \epsilon$ and
$d_B(x, x_0) < \delta_2 \implies d_Y(f(x), f(x_0)) < \epsilon$.
Let $\delta := \min(\delta_1, \delta_2)$.
$\{x \in A \text{ }|\text{ } d_A(x, x0) < \delta\} \cup \{x \in B \text{ }|\text{ } d_B(x, x0) < \delta\} = \{x \in X \text{ }|\text{ } d_X(x, x0) < \delta\}$.
$x \in \{x \in A \text{ }|\text{ } d_A(x, x0) < \delta\} ⇒ d_Y(f(x), f(x0)) < \epsilon$.
$x \in \{x \in B \text{ }|\text{ } d_B(x, x0) < \delta\} ⇒ d_Y(f(x), f(x0)) < \epsilon$.
So
$x \in \{x \in X \text{ }|\text{ } d_X(x, x0) < \delta\} ⇒ d_Y(f(x), f(x0)) < \epsilon$.
So
$f$ is continuous.