# Given $f(f(x))$ can we find $f(x)$?

Given $f(f(x))=x+2$ does it necessarily follow that $f(x)=x+1$? This question comes from a precalculus algebra student.

-
Are you working with functions from $\mathbb R$ to $\mathbb R$? From $\mathbb Z$ to $\mathbb Z$? –  Martin Sleziak Nov 6 '12 at 11:05
I am very impressed by the ingenuity of the answers. Many thanks. Perhaps I should add that the question was raised by a student of mine. –  user48432 Nov 6 '12 at 19:38
you should accept an answer –  miracle173 Jan 4 '13 at 19:46

The answer to your question is no. For example, if you are working with function $f\colon\mathbb Z\to\mathbb Z$ then $$f(x)= \begin{cases} x-1; & x\text{ is even}, \\ x+3; & x\text{ is odd}; \end{cases}$$ is an example of a different function such that $f(f(x))=x+2$.

If you want the function $f\colon\mathbb R\to\mathbb R$, you can simply extend this one by putting $f(x)=x+1$ for $x\notin\mathbb Z$.

If you would like to see a continuous solution different from $x+1$, you could use the piecewise linear function obtained by putting $0\mapsto2/3, 2\mapsto2+2/3, 4\mapsto2+2/3, \dots$ and $2/3\mapsto 2, 2+2/3\mapsto 4, 4+2/3\mapsto 6,\dots$

The composition $f\circ f$ will be again piecewise linear and to check that $f(f(x))=x+2$ you only need to verify this for $x\in2\mathbb Z$ and $x\in\frac23+2\mathbb Z$.

The intuition behind this is that the interval $[0,2/3]$ is stretched to the interval $[2/3,2]$ (which has twice the length of the original interval) and $[2/3,2]$ contracted to $[2,2+2/3]$. The same thing is done on other intervals $[2k,2(k+1)]$, $k\in\mathbb Z$.

-
Would the claim $f(f(x))=x+2 \,\rightarrow \, f(x)=x+1$ be true in case $f$ is continuous ? how about when $f$ is a monotonic function ? –  Teddy Nov 6 '12 at 11:47
@Teddy I've added an example which is monotone and continuous. –  Martin Sleziak Nov 6 '12 at 11:55
I think what he's really asking about is a function that is infinitely differentiable. –  MatsT Nov 6 '12 at 17:02

In fact this belongs to a functional equation of the form http://eqworld.ipmnet.ru/en/solutions/fe/fe2315.pdf.

Let $\begin{cases}x=u(t)\\f=u(t+1)\end{cases}$ ,

Then $u(t+2)=u(t)+2$

$u(t+2)-u(t)=2$

For $u_c(t+2)-u_c(t)=0$ ,

$u_c(t)=C(t)$ , where $C(t)$ is an arbitrary periodic functions with period $2$

For $u_p(t)$ ,

Let $u_p(t)=At$ ,

Then $A(t+2)-At\equiv2$

$2A\equiv2$

$\therefore2A=2$

$A=1$

$\therefore u(t)=C(t)+t$ , where $C(t)$ is an arbitrary periodic functions with period $2$

Hence $\begin{cases}x=C(t)+t\\f=C(t+1)+t+1\end{cases}$ , where $C(t)$ is an arbitrary periodic functions with period $2$

-
Answering the question in the topic: definitely not for all f. Consider f(f(x))) = x; is f(x) = x or f(x) = -x?
I guess we have clearly seen that for a general function the statement is not true, but if you add the assumptions that $f$ is (strictly) monotonic and differentiable you can show that $f(f(x)) = x+2$ implies $f(x) = x+1$. First note that $$f(x)+2 = f(f(f(x))) = f(x+2)$$ $$f'(x) = f'(x+2).$$ The monotonic assumption means $f$ has an inverse, so $$f(x) = f^{-1}(x+2)$$ and hence $$f'(x) = \frac{d}{dx} f^{-1}(x+2) = \frac{1}{f'(f^{-1}(x+2))}.$$ This means $$f'(f(x)) = \frac{f'(x)}{f'(f^{-1}(f(x)+2))}=\frac{f'(x)}{f'(x+2)} = 1$$ But differentiating $f(f(x)) = x+2$ we get $$f'(f(x))f'(x) = 1$$ $$f'(x) = 1$$ which means, $f(x) = x+C$. We can fix the value of $C$ using the relation $f(f(x)) = x+2$, where we find that $C=1$.
So the only monotonic, differentiable function that satisfies $f(f(x)) = x+2$ is $f(x) = x+1$.
Oh sorry, I made an error in the derivative of the inverse $f$, I'll have to check if this line of reasoning still works... –  asperanz Nov 8 '12 at 19:04