## Folded letters and uniformly bounded function sequences

We know that every bounded sequence of real numbers has a convergent subsequence. For a sequence of functions, say ${f_n\colon [0, 1]\to \mathbb R}$, the notion of boundedness can be stated as: there exists a constant ${M}$ such that ${|f_n(x)|\le M}$ for every ${n}$ and for all ${x\in [0, 1]}$. Such a sequence is called uniformly bounded.

Once we fix some point ${x\in [0, 1]}$, the boundedness assumption provides a subsequence ${\{f_{n_k}\}}$ which converges at that point. But since different points may require different subsequences, it is not obvious whether we can pick a subsequence ${\{f_{n_k}\}}$ which converges for all ${x\in [0, 1]}$. (Such a subsequence is called pointwise convergent.)

It is easy to give an example of a uniformly bounded sequence with no uniformly convergent subsequence (uniform convergence ${f_n\to f}$ requires ${\sup |f_n-f|\to 0}$, which is stronger than ${f_n(x) \to f(x)}$ for every ${x}$). Indeed, ${f_n(x) = x^n}$ does the job. This sequence is uniformly bounded (by ${M=1}$) and converges pointwise to a discontinuous function ${g}$ such that ${g(1)=1 }$ and ${g(x)=0}$ elsewhere. Any subsequence ${f_{n_k}}$ has the same pointwise limit ${g}$ and since ${g}$ is not continuous, the convergence cannot be uniform.

But what would be an example of a uniformly bounded sequence of continuous functions with no pointwise convergent subsequence? In Principles of Mathematical Analysis Rudin gives ${f_n(x) = \sin nx}$ as such an example but then uses the Lebesgue Dominated Convergence Theorem to prove the non-existence of pointwise convergent subsequences. I do not want to use the DCT.

The simplest example I could think of is based on the letter-folding function ${F\colon [0, 1]\to [0, 1]}$ defined by

${\displaystyle F(x) = \begin{cases} 3x, & x\in [0, 1/3] \\ 2 - 3x, & x\in [1/3, 2/3] \\ 3x - 2, & x \in [2/3, 1] \end{cases} }$

or by a magic one-line formula if you prefer: ${F(x) = 3x - 1 - |3x-1| + |3x - 2|}$.

Let ${\{f_n\}}$ be the sequence of the iterates of ${L}$, that is ${f_0(x) = x}$ and ${f_{n+1}(x) = F(f_n(x))}$. This means ${f_1 = F}$, ${f_2 = F\circ F}$, ${f_3 = F\circ F \circ F}$, and so on.

By construction, the sequence ${\{f_n\}}$ is uniformly bounded (${M=1}$). It is somewhat similar to the example ${\{\sin nx\}}$ in that we have increasingly rapid oscillations. But the proof that ${\{f_n\}}$ has no pointwise convergent subsequence is elementary. It is based on the following observations.

(A) Suppose that ${\{a_j\}}$ is a sequence such that ${a_j\in \{0, 2\}}$ for each ${j \in \mathbb N}$. Then the number ${\displaystyle x = \sum_{j=1}^\infty \frac{a_j}{3^j}}$ satisfies ${x\in [0, 1/3]}$ if ${a_1=0}$ and ${x\in [2/3, 1]}$ if ${a_1 = 2}$.

The proof of (A) amounts to summing a geometric series. Incidentally, observe that ${a_1, a_2, \dots}$ are the digits of ${x}$ in base ${3}$.

(B) For ${x}$ as above we have ${\displaystyle F(x) = \sum_{j=1}^\infty \frac{a_{j+1}}{3^j}}$. In other words, ${F}$ shifts the ternary digits of ${x}$ to the left. As a consequence, ${f_n}$ shifts them to the left by ${n}$ places.

