Continuity of f(x) = 4 if rational and x^2 if irrational

Find the points of discontinuity of the following function

f(x) = 4 if x is a rational number and x^2 if x is an irrational number

I know that the function will only be continuous at +/- 2. But I need to prove it. I am not sue how to go about it. I am sure we need to use the sequential criterion for continuity to show that lim f(xn) <> f(c) when lim xn = c. We can take a sequence of irrationals that converges to a rational number and a sequence of rationals that converges to an irrational. Is this right?

• "I am sure we need to use the sequential criterion for continuity" Not at all. You can also use the $\epsilon$-$\delta$ criterion, or the topological criterion (dealing with open sets and preimages). There are many ways to the goal here. But your approach seems sound from the looks of it. – Arthur Nov 27 '18 at 20:46
• Can you tell me how to do it? Let us say there is a irrational sequence xn that converges to a rational number c. f(xn) = xn^2 so lim f(xn) = c^2. But f(c) = 4. So lim f(xn) <> f(c) as xn approaches c unless xn is very close to 2. Is this right? And similarly for a rational seqence converging to an irrational number – Aishwarya Deore Nov 27 '18 at 20:56

note: it is not necessary to use sequential approach as pointed out in the comments. Perhaps you may have been asked to use that approach so here is what you can try.

hint

Suppose we want to check continuity at $$x=c$$. Choose a sequence $$r_n$$ of rational numbers that converge to $$c$$. Then for continuity, $$f(r_n) \rightarrow f(c)$$. Similarly if we choose a sequence $$t_n$$ of irrational numbers that converge to $$c$$. Then for continuity, $$f(t_n) \rightarrow f(c)$$.

In the case of rational sequence, $$f(r_n)=4$$. So this means $$f(c)=4$$. So if $$c$$ is a rational number, then we are all set because $$f(c)=4$$ by the definition of $$f$$. But then we will also need $$t_n^2 \rightarrow 4$$. This means $$c=...$$

Now ask yourself, what if $$c$$ is irrational?

• Let us say there is a irrational sequence xn that converges to a rational number c. f(xn) = xn^2 so lim f(xn) = c^2. But f(c) = 4. So lim f(xn) <> f(c) as xn approaches c unless xn is very close to 2. Is this right? And similarly for a rational seqence converging to an irrational number – Aishwarya Deore Nov 27 '18 at 20:58
• @AishwaryaDeore I am not sure what you mean when you use the notation <> ? The idea is $x_n^2 \rightarrow c^2$ but by continuity, $x_n^2$ also should converge to $f(c)=4$. So $c^2=4$. – Anurag A Nov 27 '18 at 21:02
• <> means "does not equal". Yes that is exactly what I had in mind. And c^2 = 4 only when c = +/-2 – Aishwarya Deore Nov 27 '18 at 21:07

Let $$a$$ be a real.

$$\lim_{x\to a,x\in\Bbb Q}f(x)=4$$

$$\lim_{x\to a,x\notin \Bbb Q}f(x)=a^2$$

the function is continuous only at $$x=\pm 2$$.