I know that if $g(x)$ is periodic then $f(g(x))$ is periodic.
This is a sufficient condition but not necessary as $\sin(x)=f(g(x))$ is periodic where $g(x)=x$(non periodic) and $f(x)=\sin(x)$.
Can the above condition be made into a necessary and sufficient condition (assuming that $g(x)$ is not the identity function) or is there a better way to find the solution?
This is from a previous year college entrance exam. Any short trick rather to check for the periodicity of $f(g(x))$ when $g(x)$ is a complicated function would be helpful.
Suppose it is periodic with period $2\pi T$ for some $T>0$. This means that for all $x$, $\sin(x^2+3x+2)=\sin((x+2\pi T)^2+3(x+2\pi T)+2)$. Expanding the RHS gives $\sin(x^2+3x+2)=\sin(x^2+4\pi Tx+4\pi^2T^2+3x+6\pi T+2)$.
If $\sin(u)=\sin(v)$, then either $u=v-2\pi n$ or $u=\pi-v+2\pi n$ for some constant integer $n$. We will consider each of these cases:
Suppose $x^2+3x+2=x^2+4\pi Tx+4\pi^2T^2+3x+6\pi T+2 - 2\pi n$. Then: $$2\pi n=4\pi Tx+4\pi^2T^2+6\pi T$$ $$n=Tx+\pi T+3T$$ $n$ is a constant, so $\frac\partial{\partial x}(Tx+\pi T+3T)=0$ (as is the case for all higher derivatives). Calculating the derivative shows that $T=0$, but we previously defined that $T>0$, a contradiction.
Suppose $x^2+3x+2=\pi-x^2-4\pi Tx-4\pi^2T^2-3x-6\pi T-2 + 2\pi n$. Then: $$2x^2+6x+4-\pi+4\pi Tx+4\pi^2T^2+6\pi T = 2\pi n$$ $$n=\frac 1\pi x^2+\frac3\pi x+\frac 2\pi-\frac 12+2 Tx+2\pi T^2+3T$$ As in the previous case, $n$ is constant, so $\frac{\partial^2}{\partial x^2}(\frac 1\pi x^2+\frac3\pi x+\frac 2\pi-\frac 12+2 Tx+2\pi T^2+3T)=0$. Calculating this derivative gives the false statement $\frac 2\pi=0$, a contradiction.