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

Uniform limit of periodic functions

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

Takagi function

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.

Looks somewhat periodic, does not it?

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.

2 thoughts on “The closure of periodic functions and sums of waves with incommensurable periods”

  1. I had thought (without checking the original literature myself) that Bohr’s original definition of “almost periodic function” included finite sums of cosines with periods that might be Q-independent. Certainly Bochner’s definition of almost periodicity, which is claimed by all sources that I’ve seen to be equivalent to Bohr’s definition, has the property that the sum of two almost periodic functions is itself almost periodic.

    That is, I think the usual definition of AP(R) would give the closed linear span of the set you denote by P, rather than the closure of the set itself. Of course the question raised in this post is still interesting, regardless of the terminology

    1. Thanks for the correction, I read the definition too hastily and decided it had to be this set. Fixed to avoid perpetuating this confusion.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.