# Two questions about continuity of function between topological spaces

Let $X$ and $Y$ be topological spaces and suppose $f: X \to Y$ is continuous. If $f$ is continuous on $U \subset X$, will the restriction $f_U :U \to Y$ be continuous, if we consider $U$ to be a topological space of its own?

My second question is given open sets $U, V \subset \mathbb{R^n}$ and continuous functions $f_1 : U \to \mathbb{R^n}$ and $f_2 : V \to \mathbb{R^n}$ Will the function $f_{U \cup V}: U \cup V \to \mathbb{R^n}$ defined in the obvious way be continuous?

-

1) Yes, if $U$ has the subspace topology. The preimage of an open set $V$ in $Y$ under $f_U$ is just $f_U^{-1}(V)=f^{-1}(V) \cap U$, which is open by the definition of the subspace topology on $U$. This is essentially why the subspace topology is defined the way it is, so that restrictions of continuous maps are continuous.
2) For such a function to be defined, we need $f_1$ and $f_2$ to agree on $U \cap V$. In this case, the function is continuous. The preimage of an open set under $f_{U \cup V}$ is just the union of the preimages of that set under $f_1$ and $f_2$. There's nothing particular about $\mathbb{R}^n$ here. See the Pasting lemma for more general conditions.
What about $f,g$ defined on the rationals and irrationals respectively, such that $f$ sends every element to $1$ and $g$ sends every element to $0$. The "union" function is defined on $\mathbb{R}$ and not continuous? – WacDonald's Jul 10 '12 at 23:33
I just a have quick comment. That proof of the pasting lemma is bothering me. It seems like they're assuming $f^{-1}(U)$ is closed in A, which is what they're trying to prove. – WacDonald's Jul 11 '12 at 4:04
No, they’re using the fact that $f\upharpoonright X$ is continuous to say that $\left(f\upharpoonright X\right)^{-1}[U]$ is closed in $X$, and then observing that $\left(f\upharpoonright X\right)^{-1}[U]=f^{-1}[U]\cap X$. – Brian M. Scott Jul 11 '12 at 5:42