Suppose $ f $ is a continuous function from $ [0, 1] $ to $ [-1, 1] $ with $ |f(x)|\leq x, x\in [0, 1] $. Find the maximal value for $$ \left| \int_{0}^{1}(f(x))^2-f(x)dx \right| .$$
I have tried the following:
\begin{align*} \left| \int_{0}^{1}(f(x))^2-f(x)dx \right|&=\left| \int_{0}^{1}(f(x)-\frac{1}{2})^2-\frac{1}{4})dx \right| \\ &=\left| \int_{0}^{1}(f(x)-\frac{1}{2})^2dx-\frac{1}{4}\right| \end{align*} So we have to find some $ f(x) $ to make $ \int_{0}^{1}(f(x)-\frac{1}{2})^2dx $ as far from $ \frac{1}{4} $ as possible. Then I am stuck...