Show that if the restrictions of $f$ to $S_1$ and to $S_2$ are continuous then $f$ is continuous. Let $E$,$E^{\prime}$ be metric spaces, $f: E \to E^{\prime}$ a function, and suppose that $S_1,S_2$ are closed subsets of $E$ such that $E = S_1 \cup S_2$. Show that if the restrictions of $f$ to $S_1$ and to $S_2$ are continuous then $f$ is continuous.

What is meant by restrictions? Is it stating that $f(S_1)$ is continuous and $f(S_2)$ is continuous so now show that the function is continuous for $E \to E^{\prime}$?
Thank you in advance! :) 
 A: Proposition: Let $X$, $Y$ be topological spaces and let $f:X\rightarrow Y$
be a mapping. Let $E_{1},E_{2}$ be closed subsets of $X$ such that
$E_{1}\cup E_{2}=X$. Let $g_{1}=f\vert_{E_{1}}$ and $g_{2}=f\vert_{E_{2}}$.
We have that $f$ is continuous iff $g_{1}$ and $g_{2}$ are continuous.
Proof: Suppose that $f$ is continuous. Let $F\subseteq Y$ be a closed
subset, then $f^{-1}(F)$ is a closed subset of $X$. Note that $g_{1}^{-1}(F)=f^{-1}(F)\cap E_{1}$
which is a closed subset of $E_{1}$ because closed subset of $E_{1}$
is precisely of the form: $K\cap E_{1}$ for some closed subset $K$
of $X$. ( For, if $K$ is a closed subset of $X$, then $E_{1}\setminus(K\cap E_{1})=E_{1}\cap K^{c}$
which is an open subset of $E_{1}$. Hence $K\cap E_{1}$ is a closed
subset of $E_{1}$. Conversely, if $A$ is a closed subset of $E_{1}$,
then $E_{1}\setminus A$ is an open subset of $E_{1}$. Therefore,
there exists an open set $U\subseteq X$ such that $E_{1}\setminus A=E_{1}\cap U$.
Now $A=E_{1}\setminus(E_{1}\cap U)=E_{1}\cap U^{c}$. Note that $U^{c}$
is a closed subset of $X$.) It follows that $g_{1}:E_{1}\rightarrow Y$
is continuous. Similarly, it can be proved that $g_{2}$ is continuous.
Converserly, suppose that $g_{1}$ and $g_{2}$ are continuous. Let
$F\subseteq Y$ be a closed subset, then $f^{-1}(F)=g_{1}^{-1}(F)\cup g_{2}^{-1}(F)$.
Note that $g_{1}^{-1}(F)$ is closed in $E_{1}$ and $g_{2}^{-1}(F)$
is closed in $E_{2}$, so there exist closed subsets $K_{1}$,
$K_{2}$ of $X$ such that $g_{1}^{-1}(F)=K_{1}\cap E_{1}$ and $g_{2}^{-1}(F)=K_{2}\cap E_{2}$.
It follows that $f^{-1}(F)=(K_{1}\cap E_{1})\cup(K_{1}\cap E_{2})$
which is closed in $X$.
Remark: The proposition is false if either $E_{1}$ or $E_{2}$ is
not closed. For example, let $X=Y=\mathbb{R}$ with the usual topology.
Let $E_{1}=(-\infty,0]$ and $E_{2}=(0,\infty)$. Note that $E_{1}\cup E_{2}=X$.
Define $f:X\rightarrow Y$ by $f=1_{E_{2}}$. Clearly $f\vert_{E_{1}}=0$
and $f\vert_{E_{2}}=1$. Therefore, these restrictions are continuous.
However, $f$ is not continuous. The above proof fails if
either $E_{1}$ or $E_{2}$ is not closed because in the last step
$f^{-1}(F)=(K_{1}\cap E_{1})\cup(K_{1}\cap E_{2})$, the sets $K_{1}\cap E_{1}$,
$K_{2}\cap E_{2}$ may not closed in $X$.
A: For starters, $f(S_1)$ and $f(S_2)$ are sets, and sets are not continuous: functions are.
You have $f|_{S_1}:S_1\to E'$ given by $f|_{S_1}(x)\doteq f(x)$ and similarly for $S_2$.
I'll give you hints:


*

*use that $f:E\to E'$ is continuous if and only if $f^{-1}(B)$ is closed in $E$ for each $B$ closed in $E'$.

*given such $B$, try to relate $f^{-1}(B)$ with  $(f|_{S_1})^{-1}(B)$ and $(f|_{S_2})^{-1}(B)$.

*use that if $C$ is closed in $S_1$ and $S_1$ is closed in $E$, then $C$ is closed in $E$ (and similarly for $S_2$).
