# Function that is continuous only on the transcendental numbers

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

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).

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