continuity question consider the simple function 
$$f(x) = \left\{
     \begin{array}{ll}
       1 & \mbox{if $x \in [0,1]$}\\
       10 & \mbox{if $x \in \mathbb{Q} \cap [1,2]$}\\
      -10 & \mbox{if  $x \in \mathbb{Q^c} \cap [1,2]$}\\
       2 & \mbox{if  $x \in [2,3]$}\
 \end{array} \right.$$
is it correct to say that f is continuous on $[0,1] \cup [2,3]$?
 A: Hint: Your function is not well defined at 1 and 2, as those $x$ values each meet two of your criteria.  Having fixed that, say by making the interval in the second line $(1,2)$, what happens near 1 and 2?
A: This function is not well-defined at some points. For example $f(1) = 1$ since $1 \in [0,1]$, but also $f(1) = 10$ because $1 \in \mathbb{Q} \cap [1,2]$ as well (similarly for $x=2$).
Once you correct this, note that if you define $f(1)=1$, then arbitrarily close to $1$ you can find numbers that are rational (or irrational) and greater than one. Here the function evaluates to $10$ (or $-10$), and so it will not be continuous at $1$ (nor at $2$ for the same reason).
A: (Assume the definition of the function is corrected so that $f(1)=1$, $f(2)=2$.)
$f$ is a function on $[1,3]$.  The points where $f$ is continuous are $[0,1) \cup (2,3]$.  In that sense, one would not say that $f$ is continuous on $[0,1] \cup [2,3]$.
However, what is true is that the restriction $f|_{[0,1] \cup [2,3]}$ of $f$ to $[0,1] \cup [2,3]$ is a continuous function on all of its domain.  But strictly speaking this is a different function from $f$.
A: As others have pointed out, it seems reasonable to assume that you meant to define $f$ like this:
$$f = \chi_{[0,1]} + 10\chi_{\mathbb{Q}\cap (1,2)} -10\chi_{(1,2)\setminus\mathbb{Q}} +2\chi_{[2,3]}, $$
where $\chi_A$ is the indicator function on $A$.
And it is true that $f|_{[0,1]\cup [2,3]}$ is continuous since it's constant on each of its domain's connected components.
