Prove $f: X \rightarrow Y$ is continuous if $A_a$ is closed and $f|A_a$ is continuous for any $a$ and $\text{{$A_a$}}$ is locally finite collection

Let $f:\bigcup_{\alpha}A_{\alpha} \rightarrow Y$ be a function between the topological spaces Y and $X=\bigcup_{\alpha}A_{\alpha}$. Suppose that $f|A_{\alpha}$ is a continuous function for every $\alpha$ and that $\text{{$A_{\alpha}$}}$ is locally finite collection. Suppose that $A_{\alpha}$ is closed for every $\alpha$.

Show that: $f$ is continuous.

Any hints?

Solutions Collecting From Web of "Prove $f: X \rightarrow Y$ is continuous if $A_a$ is closed and $f|A_a$ is continuous for any $a$ and $\text{{$A_a$}}$ is locally finite collection"

We denote $f_{\alpha}:=f/A_{\alpha}$. Let $F$ be a closed subset of $Y$, we have
$f^{-1}(F)=\cup_{\alpha}f_{\alpha}^{-1}(F)$, now for each $\alpha$, $f_{\alpha}^{-1}(F)$ is a closed subset $A_{\alpha}$ hence it is a closed subset (in $X$). To finish we want to show that $f^{-1}(F)$ is closed. Let $x\in \overline{f^{-1}(F)}$, and fix a neighborhood $V$ of $x$ which intersect only a finitely many of the sets $A_{\alpha_1},\ldots,A_{\alpha_d}$, it is clear that each neighborhood $W$ of $x$ intersect $\cup_{i=1}^df_{\alpha_i}^{-1}(F)$, hence $x\in \overline{\cup_{i=1}^df_{\alpha_i}^{-1}(F)}=\cup_{i=1}^df_{\alpha_i}^{-1}(F)\subset f^{-1}(F)$.

Recall that a function $f:X \to Y$ between topological spaces is continuous iff $f^{-1}(A)$ is closed for every closed set $A$ of $Y$.

What are the closed sets of $X = \bigcup_\alpha A_\alpha$? Why is it necessary for $\{A_\alpha\}$ to be locally finite collection?

Lemma: Let $W\subset X$ be such that for all $\alpha\;W\cap A_\alpha$ is open in $A_\alpha$. Then $W$ is an open subset of $X$.

Proof: Let $p\in W$. Since $\{A_\alpha\}$ is locally finite, there is an open neighborhood $p\in O$, such that $O$ intersects only finitely many $A$’s, say $A_1,\ldots,A_n$. Of all those $A_1,\ldots,A_n$, say $p$ lies in $A_1,\ldots,A_m$ where $m\leq n$. Since $A_{m+1}\cup\ldots\cup A_n$ is closed in $X$ and does not contain $p$, there is an open $O’\subset O$ that contains $p$ and does not intersect $A_{m+1},\ldots,A_n$.

For $i=1,\ldots,m$, $W\cap A_i$ is open in $A_i$ and contains $p$, thus there is an open $V_i\subset X$ containing $p$, such that $V_i\cap A_i\subset W\cap A_i$. We claim that $$\left(\bigcap_{i=1}^mV_i\right)\cap O’\subset W.$$To see this, let $q$ be some point in LHS. Since $q\in O’$, we have $q\in A_i$ for some $i=1,\ldots,m$, thus $q\in A_i\cap V_i\subset W$.

This should be enough.