TITLE: Prove that $f(x)$ is a constant function.
QUESTION [13 upvotes]: Here is the question: 
Let f be a real valued continuous function on $[0, ∞)$. Suppose $f (x) = f (x^2)$
for all x ≥ 0, prove that f (x) is a constant function.
My attempt: Since f(x) is continuous, and $f(x^2)$ is continuous, then $f(x)-f(x^2)$ is continuous. 
I will try to prove the contrapositive. If f(x) is not a constant function, then $f(x)$ does not equal $f(x^2)$  for all x. 
Let $f(x)$ be of the form $a_n*x^n + .... +a_1*x + a_0$ 
Let $f(x^2)$ be of the form $a_n*x^(2n) + .... +a_1*x^2 + a_0$ 
In both cases, $a_j$ does not equal 0 for all j in ${1,...,n}$
So $g(x)=f(x)-f(x^2)$ doesnt equal 0 for some x. Also, $g(x)$ is continuous. 
Now I'm stuck, and your help would be appreciated. 
Also, we haven't yet covered derivatives in our class.

REPLY [14 votes]: Hint: By assumption, we have 
$$f(x)=f\left(x^2\right)=f\left(x^4\right)=\cdots=f\left(\lim_{n\to\infty}x^{2^n}\right)=f(0)$$
for any $0\leq x<1$,
and 
$$f(x)=f\left(x^\frac{1}{2}\right)=f\left(x^\frac{1}{4}\right)=\cdots=f\left(\lim_{n\to\infty}x^\frac{1}{2^n}\right)=f(1)$$
for any $x\geq 1$.