# On the derivative of a function that is its own inverse

I was recently doing the following question:

Let $$f$$ be a differentiable function such that $$f(f(x))$$ = $$x$$ for all $$x\in[0,1]$$. Suppose $$f(0)=1$$. Determine the value of $$\int_0^1(x-f(x))^{2016} dx$$

Now, in the light of the fact that $$f(f(x))=x$$ I thought the substitution $$t=f(x)$$ may be something to investigate. Of course, if $$t=f(x)$$ then $$dx = {dt\over f’(x)}$$ so we may write the integral as $$\int_1^0(f(t)-t){dt\over f’(x)}$$

Now, I noticed that we might be able to exploit the fact* that $$f(x)$$ is its own inverse to resolve $$f’(x)$$.

Notice that $${f^{-1}}’(x) = \frac 1{f’(x)}$$ But, since $$f(x)=f^{-1}(x)$$ we have $$(f’(x))^2 = 1$$ save for the degenerate case that $$f’(x) = 0$$— which if true means the function isn’t invertible in the first place (even if it’s only at some certain points those may be extrema and may challenge the invertibility of the function, but I digress).

But obviously it is not necessary that a function’s derivative to be $$1$$ or $$-1$$ for it to be its own inverse, right? I thought of a function on $$[0,\infty)$$ $$g(x)=\left(a-x^n\right)^\frac 1n$$ (where $$n$$ is a natural number) whose derivative is $$(1-n)x^{n-1}(a-x^n)^{\frac 1n -1}$$ (clearly not $$\pm 1$$) and its inverse is $$g^{-1}(x)=(a-x^n)^\frac 1n$$ (clearly $$g(x)$$, not even making an attempt to disguise itself !).

*I figured that it isn’t actually necessarily true that $$f(f(x)) = x$$ means $$f \equiv f^{-1}$$, since $$f^{-1}$$ may not even exist, and I ended up solving that problem by instead trying the substitution $$x=f(t)$$. Interestingly, continuing with the original substitution and assumption that $$f(x)=f^{-1}(x)$$ and writing $$f’(x)$$ as a function of $$t$$ is consistent with the other substitution.

However, this has no actual bearing on the question.

• Your statement about the derivative is incorrect. $(f^{-1})'(x) = \frac{1}{f'(f^{-1}(x))}$, or in this case, $f'(x) = \frac{1}{f'(f(x))}$ – Ninad Munshi Nov 5 '19 at 11:47
• @KaboMurphy That's not true, because we can take $1-x$ and deform it so that we can still keep the symmetry w.r.t. the line $y=x$ by bowing it in or out. The resultant functions should still satisfy the conditions for the theorem. – Ninad Munshi Nov 5 '19 at 12:12
• @NinadMunshi The way I read this question $f$ has domain $[0,1]$. Since $f(f(x))$ has to be defined I am assuming that $f:[0,1] \to [0,1]$. Also $f(0)=1$. These conditions are not satisfied by your example. – Kavi Rama Murthy Nov 5 '19 at 12:32
• Various examples suggest that $$\int_0^1(x-f(x))^{2n} dx=\frac{1}{2n+1}.$$ – Michael Hoppe Nov 5 '19 at 15:29
• @KaboMurphy Nit picking? Then take the appropriate part of the circle given by $(x+1)^2+(y+1)^2=5$ instead, that is $f(x)=\sqrt{5-(x+1)^2}-1$. – Michael Hoppe Nov 5 '19 at 15:33

We can first use Binomial Theorem. The first term can be integrated separately, and the remaining terms can be paired as follows. $$\begin{eqnarray} \mathcal I &=& \int_0^1 (x-f(x))^{2n} dx =\\ &=&\frac1{2n+1}+\sum_{k=1}^{n}\left\{{2n \choose k}(-1)^k\int_0^1x^{2n-k}[f(x)]^{k}dx+\right.\\ & &-\left.{2n\choose 2n-k+1}(-1)^{k}\int_0^1x^{k-1}[f(x)]^{2n-k+1}dx\right\} \end{eqnarray}$$ Now let us perform the change of variable $$x \to f(x)$$ and then integration by parts to further elaborate the second term in the above sum, thus getting $$\begin{eqnarray} \mathcal I &=&\frac1{2n+1}+\sum_{k=1}^{n}\left\{{2n \choose k}(-1)^k\int_0^1x^{2n-k}[f(x)]^{k}dx+\right.\\ & &+\left.{2n\choose 2n-k+1}(-1)^{k}\int_0^1x^{2n-k+1}[f(x)]^{k-1}f'(x)dx\right\}=\\ &=&\frac1{2n+1}+\sum_{k=1}^{n}\left\{{2n \choose k}(-1)^k\int_0^1x^{2n-k}[f(x)]^{k}dx+\right.\\ & &-\left.{2n\choose 2n-k+1}(-1)^{k}\frac{2n-k+1}{k}\int_0^1x^{2n-k}[f(x)]^{k}dx\right\}=\\ &=&\boxed{\frac1{2n+1}}. \end{eqnarray}$$

EDIT - "Slicker" solution

Change of variable $$x \to f(x)$$ yields $$\begin{eqnarray} \mathcal I &=& -\int_{0}^1(x-f(x))^{2n}f'(x)dx=\\ &=&\int_0^1(x-f(x))^{2n}(1-f'(x)-1)dx=\\ &=&\frac1{2n+1}\left[(x-f(x))^{2n+1}\right]_0^1 -\mathcal I=\\ &=&\frac2{2n+1}-\mathcal I. \end{eqnarray}$$ Hence the result $$\boxed{\mathcal I = \frac1{2n+1}}.$$

