Take topological spaces $X$ and $Y$, a function $f:X \to Y$ and a family $(A_i)_{i\in I}$ os subsets of $X$ and $X= \cup A_i$. Assume that $f|_{A_i} $is continuous for each $i \in I$. Show that if I is finite and each $A_i$ is closed in $X$, then $f$ is continous.
$f$ is continous if preimage of every closed set in $Y$ is closed in $X$. I know that a union of finitely many closed sets is closed but I am not sure how to mix it.
For each $i \in I$ $f_i : A_i \to Y$ is continous, that means for each closed $C \subset Y$, $f^{-1}(C)$ is closed in $A_i$. Can I write something like this $f^{-1}(C_i)=A_i $?