Recall that Thomae's function (also called Popcorn function) $f\colon\mathbb{R}\to\mathbb{R}$ is defined as $$ f(x) = \begin{cases} \frac{1}{q} & \text{ if } x=\frac{p}{q} \neq 0 \text{ is rational, } \gcd(p,q)=1 \text{ and } q> 0\\ 0 &\text{ otherwise.} \end{cases} $$ In particular, it is a standard exercise to show that $f$ is continuous at every irrational, and discontinuous at every rational.

Find a sequence of continuous functions $(f_n)_{n\in\mathbb{N}}$ that converges pointwise to $f$ on $[0,1]$.

  • $\begingroup$ I had this exercise buried in my folders, which my solution (posted answer below). Figured I may as well post it somewhere — other approaches more than welcome! $\endgroup$ – Clement C. Mar 13 '16 at 16:25

Detailed sketch of the proof:

Since $\mathbb{Q}\cap[0,1]$ is countable, we can write it $\mathbb{Q}\cap[0,1]=(x_n)_{n\in\mathbb{N}}$, where each $x_n$ has a canonical form $x_n=\frac{p_n}{q_n}$, $p_n\wedge q_n=1$. We then define $f_n$ by considering only the $n+1$ first terms of the sequence $(x_k)$, and putting the "right" value on them (i.e, $f_n(x_k)=\frac{1}{q_n}$, $0\leq k\leq n$).

To make $f_n$ continuous, we then make it "affine by parts": each $x_k$ is surrounded by two elements of $\{0,x_1,\dots,x_n,1\}$ (finite number of elements), we can pick the max $\underline{x}_k$ of those strictly less, the min $\bar{x}_k$ of those strictly greater, and then go from 0 to $\frac{1}{q_n}$ on the interval $\left[x_k-\frac{x_k-\underline{x}_k}{2^n}, x_k\right]$, then from $\frac{1}{q_n}$ to 0 on the interval $\left[x_k, x_k+\frac{\bar{x}_k-x_k}{2^n}\right]$ (cf. the very bad picture below).


Since each rational $q$ is one of the $x_n$ and thus will, for $k\geq n$, be be "considered" by $f_k$ and its image put to the desired value, $f_k(q)\to f(q)$ for all rationals in $[0,1]$. The problem is for the irrationals. Pick $r\in\mathbb{R}\setminus\mathbb{Q}$ arbitrary; in order to prove that $f_k(r)\to0$, we can, by contradiction, suppose it doesn't.\ It means that there is an $\varepsilon>0$ such that, for an infinity of $k$, $f_k(r)>\varepsilon$. Pick the subsequence of such $k$: it defines a sequence $(f_{\varphi(k)}(r))_k$ of values always strictly greater that $\varepsilon$.

But that means that there is a corresponding sequence of rationals always very close to $r$ (one for each $f_{\varphi(k)}$, otherwise $f_{\varphi(k)}(r)=0$). By very close, it actually means (closer than $\frac{\bar{q}-q}{2^n}\leq 2^{-\varphi(k)}$ for some rational $x$. In other terms, we have a sequence of rationals converging (since $2^{-\varphi(k)}\to0$, because $\varphi(k)\to\infty$ (it is a subsequence, so $\varphi(k)\geq k$ for every $k$).

Then, we can use the fact that if a sequence of rationals $\frac{p_n}{q_n}\to r$ irrational, necessarily $p_n\to \infty$, $q_n\to \infty$ (it is rather simple to prove*). And thus in particular $\frac{1}{q_n}\to 0$. Since $f_{\varphi(k)}(r)$ is always less than the "peak", which is the $\frac{1}{q}$ of the "close rational associated with $f_{\varphi(k)}$" mentioned earlier, $f_{\varphi(k)}(r)\to0$ when $k\to\infty$. Which is a contradiction, because it is supposed not to go under $\varepsilon>0$.

Hence, $f_k(r)\to 0$, and $f_n$ converges pointwise to $f$.

${}$* for example, by contradiction, supposing some subsequence of $p_n$ (or $q_n$) is bounded, applying Bolzano—Weierstrass' theorem to it to have a converging subsequence, and then considering the corresponding subsequence of $q_n$ which must be itself, then, bounded because of the convergence to $r$, and again apply Bolzano—Weiestrass, and find finally a sub-sub-sequence of $p_n$ and $q_n$ such that both converge to some integers $p$ and $q$, which in turn implies that $r=\frac{p}{q}\in\mathbb{Q}$, which can be seen as a problem for an irrational.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.