# $f$ is periodic with fundamental period $T$, $g$ is polynomial such that $f\circ g$ is periodic

If $$f$$ is a periodic function with fundamental period $$T$$ and $$g$$ is a polynomial such that $$f\circ g$$ is periodic, prove that $$g(x)=ax+b$$ where $$a,b\in\mathbb{R}$$ are some constants.

My working:

Let period of $$f\circ g$$ be $$T_1$$

$$\implies f(g(x+nT_1))=f(g(x))\forall x\in\mathbb{R},\forall n\in\mathbb{Z}$$

$$\implies g(x+nT_1)= g(x)+kT$$

for some $$k \in\mathbb{Z}\,\, \forall x\in\mathbb{R}, \forall n\in\mathbb{Z},n\ge n_0$$

When $$f$$ is assumed continuous the claim can be proven as follows:
There are two points $$x_1$$, $$x_2\in[0,T[\>$$ with $$f(x_i)=:y_i$$ and $$|y_2-y_1|=:\alpha>0$$.
Assume that $$t\mapsto g(t)$$ is a polynomial of degree $$\geq2$$, and that $$\phi:=f\circ g$$ is periodic with period $$T'>0$$. Since $$\phi$$ is continuous on $${\mathbb R}$$ it is then even uniformly continuous. It follows that there is a $$\delta>0$$ such that $$|\phi(s)-\phi(t)|<{\alpha\over2}$$ whenever $$|s-t|<\delta$$.
Now $$g$$ satisfies $$\lim_{t\to\infty}g'(t)=\infty$$ (or $$=-\infty$$). It follows that there is an interval $$J'$$ of length $$<\delta$$ far out on the $$t$$-axis such that $$g$$ maps $$J'$$ onto an interval $$J$$ of length $$>T$$ on the $$x$$-axis. The function $$\phi$$ then assumes in $$J'$$ the two values $$y_1$$, $$y_2$$ which differ by $$\alpha\$$ – a contradiction.