# Functions from Disjoint Unions

Let $X$ and $Y$ be topological spaces and $W$ is their disjoint union. Show that $f: W \to Z$, where Z is a topological space, is continuous if and only if $f|X$ and $f|Y$ are both continuous. I believe I understand how this works conceptually I'm just having trouble with writing the proof.

-
Can you at least write the only if direction: if $f$ is continuous, then $f\upharpoonright X$ and $f\upharpoonright Y$ are continuous? –  Brian M. Scott Feb 26 '13 at 18:50

Well, $U$ is open (closed) in $W$ if and only if $U\cap X$ is open (closed) in $X$ and $U\cap Y$ is open (closed) in $Y$.
Given that, there are $3$ observations that should let you take care of both directions: $$(f\mid X)^{-1}(V)=X\cap f^{-1}(V)\tag{1}$$ $$(f\mid Y)^{-1}(V)=Y\cap f^{-1}(V)\tag{2}$$ $$f^{-1}(V)=(f\mid X)^{-1}(V)\cup(f\mid Y)^{-1}(V)\tag{3}$$ (In each case, $V$ is an arbitrary subset of $Z$, though we're only really interested in particular sorts of $V$ when proving continuity.) Use $(1)$ and $(2)$ for one direction, and $(3)$ for the other. You should be able to prove each of $(1)$ through $(3)$ from the definitions of preimage, restriction, etc. (nothing topological about those proofs).