Is a function between topological spaces continuous if continuous on subspaces

general-topology

Assume that there are two topological spaces $X,Y$ and a function $f:X\rightarrow Y$. Furthermore, assume that there exists a collection of sets $\mathcal{B}$ such that

$\bigcup_{B\in \mathcal{B}} B = X,$

and for each $B \in \mathcal{B}$ the restriction $f|_B$ is continuous with respect to the subspace topology.

Is this enough to say that $f$ is continuous on the whole space?

Best Answer

As pointed out by others in the comments, this in general fails. The most relevant positive result (other than those mentioned by @Henno Brandsma) is the Pasting lemma, which states that this holds when $\mathcal B$ is finite and each $B\in\mathcal B$ is closed.