If $f(x) = \frac{x^3}{3} -\frac{x^2}{2} + x + \frac{1}{12}$, then $\int_{\frac{1}{7}}^{\frac{6}{7}}f(f(x))\,dx =\,$?

This is a question from a practice workbook for a college entrance exam.

Let $$f(x) = \frac{x^3}{3} -\frac{x^2}{2} + x + \frac{1}{12}.$$ Find $$\int_{\frac{1}{7}}^{\frac{6}{7}}f(f(x))\,dx.$$

While I know that computing $f(f(x))$ is an option, it is very time consuming and wouldn't be practical considering the time limit of the exam. I believe there must be a more elegant solution.

Looking at the limits, I tried to find useful things about $f(\frac{1}{7}+\frac{6}{7}-x)$ The relation I obtained was that $f(x) + f(1-x) = 12/12 = 1$. I don't know how to use this for the direct integral of $f(f(x)).$


We know,

$ \displaystyle \int_{a}^{1-a}f(f(x))\,dx = \int_{a}^{1-a}f(f(1-x))\,dx$.

So,

$\displaystyle \int_{a}^{1-a}f(f(x))\,dx = \frac{1}{2} \int_a^{1-a}\left[f(f(x))+f(f(1-x)) \right] \ dx$

Now for the given function, observe that $f(x) + f(1-x) = 1 \implies f(1-x) = 1 - f(x)$

So, $f(f(x)) + f(f(1-x)) = f(f(x)) + f(1-f(x)) = 1$

So we have,

$\displaystyle \int_{a}^{1-a}f(f(x))\,dx = \frac{1}{2} (1-2a)$

Here $a = \dfrac{1}{7}$ and that leads to $\dfrac{5}{14}$.


In a comment after @Math Lover's elagant answer, I told that nobody tried the change of variable $f(x)=y$. So, I tried for the fun of it $$I=\int f[f(x)]\,dx=\int \Big[ \frac 1{12}+f(x)-\frac 12 f^2(x)+\frac 13 f^3(x)\Big]\,dx$$ Let $f(x)=y$. Solving the cubic with the hyperbolic method for only one real root $$x=\frac{1}{2}-\sqrt{3} \sinh \left(\frac{1}{3} \sinh ^{-1}\left(\frac{2-4 y}{\sqrt{3}}\right)\right)$$ $$dx=\frac{4 \cosh \left(\frac{1}{3} \sinh ^{-1}\left(\frac{2-4 y}{\sqrt{3}}\right)\right)}{\sqrt{48 (y-1) y+21}}\,dy$$ So, $$20480\,I=-10240 \sqrt{3} \sinh (t)+2700 \cosh (2 t)+1350 \cosh (4 t)+15 \cosh (8 t)+12 \cosh (10 t)$$ where $$t=\frac{1}{3} \sinh ^{-1}\left(\frac{2-4 y}{\sqrt{3}}\right)$$ Now, for $y$, the upper and lower bounds are $\frac{3223}{4116}$ and $\frac{893}{4116}$ and then for $t$, they are $$\mp \frac{1}{3} \sinh ^{-1}\left(\frac{1165}{1029 \sqrt{3}}\right)$$ Because of the symmetry in $t$, all cosines disappear and the result for the definite integral is just $$\int_{\frac{1}{7}}^{\frac{6}{7}}f[f(x)]\,dx =\sqrt{3} \sinh \left(\frac{1}{3} \sinh ^{-1}\left(\frac{1165}{1029 \sqrt{3}}\right)\right)$$ whic, numerically is $0.3571428571428571428571429$; its reciprocal is $2.8=\frac {14}5$ so the value of $\frac 5{14}$.

For those who are curious, this took me close to one and half hour.