# 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

No.

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)=\theta(t)$ , where $\theta(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)=\theta(t)+t$ , where $\theta(t)$ is an arbitrary periodic functions with period $2$

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

In fact $f(x)=x+1$ is only a paticular solution when taking $\theta(t)=0$ .

-

Answering the question in the topic: definitely not for all f. Consider f(f(x))) = x; is f(x) = x or f(x) = -x?

-

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