Let A be $\subset \mathbb{R}$ and $A_1…A_n$ be $\subset \mathbb{R}$, such that. A = $\bigcup_{i=1}^{N}A_i$

If each $$A_i$$ is closed in $$A$$, show that a given function $$f:A \to B$$ is continuous, if and only if the restrictions $$f_{A_i} \to B$$ is continuous.

I'm not sure how to go about solving this question. I know that a set is only closed if its complement is open but I don't see how that helps me here unfortunately.

• The difficulty of this question depends on how much mathematical background you have. Are you are allowed to use the standard fact that a function $f:A \to B$ is continuous if and only if for every subset $C$ closed in $B$, $f^{-1}(C)$ is closed in $A$? If so then it's fairly easy. You need also that a finite union of closed subsets of $A$ is closed in $A$. – Michael Cohen Feb 17 at 16:38
• Also if you know the Pasting lemma or Gluing lemma that can be used to prove this easily. – absolute0 Feb 17 at 17:49
• @MichaelCohen Would that mean that this wouldn't work if i was from 1 to infinity? It has to be finite? – user874917 Feb 18 at 0:41
• @dk1233 Yes the index set has to be finite. However if you replaced the word "open" by "closed" throughout then the proposition would also work for an infinite index set. – Michael Cohen Feb 18 at 1:42
• @MichaelCohen Can you explain why it wouldn't work for an infinite set? – user874917 Feb 18 at 2:23

If $$f:A\longrightarrow B$$ is continuous, obviously $$f|_{A_i}$$ is continuous for all $$i\in\{1,\ldots,n\}$$.
Now assume that all the $$f|_{A_i}$$, $$i\in\{1,\ldots,n\}$$ are continuous, and let $$x_0\in A:=\bigcup_{i=1}^n A_i$$. Let $$i_1,\ldots,i_k\in\{1,\ldots,n\}$$ be the indexes of all the sets $$A_{i_j}$$ such that $$x_0\in A_{i_j}$$.
Also, because the $$A_i$$ are all closed, $$\mathbb{R}\setminus A_i$$ are all open. Then, if $$x_0\not\in A_i$$ for $$i\not\in\{i_1,\ldots,i_k\}$$, we can take $$\delta_i\in\mathbb{R}^+$$ such that $$B(x_0,\delta_i)\cap A_i=\emptyset$$. Let then $$\delta_M=\min\{\delta_i :i\not\in\{i_1,\ldots,i_k\}\}$$. We have that $$B(x_0,\delta)\cap A_i=\emptyset$$ for all $$i\not\in\{i_1,\ldots,i_k\}$$.
Let $$\epsilon\in\mathbb{R}^+$$, and let $$\delta_{i_j}\in\mathbb{R}^+$$ such that $$|f|_{A_{i_j}}(x)-f(x_0)|<\epsilon$$ for all $$x\in B(x_0,\delta_{i_j})\cap A_{i_j}$$ and $$j\in\{1,\ldots,k\}$$.
If we choose $$\delta:=\min\{\delta_M,\delta_{i_j} : j\in\{1,\ldots,k\}\}$$, then, if $$x\in B(x_0,\delta)\cap A$$, $$x\not\in A_i$$ for all $$i\not\in\{i_1,\ldots,i_j\}$$ because $$B(x_0,\delta)\cap A_i=\emptyset$$. As $$x\in A=\bigcup_{i=1}^n A_i$$, there must exist $$i_j\in\{i_1,\ldots,i_k\}$$ such that $$x\in A_{i_j}$$. Then, $$x\in B(x_0,\delta)\cap A_{i_j}\subset B(x_0,\delta_{i_j})\cap A_{i_j}$$, and we get that: $$|f(x)-f(x_0)|=|f|_{A_{i_j}}(x)-f(x_0)|<\epsilon$$ Which concludes the proof.