# A functional equation: Composition to get a... linear function? [closed]

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?

• 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?
– xnor
Feb 28 at 20:36
• @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. Feb 28 at 20:46

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.
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$$.