Determine if the statement is true or false. NBHM 2014 PhD question. If $f$ and $g$ are continuous functions on $\mathbb{R}$ such that $\forall x \in \mathbb{R}$, $f(g(x))= g(f(x))$. If there exist $x_0 \in \mathbb{R}$ such that $f(f(x_0)) = g(g(x_0))$ then there exist $x_1 \in \mathbb{R}$ such that $f(x_1)= g(x_1)$.
I was successful neither in proving the statement nor finding a counter-example. I tried to consider the function $h(x) = f(x)-g(x)$ and check if h changes sign at some point, but nothing useful came out. Any help or hint is highly appreciated.
 A: Without loss of generality suppose that $f(x_0)\le g(x_0)$. It suffices to find a point $x_2$ such that $f(x_2) \ge g(x_2)$, for then the intermediate value theorem yields a point $x_1$ between $x_0$ and $x_2$ such that $f(x_1)=g(x_1)$.
Consider $f(f(f(x_0)))$ and $g(f(f(x_0)))$. If $f(f(f(x_0))) \ge g(f(f(x_0)))$ then we are done by taking $x_2 = f(f(x_0))$.
So suppose $f(f(f(x_0))) < g(f(f(x_0)))$. Then
$$
f(g(f(x_0)))
=
g(f(f(x_0)))
>
f(f(f(x_0)))
=
f(g(g(x_0)))
=
g(f(g(x_0))),
$$
and so we are done by taking $x_2 = f(g(x_0))$.
(Under the hypotheses that $f$ and $g$ commute and that $f(f(x_0))=g(g(x_0))$, for any positive integer $n$, we see that of all possible compositions $h$ of $n$ functions each of which is either $f$ or $g$, there are only $2$ potentially different values of $h(x_0)$—one for the $h$s that have an odd number of $f$s, and one for the $h$s that have an even number of $f$s. These multiple identities of the iterates of $x_0$ make it easy to find points that can be interpreted as values of $f$ or as values of $g$.)
