The question below is an attempt to generalize this idea.
Given a function $f(x)$ there exist $T \ne 0$ and some polynomial $Q_n(x)$ of $n$-th power such that $\forall x \in D(f)$: $$ x+T \in D(f) \\ x-T \in D(f) $$
And $f(x+T) = f(x) + Q_n(x)$.
Prove that: $$ f(x) = \varphi (x) + P_{n+1}(x) $$ Where $\varphi (x)$ is periodic with period $T$ and $P_{n+1}(x)$ is a polynomial of $(n+1)$-th power.
As shown in the linked question we may use the fact that $\varphi (x)$ is periodic. So it has been shown that:
$$ \varphi (x) = \varphi (x+T) = f(x) - {a\over T}x $$ in case $f(x+T) = f(x) + a$.
Using the same idea I have shown that:
$$ f(x) = \varphi (x) + {a\over {2T}}\left(x^2 - Tx\right) $$
in case $f(x+T) = f(x) + ax$.
And now i'm struggling to show that this idea may be generalized. I've tried to use the same technique suggested in the linked question.
I started with presenting $Q_n(x)$ and $P_{n+1}(x)$ in the form of a sum with some unknown coefficients, but that got ugly very quickly, since $(x+T)^k$ appears in the sum when applying $\varphi (x)$ to $x+T$.
How can i prove the above?
upd 1:
Here are some further thoughts. So i want $\varphi (x) = \varphi (x+T)$. Let's try to find coefficients of $Q_0(x)$ and $P_1(x)$ to see whether we could deduce the polynomials ($a_k$ is coefficient of $Q_n(x)$ and $b_k$ is for $P_n(x)$):
$$ f(x+T) = f(x) + a_1 \\ f(x) = \varphi (x) + b_1x + b_2 \\ \varphi (x) = f(x) - b_1x - b_2 \\ \varphi (x + T) = f(x+T) - b_1(x+T) - b_2 \\ \varphi (x+T) = \varphi (x) \\ f(x) + a_1 - b_1(x+T) - b_2 = f(x) - b_1x - b_2 \\ a_1 - b_1x -b_1T-b_2 = -b_1x -b_2 $$
This gives $b_2 = 0$ and $b_1 = {a_1\over T}$. So now if $a_1 = a$ we get $f(x+T) = f(x) + a$ and $f(x) = \varphi(x) + {a\over T}x$. The exact situation as in the linked post.
For $Q_1(x)$ and $P_2(x)$ i get that:
$$ 2b_1Tx + b_1T^2 + b_2T = a_1x+a_2 $$
So $b_1 = {a\over 2T}$ and $b_2$ may be obtained only by the assumption that $a_2 = 0$. If $a_2 = 0$ then $b_2 = {a\over 2}$ and we get the case for $Q_1$ and $P_2$. But the assumption is taken from nowhere.
upd 2:
I've just tried to find $Q_2(x)$ and $P_3(x)$ and finally arrived at a system of equations for the coefficients:
$$ \cases { b_1 = {a_1 \over 3T} \\ b_2 = {{a_2 - 3b_1T^2}\over {2T}} \\ b_3 = {{a_3 - b_1T^3 - b_2T^2} \over {T}} } $$
In this case I've tried to assume that $a_2 = 0$ and $a_3 = 0$ and therefore the following is true:
$$ f(x) = \varphi (x) + \frac{a}{3T} (x^3 - \frac{3x^2T}{2} + 2T^2x) $$
in case $f(x+T) = f(x) + ax^2$. It seems like $Q_n(x)$ is in the form of $ax^n$. But $P_n(x)$ has somewhat more complicated form.