TITLE: $g(x)$ is continuous on $\mathbb{R}$ st $g(x)=g(x^2)$. Prove that $g(x)$ is constant.
QUESTION [10 upvotes]: For $x>0$, $g(\sqrt{x})=g(x)$ and similarly $g(x^{\frac{1}{2^n}})=g(\sqrt{x})=g(x)$ for $n \in \mathbb{N}$
Thus taking $\lim_{n\to \infty}$ both sides we get g(1)=g(x) $\forall x>0$ and as $g(x)=g(-x)$ thus $g(x)=g(1) \forall x\in \mathbb{R}$ thus $g(x)$ is constant. Is this proof correct?

REPLY [3 votes]: My phrasing would be as follows:

Since $g(x)=g(x^2)$ for any $x$, given $x_0\ne 0$, we have that $$g(x_0)=g(x_0^2)=g((-x_0)^2)=g(-x_0),$$ so it suffices to consider $x_0>0$.  In this case we have $$g(x_0)=g(x_0^{1/2})=g(x_0^{1/2})=g(x_0^{1/4})=\cdots =g(x_0^{1/2^n})=\cdots$$
  Given an $\epsilon>0$, there is a $\delta$ so that $x\in (1-\delta,1+\delta)$ implies $|g(x)-g(1)|<\epsilon$.  In particular, since we can choose a high enough $n$ so that $x_0^{1/{2^n}}\in (0,\delta)$, so $g(x_0)=g(1)$.  So $g$ is constant on $\mathbb{R}\setminus \{0\}$, from which we easily obtain by continuity that $g$ is constant on $\mathbb{R}$.