Is there an interesting (graphical) intuition about what the condition $f\circ g=g\circ f$ implies?

I have a few questions about continuous functions $$f$$ and $$g$$ that satisfy the condition

$$f\circ g=g\circ f\tag{1}$$

(1) Is there an interesting (graphical) intuition about what this condition implies? I have to think a lot to come up with an example that isn't inverse functions. Is there some insight that would permit coming up with examples easier?

(2) Given a function such as $$f(x)=1+2x$$ how do we find a $$g$$ that together with $$f$$ satisfies $$(1)$$?

(3) If we impose the additional condition that $$0\leq f,g\leq 1$$ for all $$x\in [0,1]$$, what are some examples in which

(3a) $$f(1)\neq g(1)$$?

(3b) in particular, $$f(1)$$ and $$g(1)$$ are in $$(0,1)$$ and $$f(1)\neq g(1)$$?

Here are examples I came up with that aren't inverses.

$$f(x)=\sqrt{x}$$, $$g(x)=x^4$$, $$f(g(x))=g(f(x))=x^2$$

Here we have a case of (3a)

$$f(x)=x$$, $$g(x)=1-x$$, $$f(g(x))=g(f(x))=1-x$$

I haven't been able to come up with a case (3b).

Some Context

This question came up while solving a problem in Chapter 22, "Infinite Sequences", from Spivak's Calculus.

The task there was to prove that if

• $$f$$ and $$g$$ are continuous functions on $$[0,1]$$
• $$f\circ g=g\circ f$$
• $$0\leq f(x),g(x)\leq 1$$ for all $$x\in [0,1]$$
• $$f$$ increasing

then $$f$$ and $$g$$ have a common fixed point.

I was able to prove this, but even so I don't feel like I have a good feel for what the assumptions mean.

Hence, my questions.

• +1 If $f \circ g = g \circ f$, then we say $f$ and $g$ "commute". This is a property that is frequently useful in abstract algebra, and indeed other fields where functions are iterated (such as fixed point theory). The concept is very well-studied, but I don't know of any nice way to spot such functions visually from their graphs (though I can't claim to be an expert). Also, the function $f(x) = x$, the identity function, commutes with everything, so I wouldn't read too much into the second example! Oct 22, 2022 at 8:28
• There seem to be this post linked to many others which could serve as an entry point math.stackexchange.com/q/11431/399263
– zwim
Oct 22, 2022 at 11:15
• Oct 22, 2022 at 11:36
• Under the name of "permutable" functions such $f\circ g=g\circ f$ have intrigued many mathematicians since the days of Ritt 1923 if not earlier see for example this paper. A fairly general class of examples is obtained from $f_a(x)=F(F^{-1}(x)+a)$ where $F$ is an invertible function and $a$ a real parameter. This gives an entire semigroup of permutable functions $f_a\circ f_b=f_b\circ f_a=f_{a+b}$. Oct 22, 2022 at 14:14

Fairly obvious examples include

• $$f(x)=x^a$$, $$g(x)=x^b$$, $$f\circ g(x)=g\circ f(x)=x^{ab}$$;
• $$f(x)=x+a$$, $$g(x)=x+b$$, $$f\circ g(x)=g\circ f(x)=x+a+b$$;
• $$f(x)=ax$$, $$g(x)=bx$$, $$f\circ g(x)=g\circ f(x)=abx$$, etc.

Is there some insight that would permit coming up with examples easier?

I think anything which is homogeneous fits the bill. As soon as you go into polynomials it starts to fail, so $$f(x)=ax+b$$ and $$g(x)=cx+d$$ fail since $$f(g(x))=a(cx+d)+b\neq g(f(x))=c(ax+b)+d$$ unless $$ad+b=cb+d$$.

• What do you mean by "homogeneous" here?
– MJD
Oct 22, 2022 at 14:44
• I mean homogeneous in the usual sense rather than a specific mathematical definition. OP was asking how to guess examples of this condition, so I gave some examples which I'd thought of. I think those are all "homogeneous" in the sense of the dictionary. wordnik.com/words/homogeneous Oct 22, 2022 at 23:00
• Just a small remark. Your 2nd example are inhomogeneous polynomials :) . Oct 23, 2022 at 4:00

I first propose answers to the 3 questions, then give a general way to construct a $$g$$ that commutes with a given $$f$$ (with some conditions), while still defining freely $$g$$ on $$[0,f(0))$$.
Note that for any $$f$$ there are solutions such as $$g=f \circ f$$, $$g=f \circ f \circ f$$, etc.

Question 1
Here is a graphical interpretation. Sorry for the manual drawing.

Draw the graphs of $$f, g, f^{-1}, g^{-1}$$. For simplicity of drawing I assume $$f$$ and $$g$$ to be $$[0,1] \to [0,1]$$. $$f^{-1}$$ and $$g^{-1}$$ are symmetrics of $$f$$ and $$g$$ by the first diagonal.

Then $$f(g(x))$$ and $$g(f(x))$$ are constructed as follows:

