If $f(g(x)) = g(f(x))$ $\forall x \in [0, 1]$.Prove that exist $x_0\in [0,1]$ such that $f(x_0) = g(x_0)$ Assume that $f, g: [0, 1] \rightarrow [0,1]$ are continous functions satisfying
$$f(g(x)) = g(f(x))$$ $\forall x \in [0, 1]$.
Prove that exist $x_0\in [0,1]$ such that $f(x_0) = g(x_0)$.
My Attempt:
I tried using intermediate value property theorem for continuous function but couldn't find any way out
 A: It looks that there are a couple of arguments which can solve the problem. I found one using fixed points and a compacity argument, but I believe that the following one is more elemental.
Since $f$ and $g$ are continuous functions defined on a compact set, they attain its maximum and minimum there. By contradiction, suppose that $f(x)\neq g(x)$ for all $x\in [0, 1]$. Then, WLOG $g>f$ and by taking into account that the inclusion $g([0, 1])\subset [0, 1]$ reverse the $\max$ function, the hypothesis implies
\begin{align*}
    g(x)>\max_{x\in [0, 1]} f(x)\geq \max_{x\in [0, 1]} f(g(x))=\max_{x\in [0, 1]} g(f(x))
\end{align*}
which is a contradiction. The other case $f<g$ is treated in the same way by choosing the $\min$ function instead the $\max$ one.
A: Taking a cue from a hint which has now been deleted, what if $f$ and $g$ are surjective?
If $f\neq g$ on the whole interval $[0,1]$, then either $f>g$ on the whole interval or $g>f$ on the whole interval.
If $f>g$, we get an immediate contradiction, since $g(c)=1$ for some $c$, which would force $f(c)>1$. Same goes for $g>f$. $\blacksquare$
So we need only consider this. What if $f$ isn't surjective? Or $g$ isn't?
Answer: We compose these functions many times, take the image, and pass to the limit. Then they will be surjective.
More accurately, since $f$ and $g$ commute, the image of $f^m \circ g^n$ is exactly the image of $g^n\circ f^m$.
Can you see why $S=\bigcap\limits_{m,n\geq1} \text{Im}(f^m \circ g^n)$ has the property that $f(S)=S$ and $g(S)=S$?
Can you also see that $S$ is an interval? By "interval", I don't rule out the possibility that it could be open, closed, half-open or even a single point.
If $S$ is just a point, we're done. If not, we take the closure of $S$, denoted as $\overline{S}$. This is a closed interval, and it is obvious that $f(\overline{S})=\overline{S}$ and $g(\overline{S})=\overline{S}$.
We have now gone back to the starting case where $f$ and $g$ are surjective.
