# f(f(x)) = 4x

There are plenty of continuous functions ${f}$ such that ${f(f(x)) \equiv x}$. Besides the trivial examples ${f(x)=x}$ and ${f(x)=-x}$, one can take any equation ${F(x,y)=0}$ that is symmetric in ${x,y}$ and has a unique solution for one variable in terms of the other. For example: ${x^3+y^3-1 =0 }$ leads to ${f(x) = (1-x^3)^{1/3}}$.

I can’t think of an explicit example that is also differentiable, but implicitly one can be defined by ${x^3+y^3+x+y=1}$, for example. In principle, this can be made explicit by solving the cubic equation for ${x}$, but I’d rather not.

At the time of writing, I could not think of any diffeomorphism ${f\colon \mathbb R \rightarrow \mathbb R}$ such that both ${f}$ and ${f^{-1}}$ have a nice explicit form. But Carl Feynman pointed out in a comment that the hyperbolic sine ${f(x)= \sinh x = (e^x-e^{-x})/2}$ has the inverse ${f^{-1}(x) = \log(x+\sqrt{x^2+1})}$ which certainly qualifies as nice and explicit.

Let’s change the problem to ${f(f(x))=4x}$. There are still two trivial, linear solutions: ${f(x)=2x}$ and ${f(x)=-2x}$. Any other? The new equation imposes stronger constraints on ${f}$: for example, it implies

$\displaystyle f(4x) = f(f(f(x)) = 4f(x)$

But here is a reasonably simple nonlinear continuous example: define

$\displaystyle f(x) = \begin{cases} 2^x,\quad & 1\le x\le 2 \\ 4\log_2 x,\quad &2\le x\le 4 \end{cases}$

and extend to all ${x}$ by ${f(\pm 4x) = \pm 4f(x)}$. The result looks like this, with the line ${y=2x}$ drawn in red for comparison.

To check that this works, notice that ${2^x}$ maps ${[1,2]}$ to ${[2,4]}$, which the function ${4\log_2 x}$ maps to ${[4,8]}$, and of course ${4\log _2 2^x = 4x}$.

From the plot, this function may appear to be differentiable for ${x\ne 0}$, but it is not. For example, at ${x=2}$ the left derivative is ${4\ln 2 \approx 2.8}$ while the right derivative is ${2/\ln 2 \approx 2.9}$.
This could be fixed by picking another building block instead of ${2^x}$, but not worth the effort. After all, the property ${f(4x)=4f(x)}$ is inconsistent with differentiability at ${0}$ as long as ${f}$ is nonlinear.

The plots were made in Sage, with the function f define thus:

def f(x):
if x == 0:
return 0
xa = abs(x)
m = math.floor(math.log(xa, 2))
if m % 2 == 0:
return math.copysign(2**(m + xa/2**m), x)
else:
return math.copysign(2**(m+1) * (math.log(xa, 2)-m+1), x)

## 2 thoughts on “f(f(x)) = 4x”

1. Carl Feynman says:

Forward and inverse hyperbolic sine both can be expressed in an explicit form, taught in high school. Is that close enough to a “nice” invertible diffeomorphism?

1. sinh certainly qualifies, I didn’t think of hyperbolic functions when writing this. Updated the post. Thanks!

This site uses Akismet to reduce spam. Learn how your comment data is processed.