This is Exercise 3 from page 27 of Analysis I by Amann and Escher. I found this question by searching, but I don't understand the top answer, particularly the part about choosing $g(f(x))$ independently of $g(x)$. I'm not sure if it answers my question.
Exercise:
Show that composition $\circ$ is not, in general, a commutative operation on $\text{Funct}(X, X)$.
($\text{Funct}(X, X)$ is the set of all functions from $X$ to $X$.)
Comments:
Showing that something is not true "in general" is confusing. I feel that the wording of the question suggests that it's not enough to find a counterexample. Is this perhaps a translation issue? (I think this book was originally written in German.)
If it helps at all, Example 4.9 on page 26 says in part, "...composition is an associative operation on $\text{Funct}(X, X)$. It may not be commutative (see Exercise 3)."
It's not hard to show that two different constant functions will not commute. Is that satisfactory? I don't know.
I appreciate any help.