Show that these two following conditions are equivalent for topological spaces $X$ and $Y$ $X$ is a topological space which is a reunion of two closed subspaces $\mathbb {X}_1$ and $\mathbb {X}_2$. Suppose $f$ is a function of $X$ in topological space $Y$. Show that these two following conditions are equivalent;
i) the restrictions of $f$ in $\mathbb {X}_1$ and $\mathbb {X}_2$ are continuous;
ii) $f$ is continuous. 
 A: Hint: A function $f$ is continuous iff the pre-image of any closed set is closed.
A: $(1) \Rightarrow (2)$ The Pasting Lemma states that if $f_1 : X_1 \rightarrow Y$ and $f_2 : X_2 \rightarrow Y$ where $X_1$ and $X_2$ are closed subset of $X$ and $f_1, f_2$ are continuous, and the two functions agree on the overlap, then $f$ defined by "pasting" the two function together is continuous. See page 108 in Munkres $\textit{Topology}$. 
$(2) \Rightarrow (1)$ If $f$ is continuous, then for all $U \subset Y$ which is open, $f_1^{-1}(U) = f^{-1}(U) \cap X_1$. $f^{-1}(U)$ is open by continuity of $f$. $f^{-1}(U) \cap X_1$ is open in the relative topology of $X_1$ by definition. So $f_1$ is continuous on $X_1$ with the relative topology. Same for $X_2$. 

I think there is probably a more elementary proof of the first direction rather than using the pasting lemma. However, the pasting lemma is not hard and quite useful.
In Response to the comment I will clarify the notion of a restriction. 
If $f : X \rightarrow Y$ is a function between topological spaces and $X_1 \subset X$ ,then $f_1 : X_1 \rightarrow Y$ defined by $f_1(x) = f(x)$ for all $x \in X_1$ is a function between the topological space $X_1$ to $Y$ where the topology on $X_1$ is the subset or relative topology. That is $U \subset X_1$ is a open if and only if there is a $V$ open in $X$ such that $U = V \cap X_1$. 
