In which cases are $(f\circ g)(x) = (g\circ f)(x)$? I have found three cases:
1) If $f$ and $g$ are the same function.
2) If $f$ and $g$ are mutually inverse.
3) If both are polynomials of degree $1$
Maybe there are more.
 A: If $X = \{w, x, y, z\}$ is an arbitrary set of four elements, the permutations
$$
f = (w\ x)(y\ z),\qquad
g = (w\ y)(x\ z)
$$
commute. In words, $f$ exchanges $w$, $x$ and $y$, $z$, while $g$ exchanges $w$, $y$ and $x$, $z$. Together, $f$ and $g$ generate a Klein $4$-group under composition. (Pleasant observation: If the elements of $X$ are placed at the corners of a rectangle and arrows are drawn to create a commutative diagram, the actions of $f$ and $g$ coincide with Euclidean symmetries of the rectangle, i.e., with the customary representation of the Klein $4$-group as symmetries of a rectangle.)
Now, let $X$ be an arbitrary set that can be partitioned into quadruples (e.g., a finite set of $4n$ elements for some positive integer $n$, or a countably infinite set, or the set of real or complex numbers). Partition $X$ arbitrarily into quadruples, define $f$ and $g$ as above on each quadruple, and note that $f$ and $g$ commute under composition. This by no means exhausts all possibilities. At the same time, the vastness of the number of ways this can be done should suggest how hopeless it is to "classify" all commuting real-valued functions of one real variable.
