# 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?

• To be clear: are you not asking why the answer to the question is no? Because that seems to be interesting... Feb 19, 2014 at 5:47
• Most of the engineering works involves design and simulation using computers. And of course computer does the numeric approximation. Do you have any idea about practical case, where the above assumption may create trouble Feb 19, 2014 at 5:48
• Even if everything is smooth and rational, the sum of periodic functions may have an extremely long period. Extremely long times don't exist from an engineer's point of view either ;) Feb 19, 2014 at 7:09
• Old joke: as an engineer, you can suppose that the cow is spherical. Feb 20, 2014 at 10:08
• @Martín-BlasPérezPinilla That's funny because one time when I asked my physics teacher where am I ever going to find a spherical cow, he said "That's what engineers are for." Feb 21, 2014 at 10:33

## 4 Answers

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

• The "Every polynomial of degree $n$ is the sum of $n+1$ periodic functions" statement in that link is interesting. Though the final statement, that $e^x$ being a "single" periodic function were absurd, missed the purpose of complex numbers... Aug 15, 2014 at 11:31
• The linked article (which I wrote) literally starts with the words "A real function" and that is the context for the entire article. As a real function e^x is not periodic. Jul 29, 2018 at 23:58
• By the way, this was one of the problems given to students at Romanian TST in 2007.
– byk7
Jan 12, 2020 at 10:51

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

• The proof for the necessity is flawed. First it assumes that $c$ is the smallest period of $f+g$ (I suppose you meant, you wrote $g$) despite there is nothing guaranteeing that such a period exist. Then you assume that $\gamma$ is continuous which is not given (you also assume that $f$ is continuous which also is not given). Jul 18, 2017 at 7:49

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?

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.