Continuity of a function whose domain is $[0,1] \cup [2,3]$ Consider $A=[0,1]\cup[2,3]$ and $f : A \to \Bbb{R}$ which is defined as $f(x)=x^2,x∈[0,1]$ and $f(x)=x^3,x∈[2,3]$. Is $f$ continuous on $A$?
I have been asked to prove this using sequences. But I tried to prove this using the topological definition of continuity($\Bbb{R}$ is given the standard topology). 
Since it says that the preimage of a closed set should be closed, note that for $x \in [0,1], f(x) \in [0,1]$ and for $x\in [2,3] , f(x) \in [8,27]$.
So the range is $[0,1] \cup [8,27]$ if I take any closed set in this , it will also have a closed preimage.
For sequences:
I can argue that since these sets are bounded, given $x\in [0,1]$ (WLOG), if a sequence $p_n $ converges to $x$, there must exist an $N$ such that for all $n>N$, $p_n$ lies in $[0,1]$. But how do I proceed after this ?
Can someone check these two arguments of mine.
Thanks in advance
 A: It is clear that the functions $\operatorname{sq}, \operatorname{cb} : \mathbb{R} \to \mathbb{R}$ given by $\operatorname{sq}(x) = x^2$ and $\operatorname{cb}(x) = x^3$ are continuous.
Let $B$ be a closed set in $\mathbb{R}$.
We have:
\begin{align}
f^{-1}(B) &= f^{-1}(B \cap ([0,1] \cup [8,27]))\\
&= f^{-1}((B \cap [0,1]) \cup (B \cap [8,27]))\\
&= f^{-1}(B \cap [0,1]) \cup f^{-1}(B \cap [8,27])\\
&= (\operatorname{sq}^{-1}(B) \cap [0,1]) \cup (\operatorname{cb}^{-1}(B) \cap [2,3])
\end{align}
Since $\operatorname{sq}$ and $\operatorname{cb}$ are continuous, we have that $\operatorname{sq}^{-1}(B)$ and $\operatorname{cb}^{-1}(B)$ are closed in $\mathbb{R}$, and so we conclude that $f^{-1}(B)$ is closed in $\mathbb{R}$. 
In particular, $f^{-1}(B)$ is closed in $A$ so we conclude that $f$ is continuous.

Let $(x_n)_{n=1}^\infty$ be a sequence in $A$ such that $x_n \xrightarrow{n\to\infty} x \in A$. As you said, if $x \in [0,1]$ then there exists $n_0 \in \mathbb{N}$ such that $n \ge n_0 \implies x_n \in [0,1]$.
Therefore, the sequence $(x_n)_{n=n_0}^\infty$ is in $[0,1]$ and also converges to $x$. Since $\operatorname{sq}$ is continuous, we have:
$$f(x_n) = \operatorname{sq}(x_n) \xrightarrow{n\to\infty, n \ge n_0} \operatorname{sq}(x) = f(x)$$
Similarly we would conclude that $f(x_n) \xrightarrow{n\to\infty} f(x)$ if $x \in [2,3]$.
A: Lemma:
Let $X$ and $Y$ be topological spaces and let $A,B$ be closed subsets of $X$. Let $g:A\to Y$ and $h:B\to Y$ be functions such that on $A\cap B$ the functions coincide. Then the function $f:A\cup B\to Y$ prescribed  by $x\mapsto g(x)$ if $x\in A$ and $x\mapsto h(x)$ if $x\in B$ is evidently well-defined. $$\text{If }g\text{ and }h\text{ are continuous then }f\text{ is continuous}$$
Proof:
Let it be that $F\subseteq Y$ is closed. Then $g^{-1}(F)$ is closed in $A$ and $h^{-1}(F)$ is closed in $B$. That means that closed sets $P,Q\subseteq X$ exist with $g^{-1}(F)=A\cap P$ and $h^{-1}(F)=B\cap Q$. Then $A\cap P$ and $B\cap Q$ are closed subsets of $X$ because $A$ and $B$ are both closed. Then their union - which equals $f^{-1}(F)$ is closed. This proves that $f$ is continuous.

You can apply this lemma in order to prove that the function $f$ mentioned in your question is continuous. It comes to proving that the map $x\mapsto x^2$ on domain $[0,1]$ is continous and that map $x\mapsto x^3$ on domain $[2,3]$ is continuous. In this case the intersection of the domains is empty, hence is closed.
