The Paradox of Periodicity (of Functions)

You know periodic functions right? Functions that after a certain place start repeating, for example sin(x):

More formally, a function f is called periodic is for some constant p>0, f(x+p)=f(x). In other words, shifting by p does not affect f(x). The constant p will be called the period of the function (sometimes we say f is p-periodic)

So just another property of functions, like continuity, being bound (the absolute value of f(x) is smaller than some constant), being even (symmetric around the y axis) etc. All of these properties behave nicely, so for example they remain when multiplying by a constant, shifting it a bit, and summing them.

Wait a minute, about that last one, are we sure a sum of periodic functions is periodic?

Well suppose f and g are p-periodic. Then f(x+p)+g(x+p)=f(x)+g(x). So indeed their sum is periodic. But what if their periods are different? Say f is p-periodic and g is q-periodic. Is it really true that f+g is periodic as well? And if it is, what is its period?

Maybe we can do something like this, after a certain number of periods for f and for g (a different number for each), perhaps the periods coincide like this:

Then, after r, f and g both start repeating at the same time, and such f(x+r)=f(x) and g(x+r)=g(x). So then we can say f and g are both r-periodic and thus their sum is too!

Don’t celebrate just yet though, does that value r where the periods coincide really exist? Let’s take a deeper look then. If that r exists, let’s denote by m the number of periods f needs to reach it, and n the number of periods g needs:

So those values m,n must have that mp=r, nq=r. Additionally, both n and m are positive whole numbers, we aren’t looking at negative periods. Rewriting this differently, we get p/q=n/m

Ah-ha, but n/m is a rational number, as a quintet of whole numbers, so p/q must be as well. Thing is, p/q is not necessarily rational. For example, take p=1, and q= √ 2. Then p/q=1/ √ 2 is not rational. So our argument sadly fails in that case

So back to square one it is. We assumed at the start we were going to prove the sum of any two periodic functions is periodic, but maybe it is not true after all? Let’s try to find a counterexample instead then

So what type of f and g should we choose? Well we saw that if the quintet of their periods is rational, their sum must be periodic as well. So let’s choose two periods whose quintet is irrational, for example p=1 and q= √ 2 as before. We should also choose our functions to be as simple as possible, for simpler analysis. For example, an indicator for a set, that is equal to one for values in some set, and 0 otherwise.

So let’s define these two functions:

That is, f(x) is 1 only on the integers and 0 elsewhere (so the indicator of the integers). And g(x) is 1 only on integer multiples of √ 2 and 0 elsewhere (so the indicator of integer multiples of √ 2). It’s not hard to see that f has period 1, as x+1 is an integer if and only if x is an integer. In the same way, we see that g has period √ 2

But what about f(x)+g(x)? Well, if x is neither an integer or an integer multiple of √ 2, f(x) and g(x) are both 0, and so is their sum, If x is exclusively either an integer or an integer multiple of √ 2 exactly one of f(x), g(x) is equal to 1 and the other 0, so f(x)+g(x)=1. And if x is both an integer and an integer multiple of √ 2 both f(x) and g(x) are 1 so f(x)+g(x)=2.

Thing is, what numbers are both integers and integer multiples of √ 2? For start, clearly 0 is one. Are there any others? No. else we would have for some non-zero integers m,n that m=n√ 2, hence √ 2=m/n. Impossible, as √ 2 is irrational. Therefore, f(x)+g(x) yields 2 only at x=0

So, if f(x)+g(x) had period p>0, that is f(x+p)+g(x+p)=f(x)+g(x) for all x, in particular for x=0 we get f(p)+g(p)=f(0)+g(0)=2. But we saw f(x)+g(x) can have value 2 only at x=0. Contradiction, hence f+g is not periodic, and we’ve shown a sum of two periodic functions is not necessarily periodic as well

A Linear Algebra Perspective

The idea that a sum of periodic functions isn’t always periodic is easier to grasp when we add more dimensions to the mix. For ease of demonstration we’ll look at the 2D case

Let’s define when a function f(x), where x is in $\mathbb{R}^2$, is periodic. Note that f can be a function to any set we want, for now we suppose f(x) is from $\mathbb{R}^2$ to itself. Since we are now in the 2D plane, we can define periodicity in any direction we want. So for a nonzero vector v, we say f is v-periodic if f(x+v)=f(x) for all x in $\mathbb{R}^2$

