# Let $f: \mathbb{R} \to \mathbb{R}$ be a continuous function satisfying $f(f(x)) =f(x)$ then which one is correct

As stated in the title; Let $$f: \mathbb R \to \mathbb R$$ be a continuous function satisfying $$f(f(x))$$ = $$f(x)$$ then

(a) $$f$$ must be constant

(b) $$f(x) = x$$ for all $$x$$ in range of $$f$$

(c) $$f$$ must be a non constant polynomial

(d) There is no such function

By randomly trying different functions I discovered that $$f(x) = x$$ and $$f(x) = 1-x$$ satisfy given property . So using this option (c) seems to be correct.

But , My question is that How can I make sure that these are the only functions that hold this property ? and if there are any other function (other than these two) then how should I find them .

Thank you

• Note: the header question says $f(f(x))=x$, but in the body of the post you say $f(f(x))=f(x)$. Which did you intend? – lulu Jun 12 at 17:00
• @lulu sorry,it was a typo i have edited the question now. – sat091 Jun 12 at 17:07
• Are you sure? Given $f(x)=1-x$ we have $f\circ f(x)=f(1-x)=1-(1-x)=x\neq f(x)$. – lulu Jun 12 at 17:12
• constant functions also meet the condition – Red shoes Jun 12 at 17:12
• $|x|$ satisfies the given conditions and isn't a polynomial. – lulu Jun 12 at 17:13

The answer should be $$b$$. Suppose not. That means there exists $$f$$ and there exists $$y_0$$ such that we have some $$x_0$$ with $$f(x_0)=y_0$$ and we have $$f(y_0)\neq y_0$$.

Then, $$f(x_0)=y_0$$, but $$f(f(x_0))=f(y_0)\neq y_0$$, which contradicts the assumtion that $$f(f(x))=f(x)$$ for all $$x$$.

• What you're arguing for, it's (b), not (c). – Adam Latosiński Jun 12 at 17:24
• Ah thanks, excuse the mistake. – EBP Jun 12 at 17:27
• @EBP but what about $f(x) = \mid x\mid$? – sat091 Jun 12 at 17:36
• This statement holds for $f(x)=|x|$. The image of $f(x)$ is $[0,\infty)$, and this is exactly the domain where $f(x)$ itself is the identity. – EBP Jun 12 at 17:40
• thanks for the clarification ! – sat091 Jun 12 at 17:48

If $$x$$ is in the range of $$f$$ means $$x=f(y)$$ for some $$y$$. Since $$f(f(y))=f(y)$$ you have $$f(x)=x$$.

Just to see how arbitrary your function may be I give the following example satisfying your conditions:

$$f(x)=\left\{ \begin{array}{cc} x,&|x|\leq 1\\ \sin(\pi x/2),& |x|>1 \end{array}\right.$$