Countably or Uncountably Many Discontinuities

I want to know why the following function has uncountably many discontinuities:

$$f(x)=\left\{\begin{array} & x^2 & x \not \in \mathbb{Q} \\ 0 & \text{otherwise} \end{array}\right .$$

Now I know that this is only continuous at $0$ and how to show it. You may well say 'well that is why it has uncountably many discontinuities', and you would be right so I suppose my real question is what is wrong with my intuition.

My intuition wants me to think:

It is the function $x^2$ with discontinuities at each rational. There are countably many rationals. So there are countably many discontinuities.

Whats confuses me even more is that this train of thought actually works if we replace $\mathbb{Q}$ with another countable set. For example take $\mathbb{N}$ instead of $\mathbb{Q}$ in the definition of $f$.

So I think I have finally got to my really real question.

Why can I not swap out $\mathbb{Q}$ for $\mathbb{N}$ without drastically changing the number of discontinuities. Both 'chop up' $x^2$ the same 'number' of times as $|\mathbb{N}|=|\mathbb{Q}|$ but in one case $x^2$ is chopped up uncountably more times.

• Because (as you said) $\mathbb Q$ is a countable set, I would have thought that your function has countably many discontinuities. Where did you see it had uncountably many discontinuities? – user88595 Jan 18 '14 at 18:43
• It's discontinuous at every irrational also. – David Mitra Jan 18 '14 at 18:44
• True, didn't think of it this way. – user88595 Jan 18 '14 at 18:47
• You wrote "It is the function $x^2$ with discontinuities at each rational." You could equally well have written "It is the function $0$ with discontinuities at each irrational." – Andreas Blass Jan 18 '14 at 19:01

This function is actually discontinuous everywhere except at $0$. You already know that this function is discontinuous at all non zero rationals. Now let $x$ be any irrational.
Then "near" $x$ there are many rationals, and so $f(r)=0$ which is "away" from $f(x)=x^2$. I tried to give the intuitive picture, as I am sure that you know how to fill in the gaps.
Let t be any non-rational real number and then prove that $f$ is not continuous at $t$. It means that the limit $\lim_{x\to t}f(x)$ is not equal to $f(t)$.
Assuming the contrary, we have $\lim_{x\to t}f(x)=f(t)=0$, so by definition: $$(\forall {\epsilon>0})(\exists\delta>0)|x-t|<\delta \implies |f(x)|<\epsilon$$ Choose $\epsilon=x^2/2$, and get: $$(\exists\delta>0)|x-t|<\delta \implies |f(x)|<x^2/2$$ From the definition of the function, it implies: $$(\exists\delta>0)|x-t|<\delta \implies x \notin \mathbb{Q}$$ Which mean that in the interval $(t-\delta, t+\delta)$ there is no rational number, Which is impossible. A contradiction.