# $f(f(x))=f(x)$ question

I am wondering what is the class of functions $f: \mathbb{R}\rightarrow\mathbb{R}$ such that $f(f(x))=f(x)$?

I think it should be:

1. Constant Value functions
2. the identity function
3. absolute value function $|x|$

But I don't know if this is right or how to show it rigorously.

Any suggestions?

• The magic word is: en.wikipedia.org/wiki/Idempotence – tabstop Feb 19 '14 at 4:07
• Combine some of these three: $f(x)=x,x>0$, $f(x)=const, x<0$ – miracle173 Feb 19 '14 at 4:13
• $f(x)=0,x \in \mathbb{Q}$, else $f(x)=\pi$. is a function that is not continous and has this property – miracle173 Feb 19 '14 at 4:18

Such functions can be described in the following way:

If $A$ is an arbitrary subset of $\mathbb{R}$ and $g:\mathbb{R} \setminus A \mapsto A$ an arbitrary funtion. Define

$$f(x) = \left\{ \begin{array}{l l} x & \quad \forall x\in A\\ g(x) & \quad \forall x \not \in A \end{array} \right.$$

$f$ has this idempotency property.

Contrary for an $f$ with the idempotency property such an $A$ and $g$ can be found: $A:=f(\mathbb{R})$ and $g:=f \rvert _{\mathbb{R}\setminus A}$

• so you're saying if $x$ $\not\in$ $A$ then just let $f(x)$ be some arbitrary element of $A$? – User112358 Feb 19 '14 at 4:33
• @fatmattxle yes – miracle173 Feb 19 '14 at 4:34
• This is a good answer! It is based on the following equivalent form of idempotency : "the image of $f$ is fixed pointwise by $f$". Clearly, what $f$ does to points other than in the image of $f$ is not material! – Karthik C Feb 19 '14 at 5:35

Here is a large family of such functions. Choose any function $g(x)$, defined on $(-\infty,0)$, that satisfies $g(x)\ge 0$ for all negative $x$. Then we define $$f(x)=\begin{cases} g(x) & x<0 \\ x & x\ge 0\end{cases}$$

The absolute value is an example from this family, corresponding to $g(x)=-x$. But any function with that condition will do, such as $g(x)=x^2$ or $g(x)=\sqrt{-x}$ or $g(x)=e^x$ or $g(x)=1+\sin x$.

Put $f\left( \mathbb{R} \right) = U \ne \emptyset$, then $\forall y \in U$, we have $f\left( y \right) = y$ by $f\left( {f\left( x \right)} \right) = f\left( x \right)$. We can call $U$ a collection of fixed points of $f$.

If a funtion $g$ maps $\mathbb{R}-U$ to $U$, then it satisfies $g\left( {g\left( x \right)} \right) = g\left( x \right)$.

For example, $f\left( x \right) = \left| x \right|$, we get $U = \left[ {0, + \infty } \right)$, luckily, $f$ maps $\left( { - \infty ,0} \right)$ to $U$.

And, if $U$ has exactly one (fixed) point, say $c$, i.e. $f(c)=c$, then $f$ must maps $\left( { - \infty ,\infty } \right) - \left\{ c \right\}$ to $\{c\}$. That is, $f$ is a constant value function.

Assuming $f^{-1}$ exists, $$f(f(x))=f(x)\\ \implies f^{-1}(f(f(x)))=f^{-1}(f(x))\\ \implies \boxed{f(x)=x}$$ This is the identity function, or, the inclusion map acting on $\mathbb{R}^1$.

• (Assuming $f^{-1}$ exists.) – tabstop Feb 19 '14 at 4:05
• @tabstop Yes, of course. Thank you. – user122283 Feb 19 '14 at 4:05
• That's tricky because I didn't assume it exists – User112358 Feb 19 '14 at 4:07
• This doesn't help when $f$ is not invertible, as in $f(x)=c$ for example. – Daryl Feb 19 '14 at 4:07
• For many (if not all) interesting, non-trivial cases $f$ is not invertible. – Alt Feb 19 '14 at 4:34