Suppose we have a function such that$$f(f(x))=2x+4\quad\forall x\in\mathbb R$$Does such a function $f:\mathbb R\to\mathbb R$ exist that satisfies the relation, or does such a function not exist?

  • 1
    $\begingroup$ I'm guessing you wanted a function that can't be composed from a linear function twice, which means having negative coefficient on x, to require more imaginative methods? $\endgroup$
    – xnor
    Feb 28 at 20:36
  • $\begingroup$ @xnor No actually, since the only solutions I was able to find were the solutions mentioned in your answer and I honestly doubt that it would be solvable that way. $\endgroup$
    – CrSb0001
    Feb 28 at 20:46

2 Answers 2


Sure, let $$f(x) = \sqrt{2}x+4(\sqrt{2}-1)$$

I found this by assuming $f$ has the form $f(x)=\sqrt{2}x+c$ to get the $2x$ term in $f(f(x))$, and solved for which $c$ gives $+4$.

We could have also done $f(x)=-\sqrt{2}x+c$ to get $f(x) = -\sqrt{2}x-4(\sqrt{2}+1)$ as another solution.


We can also create piecewise linear solutions. For instance, consider the following function:

Let $n$ be the largest power of two smaller than $\frac{|x+4|}{3}$. If $\frac{|x+4|}{3n} < \frac{5}{3},$ then $f(x) = \frac{x}{2}+\frac{7n}{2}-2$. Otherwise, $f(x)=4x-14n+12$.

enter image description here


Not the answer you're looking for? Browse other questions tagged or ask your own question.