Decomposition of periodic functions

Suppose that $f$ is a periodic function defined on the integers with period $mn$, with $m$ and $n$ coprime integers. Does there necessarily exist a function $g$ with period $m$ such that $f-g$ is periodic with period $n$? In other words and slightly more generally, can any periodic function with a composite period $P$ (other than a prime power) be written as a sum of periodic functions with periods $p_1,p_2,\ldots$ with $\text{lcm}(p_1,p_2,\ldots)=P$?

It seems to me that this should be true, since for example in the first case this is analogous to $f(x)$ depending on $x \bmod m$ and $x \bmod n$ rather than $x \bmod mn$, which by the Chinese Remainder theorem are more or less equivalent, but I can't prove it.

• What set should the function be defined on? Commented May 27, 2016 at 19:25
• @flawr I was thinking the integers, but the more general question is interesting too.
– Avi
Commented May 27, 2016 at 19:26

I think I have a counter example:

Consider $f:\mathbb Z \to \mathbb Z, 6$-periodic $(6 = 2\cdot 3)$ with $f((0,1,2,3,4,5)) = (1,0,0,0,0,0)$

Claim: You cannot find a $g$ such that $f-g$ is $2$ periodic.

Assume we have $g$ $2$-periodic such that $f-g$ is $3$-periodic.

Then $1 - g(0) = (f-g)(0) = (f-g)(3) = 0-g(3) = 0-g(1)$, so $$g(1) = g(0)-1$$

Again $0-g(0) = 0-g(2) = (f-g)(2) = (f-g)(5) = 0-g(5) = 0-g(1)$ so we get $$g(0) = g(1),$$ a contradiction.

• You typed that up faster than me. Commented May 27, 2016 at 19:44

Consider $f:\mathbb Z\to \mathbb Z$ given by $$f(n)=\begin{cases} 1 & \text{when}\ n\equiv 0\pmod 6\\ 0 & \text{else} \end{cases}$$ That obviously has period $6=3\cdot 2$.

Any $g:\mathbb Z\to\mathbb Z$ with period $3$ will be given by:

$$g(n)=\begin{cases} a & \text{when}\ n\equiv 0\pmod 3\\ b & \text{when}\ n\equiv 1\pmod 3\\ c & \text{when}\ n\equiv 2\pmod 3\\ \end{cases}$$

If $f-g$ has period $2$ we would get: $$(f-g)(0)=1-a\\ =(f-g)(2)=-c\\ =(f-g)(4)=-b\\$$ and $$(f-g)(1)=-b\\ =(f-g)(3)=-a$$

But that's a contradiction. So we can't have the situation you wanted.

No, this is never true.

An $nm$-periodic function $f$ is determined by $nm$ values.

A pair $(g_1,g_2)$ consisting of an $n$-periodic function and an $m$-periodic function is determined by $n+m$ values.

Furthermore, by adding a constant function to $g_1$ while removing that constant from $g_2$, you don't change the sum $g_1+g_2$, so that's one less degree of freedom for the sum.

If $n,m>1$, then $nm > n+m-1$ so there are strictly less functions of the form $g_1+g_2$ than $nm$-periodic functions $f$.

For example, consider $n=3$ and $m=2$.

Then $nm-n-m+1 = 2$, so there are two linear relations that a $6$-periodic function $f$ has to satisfy to be a sum of a $3$ periodic function and of a $2$ periodic function : $f(1)+f(2) = f(4)+f(5) \\ f(2) + f(3) = f(5)+f(6)$