When functions commute under composition Today I was thinking about composition of functions.  It has nice properties, its always associative, there is an identity, and if we restrict to bijective functions then we have an inverse.
But then I thought about commutativity.  My first intuition was that bijective self maps of a space should commute but then I saw some counter-examples. The symmetric group is only abelian if $n \le 2$ so clearly there need to be more restrictions on functions than bijectivity for them to commute.
The only examples I could think of were boring things like multiplying by a constant or maximal tori of groups like $O(n)$ (maybe less boring).
My question: In a euclidean space, what are (edit) some nice characterizations of sets of functions that commute? What about in a more general space? 
Bonus: Is this notion of commutativity important anywhere in analysis?
 A: According to Wikipedia, a set of diagonalizable matrices commute if and only if they are simultaneously diagonalizable. There is a far-reaching generalization, namely the Gelfand representation theorem.
The Gelfand representation theorem for commutative $C^*$ algebras represents every commutative $C^*$ algebra as an algebra of functions with pointwise multiplication; the domain of the latter algebra is the spectrum of the former algebra.
A: This question may also be related to how certain functions behave under functions of their variables. In this context, the property of commuting with binary operators, such as addition and multiplication, can be used to define classes of functions:


*

*additive commutation: if $g(x, y) = x + y$, then $f\big(g(x, y)\big) = g\big(f(x),\ f(y)\big)$ if and only if $f(x + y) = f(x) + f(y)$ thus $f$ is a homogeneous linear function of the form $f(x; a) \equiv ax$

*multiplicative commutation: if $g(x, y) = xy$, then $f\big( g(x, y) \big) = g\big(f(x),\ f(y)\big)$ if and only if $f(xy) = f(x)f(y)$ thus $f$ is "scale invariant" i.e. a power law of the form $f(x; a) \equiv x^a$

*log-additive commutation: if $g(x, y) = x + y$, then $\log f\big( g(x, y) \big) = g\big( \log f(x),\ \log f(y) \big)$ if and only if $f(x + y) = f(x)f(y)$ thus $f$ is an exponential function of the form $f(x; a) \equiv \exp(ax)$
The last item (3) involves a third function (the logarithm) which when denoted as $h$ gives 
$h\big(f[g(x, y)]\big) = g\big(h[f(x)],\ h[f(y)]\big)$
or
$h \circ f \circ g(x, y) = g\big(h \circ f(x),\ h \circ f(y)\big).$
Since $h \circ f$ occurs on both sides, we can denote this as $\tilde f$ to get
$\tilde f \big( g(x, y) \big) = g \big( \tilde f(x), \tilde f(y) \big)$
which has the same form as item (1) above. From this perspective, items (1) and (3) above can be seen as being isomorphic under the $\exp$ and $\log$ pair of invertible mappings.
A: A classic result of Ritt shows that polynomials that commute under composition must be, up to a linear homeomorphism, either both powers of $x$, both iterates of the same polynomial, or both  Chebyshev polynomials. Actually Ritt proved a more general rational function case - follow the link. His work was motivated by work of Julia and Fatou's work on Julia sets of rational functions, e.g. see here for a modern presentation.
