Function is Continuous When Restricted to Closed Sets Which Cover the Space

You don't really need such a lemma (which is true and in general is known as the transitive law for initial topologies, in a much more abstract setting, see my long answer here).

What you need is the following observation: for any subset $A$ of $X$ and any function $f: X \to Y$: $$(f|_A)^{-1}[C] = f^{-1}[C] \cap A$$ for all subsets $C$ of $Y$. This holds as $x \in (f|_A)^{-1}[C]$ iff $x \in A$ and $f(x) \in C$.

Now if $f|_{A_i}$ is continuous for each $i$ and $C$ is closed in $Y$, we know that $(f|_{A_i})^{-1}[C] = f^{-1}[C] \cap A_i$ is closed in $A_i$ and hence closed in $X$ as well (closed in a closed subspace is closed in the whole space). And then $$f^{-1}[C] = f^{-1}[C]\cap X = f^{-1}[C] \cap (\bigcup_i A_i) = \bigcup_i (f^{-1}[C] \cap A_i) $$ is a finite union of closed subsets of $X$ hence closed.

So $f$ is continuous, as inverse images of closed sets are closed.


What you wrote is correct. If $M$ is a topological space, and $A\subset B\subset M$, then and $f$ is a function from $M$ into another metric space, then $f|_A$ is continuous if and only if $(f|_B)|_A$ is continuous. So, the answer to your two questions is affirmative.