(C) Given any subsequence ${\{f_{n_k}\}}$, let ${a_j = 2}$ if ${j = n_{2k} + 1}$ for some ${k}$, and ${a_j=0}$ otherwise. By part (B), ${\displaystyle f_{n_k}(x) = \sum_{j=1}^\infty \frac{a_{j + n_k}}{3^j} }$ which means the first ternary digit of ${f_{n_k}(x)}$ is ${a_{n_k + 1}}$. By construction, this digit is ${2}$ when ${k}$ is even, and ${0}$ when ${k}$ is odd. By part (A) we have ${f_{n_k}(x) \ge 2/3}$ when ${k}$ is even, and ${f_{n_k}(x) \le 1/3}$ when ${k}$ is odd. Thus, ${\{f_{n_k}(x)\}}$ does not converge. This completes the proof.

## Remarks

The set of all points ${x}$ of the form considered in (A), (B), (C), i.e., those with all ternary digits ${0}$ or ${2}$, is precisely the standard Cantor set ${C}$.

The function ${F}$ magnifies each half of ${C}$ by the factor of ${3}$, and maps it onto ${C}$.

The important part of the formula for ${F}$ is that ${F(x) = 3x\bmod 1}$ when ${x\in C}$. The rest of it could be some other continuous extension to ${[0, 1]}$.

A similar example could be based on the tent map ${T(x) = 1 - |2x-1|}$, whose graph is shown below.

However, in case of the tent map it is more convenient to use the sequence of even iterates: ${T\circ T}$, ${T\circ T\circ T\circ T}$, and so on.

Indeed, since ${T(T(x)) = 4x \bmod 1}$ when ${x\in [0, 1/4]\cup [1/2, 3/4]}$, one can simply replace base ${3}$ with base ${4}$ in all of the above computations and arrive at the same conclusion, except the orbit of ${x}$ will now be jumping between the intervals ${[0, 1/4]}$ and ${[1/2, 3/4]}$.

The tent map is conjugate to the logistic map ${L(x) = 4x(1-x)}$, shown below. This conjugacy is ${L\circ \varphi = \varphi\circ T}$ where ${\varphi(x) = (1 - \cos \pi x)/2}$.

The conjugacy shows that the ${n}$th iterate ${L^{n}}$ is ${\varphi\circ T^n \circ \varphi^{-1}}$. Therefore, the sequence of the even iterates of ${L}$ has no pointwise convergent subsequence. This provides an example with smooth functions, even polynomials.

One could use the sequence of all iterates (not just the even ones) in the constructions based on ${T}$ and ${L}$, it just takes a bit of extra work that I prefer to avoid.

## The closure of periodic functions and sums of waves with incommensurable periods

Consider the space ${C(\mathbb R)}$ of all bounded continuous functions ${f\colon \mathbb R\to\mathbb R}$, with the uniform norm ${\|f\| = \sup |f|}$. Let ${P}$ be its subset that consists of all periodic continuous functions: recall that ${f}$ is periodic if there exists ${T>0}$ such that ${f(x+T)=f(x)}$ for all ${x\in \mathbb R}$.

The set ${P}$ is not closed in the topology of ${C(\mathbb R)}$. Indeed, let ${d(x) = \mathrm{dist}\,(x, \mathbb Z)}$ be the distance from ${x}$ to nearest integer. The function ${d}$ is periodic with ${T=1}$. Therefore, each sum of the form ${\displaystyle \sum_{k=0}^n 2^{-k} d(2^{-k} x)}$ is periodic with ${T=2^n}$. Hence the sum of the infinite series ${\displaystyle f(x) = \sum_{k=0}^\infty 2^{-k} d(2^{-k} x) }$ is a uniform limit of periodic functions. Yet, ${f}$ is not periodic, because ${f(0)=0}$ and ${f(x)>0 }$ for ${x\ne 0}$ (for every ${x\ne 0}$ there exists ${k}$ such that ${2^{-k}x}$ is not an integer).

The above example (which was suggested to me by Yantao Wu) is somewhat similar to the Takagi function, which differs from it by the minus sign in the exponent: ${\displaystyle T(x) = \sum_{k=0}^\infty 2^{-k} d(2^{k} x) }$. Of course, the Takagi function is periodic with period ${1}$.

