TITLE: What is a condition for two real functions $f,g$ to "commute", so $f(g(x))=g(f(x))$?
QUESTION [7 upvotes]: Say I'm given two functions $f,g$. Can I tell if they "commute" without actually trying them in the formula
$f(g(x))=g(f(x))$?
And given a function $f$, is there a way to find all functions $g$ such that
$f(g(x))=g(f(x))$?
I've tried using derivatives and the chain rule but haven't got anything interesting yet.

REPLY [6 votes]: There is, in general, no characterization other than the evaluation of $f(g(x))$ and $g(f(x))$.
Also, for fixed $f$ there is no an easy way to find all the $g$ such that $f \circ g = g \circ f$.
Special cases can be studied. For example, a theorem of J. Lipiński says that if $f$ is a continuous and strictly monotonic function on an interval $I$ such that $f(I) \subseteq I$ then there is an infinity of solutions $g$ (depending on an arbitrary function).