Recently I saw Thomae's Function, also called the Popcorn Function, which is continuous at the irrationals and discontinuous at the rationals.

This made me wonder: is there a function which is continuous at every transcendental number and discontinuous at every algebraic number?


1 Answer 1


Sure, the idea behind Thomae's function easily generalizes to any countable set. Let $S\subset\mathbb{R}$ be any countable set and let $i:S\to\mathbb{Z}_{>0}$ be an injection (or more generally, any finite-to-one function). Define $f:\mathbb{R}\to\mathbb{R}$ by $f(x)=0$ if $x\not\in S$ and $f(x)=1/i(x)$ if $x\in S$. Then $f$ is continuous at a point $x\in\mathbb{R}$ iff $x\not\in S$ (the proof is very similar to that for Thomae's function).

More generally, it can in fact be shown that a subset $S\subset\mathbb{R}$ is the points of discontinuity of some function $\mathbb{R}\to\mathbb{R}$ iff it is $F_\sigma$ (i.e., a countable union of closed sets).

  • 3
    $\begingroup$ +1. Just for completeness, the set of discontinuities of a function is always $F_\sigma$, so that's a complete characterization. $\endgroup$ Feb 16, 2016 at 23:34
  • $\begingroup$ Eric Wofsey Can you help Connection of complex $e^z$ and real Dirichlet please? $\endgroup$
    – BCLC
    Aug 19, 2018 at 6:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .