I solved a problem in analysis and i was thinking of generalizing this question which i couldn't succeed.

If $f:\mathbb{R} \to \mathbb{R}$ is a continuous function which satisfies $f(x)=f(2x+1)$, for all $x \in \mathbb{R}$ then prove that $f$ is constant. I was able to prove it considering $g(x)=f(x-1)$ and showing that $g(x) \to g(0)$.

Now my question is suppose $f: \mathbb{R} \to \mathbb{R}$ is a continuous function and satisfies $f(p(x))=f(x)$ for every polynomial $p(x) \in \mathbb{R}$, then what should be the condition on $p(x)$ such that $f$ remains constant.

everypolynomial $p(x) \in \mathbb{R}[x]$, then in particular it holds for $p(x) = 2x+1$ so by what you say above $f$ is constant. (Or, easier: for each $c \in \mathbb{R}$, take $p(x) = x+c$.) I think you mean to ask:for whichpolynomials $p \in \mathbb{R}[x]$ does $f = f \circ p$ imply that $f$ is constant. Is that correct? $\endgroup$ – Pete L. Clark Jul 15 '10 at 12:26