Do we really need an infinite series to get such an example? In other words, does the set ${\overline{P}\setminus P}$ contain an elementary function?

A natural candidate is the sum of trigonometric waves with incommensurable periods (that is, the ratio of periods must be irrational). For example, consider the function ${g(x) = \cos (x) + \cos (\sqrt{2}x)}$ whose graph is shown below.

Since ${g(0)=2}$ and ${g(x) < 2}$ for all ${x\ne 0}$, the function ${g}$ is not periodic. Its graph looks vaguely similar to the graph of ${f}$. Is ${g}$ a uniform limit of periodic functions?

Suppose ${h\colon \mathbb R\to\mathbb R}$ is a ${T}$-periodic function such that ${\|h-g\|<\epsilon}$. Then ${h(0) > 2-\epsilon}$, hence ${h(nT)>2-\epsilon}$ for all ${n\in \mathbb Z}$, hence ${g(nT) > 2- 2\epsilon }$. By the definition of ${g}$ this implies ${\cos (nT) > 1-2\epsilon}$ and ${\cos (\sqrt{2}nT) > 1-2\epsilon}$ for all ${n\in \mathbb Z}$. The following lemma shows a contradiction between these properties.

Lemma. If a real number ${t}$ satisfies ${\cos nt > -1/2}$ for all ${n\in \mathbb Z}$, then ${t}$ is an integer multiple of ${2\pi}$.

Proof. Suppose ${t}$ is not an integer multiple of ${2\pi}$. We can assume ${0 < t < \pi}$ without loss of generality, because ${t}$ can be replaced by ${t - 2\pi k}$ to get it in the interval ${(0, 2\pi)}$ and then by ${2\pi - t}$ to get it in ${(0, \pi)}$. Since ${\cos t > -1/2}$, we have ${t\in (0, 2\pi/3)}$. Let ${k}$ be the smallest positive integer such that ${2^k t \ge 2\pi/3}$. The minimality of ${k}$ implies ${2^{k-1} t < 2\pi/3}$, hence ${2^k t \in [2\pi/3, 4\pi/3)}$. But then ${\cos (2^k t) \le -1/2}$, a contradiction. ${\quad \Box}$

The constant ${-1/2}$ in the lemma is best possible, since ${\cos (2n\pi/3)\ge -1/2}$ for all ${n\in \mathbb Z}$.

Returning to the paragraph before the lemma, choose ${\epsilon=3/4}$ so that ${1-2\epsilon = -1/2}$. The lemma says that both ${T}$ and ${\sqrt{2} T}$ must be integer multiples of ${2\pi}$, which is impossible since they are incommensurable. This contradiction shows that ${\|g-h\|\ge 3/4}$ for any periodic function ${h}$, hence ${g}$ is not a uniform limit of periodic functions.

The above result can be stated as ${\mathrm{dist}(g, P) \ge 3/4}$. I guess ${\mathrm{dist}(g, P)}$ is actually ${1}$. It cannot be greater than ${1}$ since ${|g(x)-\cos x|\le 1}$ for all ${x}$. (Update: Yantao pointed out that the density of irrational rotations implies the distance is indeed equal to 1.)

Note: the set ${\overline{P}}$ is a proper subset of the set of (Bohr / Bochner / uniform) almost periodic functions (as Yemon Choi pointed out in a comment). The latter is a linear space while ${\overline{P}}$ is not. I was confused by the sentence “Bohr defined the uniformly almost-periodic functions as the closure of the trigonometric polynomials with respect to the uniform norm” on Wikipedia. To me, a trigonometric polynomial is a periodic function of particular kind. What Bohr called Exponentialpolynom is a finite sum of the form ${\sum a_n e^{\lambda_n x}}$ where ${\lambda_n}$ can be any real numbers. To summarize: the set considered above is the closure of ${P}$ while the set of almost periodic functions is the closed linear span of ${P}$. The function ${g(x)=\cos (x) + \cos(\sqrt{2} x)}$ is an example of the latter, not of the former.