# Condition for $f+g$ to be periodic given that $f,g$ are periodic functions.

Is the following statement true?

If $f,g$ are two periodic functions with period length $P_1,P_2$, respectively. Then $f+g$ is a periodic function with length of period $T$ if and only if $T/P_1,T/P_2$ are integers.

One example supports this statement: $f(x)=\sin 2x, g(x)=\cos 3x$ and $f+g$ is periodic with period length $2\pi= 2 \cdot \pi= 3 \cdot 2\pi/3$ where $\pi,2\pi/3$ are length of periods of $f,g$, respectively.

• yes, with the length of the period $T = lcm(P_1,P_2)$.
– user394255
Commented Dec 26, 2016 at 8:52
• In fact, it is possible for $f+g$ to be $T$-periodic even if $T/P_1$ and $T/P_2$ are irrational. See math.stackexchange.com/questions/1079/…. Commented Dec 26, 2016 at 8:55

$(f+g)(x+T) = f(x+T)+g(x+T) = f(x+nP_1)+g(x+mP_2) = f(x)+g(x)=(f+g)(x)$
EDIT: The converse does not hold. For example, note that a constant function $f$ has period $x$ for any $x>0$. So, if we define $g = f = 0$, $f$ has period $1$, $g$ has period $1$, and $f+g$ has period $1/2$, even though $(1/2)/1$ is not an integer.
Even if you define period as "smallest possible period" (when possible), it still doesn't work. For example, define the following two functions on $(0,2]$ and extend them so that they have period $2$: $$f(0< x \leq 1)=0, f(1<x\leq 2)=1$$ $$g(0<x\leq 1/2)=0, g(1/2<x\leq 1) = 1, g(1<x\leq 3/2)=-1, g(3/2<x\leq 2) = 0$$ $f$ and $g$ have period $2$, but $f+g$ has period $1$.