## Pasting Lemma (Elaboration of Wikipedia’s proof)

The proof of the Pasting Lemma at Wikipedia is correct, but a bit unclear. In particular, it does not clearly show how the hypothesis that X, Y are both closed is being used. It actually has something to do with subspace topology.

I have added some clarifications here:

## Pasting Lemma (Statement)

Let $X$, $Y$ be both closed (or both open) subsets of a topological space $A$ such that $A=X\cup Y$, and let $B$ also be a topological space. If both $f|_X: X\to B$ and $f|_Y: Y\to B$ are continuous, then $f:A \to B$ is continuous.

## Proof:

Let $U$ be a closed subset of $B$. Then $f^{-1}(U)\cap X$ is closed in $X$ since it is the preimage of $U$ under the function $f|_X:X\to B$, which is continuous. Hence $f^{-1}(U)\cap X=F\cap X$ for some set $F$ closed in $A$. Since $X$ is closed in $A$, $f^{-1}(U)\cap X$ is closed in $A$.

Similarly, $f^{-1}(U)\cap Y$ is closed (in $A$). Then, their union $f^{-1}(U)$ is also closed (in $A$), being a finite union of closed sets.