Now, write x=(x1,x2). If we add 1 to the second coordinate, that is add (0,1) to x, that clearly doesn’t change the value of the first coordinate. Hence, the function f(x)=(x1,0) is (0,1)-periodic. Similarly, adding 1 to the second coordinate doesn’t change the second one, so we get that g(x)=(0,x2) is (1,0)-periodic.

But what is the sum of f and g? Well it is just (x1,0)+(0,x2)=(x1,x2)=x. Not only is the sum of those two periodic functions not periodic, it also is one of the simplest ones, mapping x to itself. We would expect the sum of periodic function to have some resemblance of periodicity, but that can’t really be said here.

Of course, we needed two dimensions to write the identity function I(x)=x as a sum of two periodic functions. In one dimension it’s probably impossible, there is just no way a function as aperiodic as x is the sum of two periodic ones. Especially in one dimension, periodicity is pretty strict there.

Well thing is, we can do that. Even though we have only one dimension, we can write the identity I(x)=x as a sum of two periodic functions.

How do we do that? Well, our proof in two dimensions in essence relied on us having a basis with two or more elements for the space, such that changing one coordinate won’t affect the other one. Problem is, just in $\mathbb{R}$. we only have one dimension, if we look at it as a field over $\mathbb{R}$. itself. But note that we can look at it as a vector space over a different field, the field of rationals $\mathbb{Q}$.!

So let’s take a basis for $\mathbb{R}$. over the rationals $\mathbb{Q}$. Note that this basis must have more than two elements (in fact infinitely many) as $\mathbb{R}$ has greater cardinality than $\mathbb{Q}$.

$B={(b_i)}_{i\in I}\subset\mathbb{R}$
Each $x\in \mathbb{R}$ can be written uniquely as:
$\displaystyle{x=\sum_{i\in I} \alpha_i (x)b_i,\alpha_i(x)\in \mathbb{Q}}$

This is sometimes called a Hamel Basis for $\mathbb{R}$.

Another important thing to note before we continue. The representation of x as a linear combination of basis elements might look like an infinite sum but is actually finite. The reason is that when we look at an infinite basis for a general vector space, we look only at finite linear combinations as to not mess with convergence of series (it is already messy as is…). So all but finitely many of the αi(x) will be zero. This is unlike, say, Hilbert spaces, which allow for infinite linear combinations.

Alright, now let’s define our two functions. Suppose 0 and 1 are indexes in I, define the first function to be the “0-th coordinate)” as follows:

$f(x)=\alpha_0 b_0$

Note that indeed changing another coordinate (say the “1st”) will not change the others. In particular, that gives us that our function f is b1 periodic:

$\displaystyle{x+b_1=[\alpha_1 (x)+1]b_1 +\sum_{i\in I,i\neq 1}\alpha_i (x)b_i}$

Implying that:

$\alpha_0 (x+b_1)=\alpha_0 (x), f(x+b_1)=f(x)$

Now we define g such that f(x)+g(x)=x. In other words, g(x)=x-f(x). We can then rewrite g(x) using the basis elements as such:

$\displaystyle{g(x)=x-f(x)=\sum_{i\in I,i\neq 0} \alpha_i (x)b_i}$

This representation of g does not depend on the “0th” coordinate of g. So similarly as before, we conclude that g is b0 periodic, e.g $g(x+b_0)=g(x)$

And thus, we found two real, periodic functions f and g, such that f(x)+g(x)=x. Q.E.D

But what are these functions

If this solution leaves you a little unsatisfied, it should. We did indeed prove that there are two real periodic functions whose sum is the identity, but we have no ‘nice’ closed form to write them in. Yes, we can write them using the basis for the reals over the rationals, but what is this basis, and how do we find the coordinates in that basis for some real x?

Unfortunately, there is no nicer, constructive way to write our f and g. The reason is that in our proof, we relied on the fact that for any vector space, there is a basis. While it seems trivial at first, for infinite dimensional vector spaces such as over Q as we used, it’s a bit less clear. Indeed, the proof that any vector space has a basis relies on what is called the axiom of choice. Without going into detail, the axiom of choice is a bit controversial axiom from set theory. The main reason for the controversy is that while the axiom can prove certain objects exist, it often does not give a nice closed form for them. As in our case, we proved that a basis for the reals over the rationals exists, but we didn’t write what exactly that basis is.

So in conclusion, if you happen to show your alien friend this, make sure the axiom of choice is indeed legal in their planet