# 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?

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$

• That's a very neat proof making use of sequential continuity, thanks! And I do have another question: is $f$ differentiable at x=0 then? I think yes, since $\lim\limits_{h\to 0} \frac{f(h)-f(0)}{h} =\lim\limits_{h\to 0} \frac{4h^2}{h} = 0$ if $h\in\mathbb Q$ and similarly the limit is also $0$ if $h\in\mathbb I$. – MatheMagic Oct 10 '14 at 2:52
• Yes, $f$ is continuous at $0$ because $3*0 = 4*0$ and $f$ is discontinuous everywhere else – Jonas Gomes Oct 10 '14 at 2:56
• sorry i wasn't clear in the first comment. Now it's corrected...and it's differentiable at x=0 right? – MatheMagic Oct 10 '14 at 3:04
• $f'(0) = \lim_{h \to 0} \frac{f(h)}{h} \leq \lim_{h\to 0} \frac{4h^2}{h} = 0$ – Jonas Gomes Oct 10 '14 at 3:09
• Do you understand now @llqlei? – Jonas Gomes Oct 10 '14 at 3:27