There is a step in the proof of the following theorem, which I do not understand.
Let $X,Y$ be topological spaces. Let $A_1,\dotso, A_m\subseteq X$ be closed with $X=A_1\cup\dotso\cup A_m$. Let $f:X\to Y$ be a function. If for every $j=1,\dotso, m$ the restriction $f_{|A_j}:A_j\to Y$ is continuous, then $f$ is continuous.
Proof:
Let $A\subseteq Y$ be closed. We show that $f^{-1}(A)$ is closed.
Define $f_j=f_{|A_j}: A_j\to Y$. Then is $f_j^{-1}(A)=f^{-1}(A)\cap A_j$.
Hence $f^{-1}(A)=\cup_{j=1}^m f_j^{-1}(A_j)=\bigcup_{j=1}^m f^{-1}(A)\cap A_j$.
Now $f^{-1}(A)\cap A_j$ is supposed to be closed in $A_j$, but I do not see why.
Besides this minor step, everything is clear, because then $f^{-1}(A)\cap A_j$ is also closed in $X$ since $A_j\subseteq X$ is closed, to $f^{-1}(A)$ is closed as a finite union of closed sets.
I know that $f^{-1}(A)\cap A_j$ is closed in $A_j$ iff there is $U\subseteq X$ open with $A_j - (f^{-1}(A)\cap A_j)=U\cap Y$.
With the commen identity of sets $A-B=A\cap B^c$ and De Morgan's law I would argue that
$f^{-1}(A)^c\cup A_j^c$ is open. For sure $A_j^c$ is open. So either $f^{-1}(A)^c\subseteq A_j^c$ or $f^{-1}(A)^c$ is open.
I do not see why either of this should hold.
I just noticed that there is no 'obvious' (at least to me) point in the proof, where one uses that $f_j$ is continuous. The only step where it can be used is when we write:
$f_j^{-1}(A)=f^{-1}(A)\cap A_j$, which is closed as a preimage of a closed sets under a continuous function.
Wait... why can we not stop after:
$f^{-1}(A)=\cup_{j=1}^m f_j^{-1}(A_j)$, where the RHS is a closed set?
Something with this proof is odd... Can you help me out?
Thanks in advance.
As discussed in the comments, $f_j^{-1}(A)$ is closed in $A_j$. The following lemma implies that $f_j^{-1}(A)$ is also closed in $X$. Then you can conclude the proof.