• Note: The condition that 2016 is even isn't necessary. Your slicker solution is essentially this - math.stackexchange.com/questions/1776769/…. – Calvin Lin Nov 6 '19 at 5:52
• Wow.. Too bad I didn't notice it.. Or maybe better like that: I made some practice. @CalvinLin, thanks for your comment! – dfnu Nov 6 '19 at 5:55
• Nice solutions. – Certainly not a dog Nov 6 '19 at 6:27
• @CalvinLin how do you prove the statement for odd exponent? I think I have counterxamples. – dfnu Nov 6 '19 at 8:17
• I was incorrect (missed a negative sign). – Calvin Lin Nov 6 '19 at 12:56

This problem doesn't seem to have an answer. One possible function is $$f(x)=1-x$$ which gives us

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

But another possible function which satisfies the conditions of the problem is $$f(x)=\frac{1}{x+\phi-1}-\phi+1$$ where $$\phi$$ is the golden ratio. This gives a numerical answer of around

$$\int_0^1 \left(x-\left(\frac{1}{x+\phi-1}-\phi+1\right)\right)^{2016} dx \approx 0.0003587$$

So unless there were extra conditions to problem, it is inherently flawed and has no answer.

• With appropriate precision I get $0.0004957858205$ for your last integral, which is approximately $1/2017$. – Michael Hoppe Nov 5 '19 at 15:31
• @MichaelHoppe I don't see how additional precision could ever change the leading digits of a computation, so unless the three numerical integration methods I tried are all wrong for agreeing with each other, I would suggest you check your computation again, it doesn't seem trustworthy. Perhaps post it so it can be verified? The first integration solver I used was NIntegrate on Mathematica – Ninad Munshi Nov 5 '19 at 23:58
• I think the guess by @MichaelHoppe is correct, so I agree that there is some computational precision issue in your second integral. Check my answer if you like. – dfnu Nov 6 '19 at 1:21

There are two things to note here.

Firstly, the premise of the question I had was incorrect. Indeed, the derivative of $$f^{-1}(x)$$ is not $$\frac 1{f’(x)}$$ but rather $$\frac 1{f’(f^{-1}(x))}$$. So, that bud has been nipped, and all is well in the world.

Secondly, many commenters and answerers were interested in the integral itself. As I mentioned in the question body, I reversed the substitution and instead made $$x\mapsto f(u)$$, and this did wonders for me.

Note that $$f(x)=1$$ when $$x=0$$ ($$\text{given}$$) and $$f(1)=f(f(0))=0$$ ($$f(f(x))=x$$).

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

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

Now, making the substitution $$t= x-f(x)$$ we have $$2I=\int_{-1}^1 t^{2016} dt$$ $$\implies\boxed{I=\frac 1{2017}}$$

Of course as it goes with such questions the number $$2016$$ doesn’t serve much of a purpose except to flex on the candidates of the examination. However here, its even-ness is crucial for the solution.

• Seems like you don't need the exponent to be even. Here's a further exercise for you! – dfnu Nov 6 '19 at 6:28
• Certainly is required for this method else the substitution would yield positive $\int_0^1 (x-f(x))^{2n+1} f’(x)dx$. – Certainly not a dog Nov 6 '19 at 6:31
• yep, that is why I proposed it as a further exercise. I believe my first approach, too, is useless at this aim. – dfnu Nov 6 '19 at 7:03
• That kind of indicates to me that it probably is not true, though. In no step did we ice out any chance of an odd exponent until its even-ness was actually needed. But some thought is surely required here. – Certainly not a dog Nov 6 '19 at 7:20
• You're right. Many counterexamples can be built with odd exponent. – dfnu Nov 6 '19 at 10:34