TITLE: Maximum value problem
QUESTION [5 upvotes]: A function $\hspace{0.1cm}$$f:[0,1]\to[-1,1]$$\hspace{0.1cm}$ satisfying$\hspace{0.1cm}$ $|f(x)|\leq x$$\hspace{0.1cm}$ $\forall x\in[0,1]$.
Then find the maximum value of:
$|\int_{0}^{1}(f^2(x)-f(x))dx|$ 
My attempt:
$|\int_{0}^{1}(f^2(x)-f(x))dx|\leq \int_{0}^{1}|f^2(x)-f(x)|dx\leq \int_{0}^{1}(|f^2(x)|-|f(x)|)dx\leq \int_{0}^{1}(x^2-x)dx=-\frac{1}{6}$
But it is not possible because absolute value is always greater than equal to zero.Please someone help me to find its maximum value.Thanks

REPLY [3 votes]: \begin{align}
\left|\int_{0}^{1} f(x)^{2} - f(x) \,\mathrm{d}x  \right|
\le \int_{0}^{1} |f(x)|^{2} + |f(x)| \, \mathrm{d}x \le \int_{0}^{1} x^{2} + x \, \mathrm{d}x = \frac{5}{6}.
\end{align}
So the maximum is at most $5/6$. However, let $f(x) = -x$. Then 
\begin{align}
\left|\int_{0}^{1} f(x)^{2} - f(x) \,\mathrm{d}x  \right| = \int_{0}^{1} x^{2} + x \, \mathrm{d}x = \frac{5}{6}. 
\end{align}
So the maximum is indeed $5/6$.