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 !). 
So what’s the deal here? Please help me make sense of it. 

*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. 
 A: 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}}.$$
A: 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. 
A: 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.
