How to determine the continuity of a piecewise function defined respectively on $\mathbb{Q}$ and $\mathbb{I}$ How can I tell the continuity of function 
$$ f(x)=\left\{
\begin{array}{lll}
3x^2 & \text{if} & x\in\mathbb Q\\
4x^2 & \text{if} & x\in\mathbb I
\end{array}
\right. $$
I could see it is continuous at x=0 and guess it discontinuous no-where-else. How can I start with the formalised proof?
And also, is $f$ differentiable at 0?
 A: Let $x_0 \in \mathbb{R}$. If $(x_n)$ is a sequence of real numbers such that $x_n \to x_0$ as $n \to \infty$ then $f$ is continuous at $x_0$ if and only if $$\lim_{n\to \infty} f(x_n) = f(x_0)$$
Lets assume $x_0 \in \mathbb{Q}$, and let $(x_n)$ be a sequence of irracional numbers (converging to $x_0$), therefore, $f(x_n)$ is the sequence $4x_n^2$ and then $\lim f(x_n) = \lim 4x_n^2 = 4 x_0^2$ and $f(x_0) = 3x_0^2$. If $x_0 \in \mathbb{R}\setminus\mathbb{Q}$ you construct a rational sequence and will reach the same thing, namely: $f$ is continuous at $x_0$ if, and only if $3x_0^2 = 4x_0^2$ and then $f$ is continuous only in $x_0=0$
Let's see now that $f'(0)=0$. But $$f'(x) = lim_{x_0 \to x} \frac{f(x)-f(x_0)}{x-x_0}$$
And then
$$f'(0) = \lim_{x \to 0} \frac{f(x)}{x}$$
But $$\frac{f(x)}{x}=\left\{
\begin{array}{lll}
3x & \text{if} & x\in\mathbb Q^*\\
4x & \text{if} & x\in\mathbb I
\end{array}
\right.$$
And again using sequences if necessary, $\lim_{x \to 0} \frac{f(x)}{x} = 0$ and $f'(0) = 0$
