TITLE: Why is this function continuous, unlike the Dirichlet function?
QUESTION [6 upvotes]: My teacher showed us this function and told us it was continuous at all non-$\mathbb{Q}$ points:
$$ f(x) = \begin{cases}
  x & \text{ if } x\in\mathbb{Q} \\\\
  0 & \text{ if }x\notin\mathbb{Q} \end{cases} $$
However, Wolfram MathWorld says the Dirichlet function, which is very similar, is discontinuous at all points. Why is one continuous and the other not?

REPLY [5 votes]: Perhaps your teacher meant Thomae's function, which is continuous at all irrational numbers and discontinuous at all rational numbers.