Method of solving the functional equation $f(2x)=f(x)$ using Lagrange's Mean Value Theorem A problem i have goes as follows:

Let $f:\mathbb R\to\mathbb R$ be a continuous function satisfying $f(2x)=f(x),\;\forall\;x\in\mathbb R$. If $f(1)=3$, then the value of $\displaystyle \int_{-1}^1 f(f(f(x)))\,\mathrm dx$ is?

Now, their solution is as follows.

Consider $f(x)$ on the interval $[x_0,2x_0]$. Then:
  $$\dfrac{f(2x_0)-f(x_0)}{x_0}=f'(c),\text{    where }c\in(x_0,2x_0)$$
  $$\therefore f'(c)=0$$
  $$\therefore \color{red}{f(x)=\text{a constant}}$$
  $$\vdots$$

How did they get to the step highlighted in red from the previous step? The function derivative is zero at some $x=c$, how does it imply that the function derivative is zero on the entire function?
Also, is there another method to solve the functional equation?
Thanks!
 A: The red claim is true, but a non sequitur as stated. For example, there seems to be an application of Rolle's theorem, but the we do not even knwo if the premises hold. Also, one could (immediately) only conclude that some points have derivative zero.
However:
The continuous function $f$ restricted to the compact interval $[1,2]$ attains its maximum $M$ and its minimum $m$. Then $M$ and $m$ are also attained in every interval $[2^{-k},2^{1-k}]$. By continuity, $f(0)=M=m$. We conclude that $f$ is constant (as the same argument works for negative $x$).
A: In fact, it is enough to assume it is continuous at 0.
Since $f$ is continuous at 0, then for any $\epsilon$ there must exist $\delta$ so that when $|x|<\delta$ then $|f(x)-f(0)| < \epsilon$.  Suppose the farthest value from $f(0)$ this function attains is $f(a)=f(0)+c$.  Then take $\epsilon=c$ to see that $|f(x)-f(0)|<c$ when $|x|<\delta$.  But, $c=|f(a)-f(0)|=|f(a/2)-f(0)|=\cdots=|f(a/2^b)-f(0)|$, where $b$ is large enough to get $a/2^b<\delta$.  Contradiction.
