This question was asked in an entrance test for an undergraduate mathematics program today, held all over India.

Question: $f$ is a differentiable function in $[0,1]$ such that $f(f(x))=x$ and $f(0)=1$.

Find the value of $\int_{0}^{1} (x-f(x))^{2016} dx$.

I tried to solve it by substituting $f(f(x))$ in place of $x$, but could not proceed much further. Any hints or solutions will be appreciated.

  • 2
    $\begingroup$ Hint: the obvious function satisfying the conditions is $1-x$. $\endgroup$
    – almagest
    May 8, 2016 at 14:19
  • $\begingroup$ Which test was this asked in? $\endgroup$
    – Nikunj
    May 8, 2016 at 14:32
  • $\begingroup$ @Nikunj For ISI - Indian Statistics Institute. $\endgroup$ May 8, 2016 at 15:52
  • $\begingroup$ @almagest Is this operation valid for reaching that conclusion? If we apply Lagrange's MVT on $f$ which is differentiable in $(0,1)$ & continuous on $[0,1]$, $\exists$ at least one $c$ $\in (0,1)$ such that $f'(c)=\frac{f(1)-f(0)}{1-0}=-1$ [since $f(1)=0$ ]. So one possible function is $f(x)=-x+p.$ Now $p=1$ for $x=0,$ hence $f(x)=1-x.$ $\endgroup$ Jun 30, 2016 at 9:45
  • $\begingroup$ @StubbornAtom we can further assume that $c=1/2$, because of the symmetry. Infinite such functions are possible, so you can't really say anything based on that alone $\endgroup$ Jun 30, 2016 at 11:15

3 Answers 3



$$ I = \int_0^1 (x - f(x))^{2016}\, dx $$

Substitute $ x = f(u) $ and note that $ f(0) = 1 $, $ f(1) = 0 $ to obtain

$$ I = \int_1^0 (f(u) - u)^{2016} f'(u)\, du = - \int_0^1 (x - f(x))^{2016} f'(x)\, dx $$


$$ 2I = I + I = \int_{0}^{1} (x - f(x))^{2016} (1 - f'(x))\, dx $$

and we may substitute $ w = x - f(x) $, $ dw = (1 - f'(x))\, dx $ (noting that $1 - f(1) = 1 $ and $ 0 - f(0) = -1 $) to obtain

$$ 2I = \int_{-1}^{1} w^{2016}\, dw = \frac{2}{2017} $$


$$ I = \int_0^1 (x - f(x))^{2016}\, dx = \frac{1}{2017} $$

  • 6
    $\begingroup$ Why are you so quick at typing? I had been typing this. Well, doesn't matter. +1. $\endgroup$
    – S.C.B.
    May 8, 2016 at 14:23
  • $\begingroup$ It must be my lucky day today :) $\endgroup$
    – Ege Erdil
    May 8, 2016 at 14:27
  • 1
    $\begingroup$ So we need not know what $f(x)$ is in this solution. But I was wondering if for every real number $k>0$, $f(x) = \displaystyle\left(1-x^{\frac{1}{k}}\right)^k$ satisfies all conditions in the problem. $\endgroup$ Jun 30, 2016 at 9:42
  • $\begingroup$ @adityagupta $ f $ is its own inverse. $\endgroup$
    – Ege Erdil
    Jan 6, 2021 at 11:06
  • $\begingroup$ @EgeErdil Nice solution. $\endgroup$ Sep 26, 2022 at 15:12

An alternative solution is to note that $f(f(x))=x$ means that $f(x)$ is its own inverse. Geometrically, this means that the function will be perpendicular to the line $y=x$ at the point of intersection and symmetric on each side of $y=x$. Since it is differentiable over $[0,1]$ and we are given that $f(0)=1$, one such function that comes to mind is $f(x)=1-x$.

Now that a possible function is known, the calculation of the integral is easy:

$$\int_0^1 (x-f(x))^{2016}\,dx=\int_0^1(2x-1)^{2016}\,dx=\frac{1}{2017}$$

  • 3
    $\begingroup$ Yes, but you have to show that the value of the integral is the same for all such functions, which makes this solution invalid. (Unless you are in a multiple choice test, then it is clearly the superior solution :)) $\endgroup$
    – Ege Erdil
    May 8, 2016 at 14:36
  • 1
    $\begingroup$ That is correct, my solution does not show that $\frac{1}{2017}$ is the value of the integral in all such cases. It is purely here to give an explicit example for the OP if he is interested in such an example. $\endgroup$
    – Ethan Hunt
    May 8, 2016 at 14:40
  • $\begingroup$ I was so close to solving this question.... I kept on trying with $x-1$ and thinking it seems right... but won't satisfy the condition. facepalm from my side. $\endgroup$ May 8, 2016 at 15:54
  • $\begingroup$ @Starfall Unfortunately this was not a multiple choice question. $\endgroup$ May 8, 2016 at 15:54

Fix a positive even natural $\text{n}$ (we care about the case in which $\text{n}=2016$, but the argument is general).

As $f\left(x\right)$ is continuous and injective, $f\left(x\right)-x$ must be monotonically decreasing with a unique root on $\left[0,1\right]$. It follows that $$0\ \leq\ \left(f\left(x\right)-x\right)^{\text{n}}\ \leq\ 1$$ for $x\in\left[0,1\right]$ and also that for any $y\in\left[0,1\right]$ there exists a (unique, continuous) choice of $\alpha\left(y\right),\beta\left(y\right)\in\left[0,1\right]$ such that $$\left(f\left(x\right)-x\right)^{\text{n}}\leq y\ \iff\ x\in\left[\alpha\left(y\right),\beta\left(y\right)\right]\text{.}$$ In particular, $\alpha\left(y\right)$ and $\beta\left(y\right)$ are the unique values satisfying $$f\left(\alpha\left(y\right)\right)-\alpha\left(y\right)\ =\ \sqrt[n]{y}$$ $$\beta\left(y\right)-f\left(\beta\left(y\right)\right)\ =\ \sqrt[n]{y}\text{,}$$ so that $$\beta\left(y\right)=f\left(\alpha\left(y\right)\right)\ \implies\ \beta\left(y\right)-\alpha\left(y\right)\ =\ \sqrt[n]{y}\text{.}$$ We conclude that \begin{align*} \int_{x=0}^{1} \left(f\left(x\right)-x\right)^{\text{n}}\ \text{d}x\ &=\ 1-\int_{y=0}^{1} \left(\beta\left(y\right)-\alpha\left(y\right)\right)\ \text{d}y\\ &=\ 1-\int_{y=0}^{1} \sqrt[n]{y}\ \text{d}y\\ &=\ \int_{x=0}^{1} x^{n}\ \text{d}x\\ &=\ \boxed{\tfrac{1}{n+1}}\text{.} \end{align*} (Note that we did not need the hypothesis that $f$ is differentiable—continuity suffices!)

  • $\begingroup$ (Note also that essentially the above argument shows more generally that $\int_{x=0}^{1} g\left(f\left(x\right)-x\right)\text{d}x=\int_{x=0}^{1} g\left(x\right)\text{d}x$ for $g\colon\left[-1,1\right]\to\mathbb{R}$ an even continuous function satisfying $g\left(0\right)=0$ and with $g\colon\left[0,1\right]\to\mathbb{R}$ injective.) $\endgroup$
    – Rafi
    Feb 9 at 2:36

You must log in to answer this question.

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