Lt $f:\mathbb{R}\rightarrow\mathbb{R}$ be continuous function such that $f\circ f=f.$ I like to prove that if $f$ is non constant function then $f(x)=x$ i.e. $f$ is identity function. I think to prove it it is sufficient to prove that $f $ is one one function as in that case if $f(x)\neq x $ for some $x$ then $f(f(x))\neq f(x)$ which gives a contradiction. So how to prove that it is one one? Please help. Thanks a lot.

  • $\begingroup$ i am saying that $f$ is non constant then?? $\endgroup$
    – neelkanth
    Aug 31, 2016 at 4:23
  • 2
    $\begingroup$ Woops, let me try again. $f(x) = |x|$ is a counterexample. $\endgroup$
    – Joey Zou
    Aug 31, 2016 at 4:25
  • $\begingroup$ The reasoning $a≠b \implies f(a) ≠ f(b)$ assumes that $f$ is injective. $\endgroup$ Aug 31, 2016 at 4:26
  • $\begingroup$ @CalvinKhor how you proved injective? $\endgroup$
    – neelkanth
    Aug 31, 2016 at 4:28
  • $\begingroup$ Its precisely the contrapositive of being injective $(f(a) = f(b) \implies a=b)$ $\endgroup$ Aug 31, 2016 at 4:29

3 Answers 3


This sort of problem is discussed in linear algebra, where a linear map $f$ between vector spaces is called a projection if $f\circ f = f$. Examples in linear algebra of such functions are like $\pi_1:\mathbb{R}^2\to\mathbb{R}^2$ defined by $\pi_1(x,y) = (x,0)$. So, we see that functions that behave as you want move points into an image and once they are there, they stay there no matter how many times you apply $f$. This is formulated in the following way:

Claim: If $x$ is in the range of $f$, then $f(x) = x$.

Proof: If $x$ is in the range of $f$, then there is a point $x'$ such that $f(x') = x$. Then we see that $$f(x) = f(f(x')) = (f\circ f)(x') = f(x') = x,$$ which is what we wanted to show. $\blacksquare$

So, we see that if $f$ has range $R \subset \mathbb{R}$, then $f$ restricted to $R$ is the identity function. However, outside $R$ $f$ can do anything as long as it maps into $R$. Note that all such functions $f$ have to have this property and that if a function has this property then $f\circ f = f$. So, we get the following, which is formulated above in another response.

Theorem: Let $f:X\to X$. Then $f$ restricted to its range is the identity function if and only if $f \circ f = f$.

  • $\begingroup$ Thanks for such a nice detailed.... $\endgroup$
    – neelkanth
    Aug 31, 2016 at 5:12

In general, if there exists a subset $X\subset\mathbb{R}$ such that

  1. $f(x) = x$ for all $x\in X$,
  2. $f(\mathbb{R})\subseteq X$, i.e. the range of $f$ is contained in $X$,

then $f\circ f = f$. If, furthermore, $X\ne\mathbb{R}$, then it is impossible for $f$ to be the identity function.

An example of a continuous nonconstant function satisfying the above two properties is $f(x) = |x|$ (with $X = [0,\infty)$), but for nice enough subsets $X$ you can play around and generate more functions like this by following the above two rules.


You have that $f:\mathbb{R}\to\mathbb{R}:x\mapsto |x|$ it is continuous, and $f\circ f=f$, it is not constant, and $f\neq \mbox{id}_\mathbb{R}$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .