Sum of two periodic functions is periodic?

I have following paragraph taken from the Stanford's study material.

Question: Is the sum of two periodic functions periodic?
Answer: I guess the answer is no if you are Mathematician, yes if you are an Engineer i.e. no if you believe in irrational numbers and leave it at that, and yes if you compute things and work with approximation.

This sounds something interesting to me. As an engineer, can I always assume that sum of periodic functions is always periodic?


Solution 1:

It's more because for engineers, periods tends to have common divisors and hence the sum of two functions of periods $n x$ and $m x$ with $n,m∈ℕ$ is then $\mathrm{lcm}(n,m)x$.

For instance, in maths the usual counterexample is $\sin(x)$ and $\sin(x\sqrt 2)$ and that to get yourself into that situation in real life is difficult.

Another example, that happen to be highly strange and will never happen in practise: there exist two periodic functions $f$ and $g$ such that their sum is the identity function on $\mathbb R$ (yes, $∀x∈ℝ~~f(x)+g(x)=x$). But this time, even in math it is difficult to find yourself into this situation. (See this for how to do it, but it is a spoiler, it is really fun to look into it yourself.)

Solution 2:

Let $f$ and $g$ two periodic function two non-constant periodic continuous functions of $\mathbb{R}\rightarrow\mathbb{R}$. Note $a>0$ the smallest period of f and $b$ the smallest period of g.

Find a necessary and sufficient condition for f + g is periodic.

Notice that If $b$ is a multiple of $a$, then $f+g$ is clearly periodic.

Plus, she $\frac{a}b \in \mathbb{Q}$, where $\frac{a}b=\frac{p}q$ then $aq=bp$ is clearly a period of $\quad f+g$

This condition is actually necessary.

Proof. By contradiction, assume $\frac{a}b \notin \mathbb{Q}$ and $f+g$ periodic and $c$ the smallest period of g, $\forall x\in \mathbb{R}$ we have, $$ f(x+c)+g(x+c)=f(x)+g(x), $$ What is better rewritten in the invariant form : $$ f(x+c)-f(x)=g(x)-g(x+c) $$ Denote $\gamma(x)$ the common value, then for $k,l$ integer we find $$ \gamma(x + ka + lb) = f (x + ka + lb + c) - f (x + ka + lb) $$ $$ = f (x + lb + c) - f (x + lb) $$ $$ = \gamma(x + lb) = g (x + lb + c) -g (x + lb) = g (x + c) -g (x) = \gamma(x) $$ Therefore, all real of $a\mathbb{Z}+b\mathbb{Z}$ is a period of $\gamma$ But $a\mathbb{Z}+b\mathbb{Z}$ is dense in $\mathbb{R}$ because $\frac{a}b \notin \mathbb{Q}$.

Therefore $\gamma$ is $\epsilon$-periodic fo all $\epsilon$.

As $\gamma$ is continuous, he is necessarily constant : $$ \gamma=\gamma_0 $$ Furthermore, $$ f(Id+c) = f + \gamma_0, $$ Then for all real x we have, $$ f(x+nc)=f(x)+n\gamma_0 $$ $$ \Longrightarrow \gamma_0=0 $$ because $f$ is continuous and periodic thus $f$ is bounded.

Therefore, $c$ is a common period of $f$ and $g$.

Then $c$ is in $a\mathbb{N^*}\bigcap b\mathbb{N^*}$, but he is empty because $\frac{a}b \notin \mathbb{Q}$. QED

Solution 3:

Your question is interesting but a little vague. (It's also not completely clear that it's a math question, but I think there will turn out to be mathematical content.)

Let me just push the discussion in what I think is the right direction. Let $\frac{a}{b}$ be any nonzero rational number. Then

$f_{a/b}(x) = \sin x + \sin \frac{a}{b} x$ is periodic -- e.g. with period $2 \pi b$

whereas

$g(x) = \sin x + \sin \pi x$ is not periodic. (This is not completely obvious! See here for a nice proof.)

However there are rational numbers $\frac{a}{b}$ which are arbitrarily close to $\pi$, so the non-periodic function $g$ is the limit of periodic functions.

I think the crux of the matter is: everyone would have to agree (right?) that each of the functions $f_{a/b}$ occurs naturally in engineering, e.g. in the most basic analysis of harmonics. From a mathematical perspective the function $g$ looks equally "plausible" (and, mathematically speaking, it is a pointwise limit of "engineering-natural functions"). But does that imply that $g$ is an "engineering-natural function"? Perhaps not...

Or, to get a bit more "meta":

Is the notion of "engineering-natural functions" mathematically coherent? Is it natural or useful in engineering?

Solution 4:

I think you already know this, right?

If $f$ and $g$ are two periodic functions with periods $T_{f}$ and $T_{g}$ respectively, then if the ratio $T_{f}/T_{g}$ is rational, then for any function $z(u,v)$, the function $h(t)=z(f(t),g(t))$ is also periodic.

And you also know that this fails when the ratio $T_{f}/T_{g}$ is not rational.

But why?

The way to think about this is to consider the period of the function $h(t)$ defined above. Suppose that the ratio $T_{f}/T_{g}=m/n$ where $m$ and $n$ are relatively prime (assume WLOG that $T_{g}\leq T_{f}$, so that $m\leq n$). Then, in a meaningful sense, $n$ gives an indication of how closely related the two periods are: the larger $n$, the less overlap they have.

In general, we know that the period of $h$ will be the lowest common multiple of $T_{f}$ and $T_{g}$, which will be $nT_{f}$. Now, what happens as $n$ tends to infinity? The period of $h$ also tends to infinity! When $T_{f}$ and $T_{g}$ are "relatively prime", the period of $h$ becomes infinite, meaning that $h$ is no longer periodic.

In an engineering context, this isn't really relevant, since everything tends to be done discretely, and so $n$ will be bounded. But in the pure setting, there is nothing stopping the period of $h$ being infinite.