$$f$$ and $$g$$ commute if $$f(g(x))$$ and $$g(f(x))$$ reach the same abscissa; which is almost but not quite the case on the drawing.

In addition, because this is true $$\forall x$$, there is a relation between the slopes of 4 points in the diagram: the slope of $$f$$ on abscissa $$x$$ divided by the slope of $$g^{-1}$$ on abscissa $$g(f(x))$$ equals the slope of $$g$$ on abscissa $$x$$ divided by the slope of $$f^{-1}$$ on abscissa $$f(g(x))$$. Which is in fact the differentiation of $$f(g(x))=g(f(x))$$:
$$g'(x)f'(g(x))=f'(x)g'(f(x))$$
$$g'(x)/(f^{-1})'(f(g(x))=f'(x)/(g^{-1})'(g(f(x))$$

Question 2
For $$f(x)=1+2x$$, we can look for $$g(x)=ax+b$$ that commutes with $$f$$:
$$1+2(ax+b)=a(1+2x)+b$$
$$b=a-1$$
Hence $$\forall a, g(x)=ax+a-1$$ commutes with $$f$$.

Question 3
An example fulfilling (3b) is easy with affine functions:
for $$f(x)=\frac {x+1} 3$$, any $$g(x)=ax+\frac {1-a} 2$$ commutes with $$f$$.
So we can choose $$g(x)=\frac x 4 + \frac 3 8$$, so that $$\forall x \in [0,1], 0 < g(x) < 1$$, and $$g(1) \ne f(1)$$.

In general
If $$f$$ is a strictly increasing continuous function with $$\forall x, f(x) > x$$, it is possible to build continuous functions $$g$$ that commute with $$f$$ while choosing $$g$$ freely on $$[0, f(0))$$. Here is how.

We'll call $$f_n=f(f_{n-1})$$ with $$f_0=0$$. $$(f_n)_{n\in\mathbb{N}}$$ is a strictly increasing sequence. This makes a partition of $$\mathbb{R}^+$$ into intervals $$[f_n, f_{n+1})$$.

First, define $$g$$ on $$[f_0,f_1)$$ as any continuous strictly increasing function, such that $$g(f_1)=f(g(f_0))$$. We'll call $$g_n=g(f_n)$$.
Then $$g_n=g(f(f_{n-1}))$$ which must be equal to $$f(g(f_{n-1}))=f(g_{n-1})$$, so $$(g_n)_{n\in\mathbb{N}}$$ is defined by $$g_0=g(f_0)$$ (freely chosen) and $$g_n=f(g_{n-1})$$.

Then we define $$g$$ by recurrence on intervals $$[f_n, f_{n+1})$$:
$$g(x)=f(g(f^{-1}(x)))$$
As $$x \in [f_n, f_{n+1})=[f(f_{n-1}),f(f_n))$$,
$$f^{-1}(x) \in [f_{n-1},f_n)$$,
$$g(f^{-1}(x))$$ has been defined at the previous recurrence step,
so $$g(x)=f(g(f^{-1}(x)))$$ is correctly defined.

$$g$$ is continuous in $$(f_n, f_{n+1})$$ by recurrence: it is constructed as continuous on $$(f_0, f_1)$$, and continuity on $$(f_{n-1}, f_n)$$ implies continuity on $$(f_n, f_{n+1})$$ by composition of continuous functions: $$g(x)=f(g(f^{-1}(x)))$$.
For the same reason it is continuous at right of $$f_n$$.
$$g$$ is continuous at left of $$f_n$$ by recurrence: we have chosen $$g(f_1)=f(g(f_0))=f(g(f^{-1}(f1)))$$, and continuity at left of $$f_{n-1}$$ implies continuity at left of $$f_n$$ by the definition $$g(x)=f(g(f^{-1}(x)))$$.

Then $$\forall x, g(f(x))=f(g(f^{-1}(f(x))))=f(g(x))$$: $$f$$ and $$g$$ commute.

This has defined $$g$$ on $$\mathbb{R}^+$$. $$g$$ can be defined on $$\mathbb{R}^-$$ by the same procedure, going downwards.

• This seems like manually going through the process of, given the functions, determining if they commute, correct? Oct 23, 2022 at 0:36
• @evianpring Yes. This is similar to what you could have done on your drawings: checking that $f$ and $g$ commute for each $x$. The only little improvement is that, by using also $f^{-1}$ and $g^{-1}$ graphs, getting $f(g(x))$ and $g(f(x))$ is slightly simpler. Oct 23, 2022 at 7:46
• The issue I have is that this doesn't seem to answer the main questions posed, which have to do with general insights about functions that satisfy $f\circ g=g\circ f$. Unfortunately, your answer also doesn't provide the examples that were requested. Oct 23, 2022 at 11:25
• @evianpring I have now completed the answer. Note however that this problem has a large literature, as was pointed out in the comments, and no "silver-bullet" answer, Oct 23, 2022 at 19:47