<s>[INST] 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)).$
 [/INST] 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}$.
</s>