# Find the maximal value for $\left| \int_{0}^{1}(f(x))^2-f(x)dx \right| .$

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...

• Just look the integrand and you can deduce the answer: when is $\int f(x)^2$ maximum, when is $\int -f(x)$ maximum? Sep 23, 2018 at 9:06
• @Winther How am I supposed to consider $\int f(x)^2$ and $\int -f(x)$ at the same time?
– Bach
Sep 23, 2018 at 9:20
• Consider them individually. For example $\int f(x)^2{\rm d}x$ is maximized by making $f^2$ as large as possible. With the given constraint this means $f(x) = x$ or $f(x) = -x$. You can also proceed from your derivation: you need to make $(f(x)- 1/2)^2$ either as large or as small as possible. With the given constraints this gives you just two functions to check. Sep 23, 2018 at 9:21
• Hint: Can you choose values for $f(x)$ so there is no cancellation? Sep 23, 2018 at 9:22

Let $$A=\{f\in \mathcal C([0,1],[-1,1])\;,\; \forall x, |f(x)|\leq x\}$$. It is not hard to prove that $$\sup_{f\in A}\left|\int_0^1f^2-f \right|= \max\left(\sup_{f\in A}\left[\int_0^1f^2-f\right], -\inf_{f\in A}\left[\int_0^1f^2-f\right] \right)$$

Besides, for $$f\in A$$, $$f^2(x)\leq x^2$$, thus $$\int_0^1 f^2-f\leq \int _0^1(x^2+x) dx=\frac 56$$, and this upper bound is attained for $$f(x)=-x$$, hence $$\sup_{f\in A}\left[\int_0^1f^2-f\right] = \max_{f\in A}\left[\int_0^1f^2-f\right]=\frac 56$$.

Note also that $$\int f^2-f\geq -\int_0^1 f\geq -\int_0^1 x=-\frac 12$$. Hence $$\inf_{f\in A}\left[\int_0^1f^2-f\right]\geq -\frac 12$$ and $$\max\left(\sup_{f\in A}\left[\int_0^1f^2-f\right], -\inf_{f\in A}\left[\int_0^1f^2-f\right] \right) = \sup_{f\in A}\left[\int_0^1f^2-f\right] = \max_{f\in A}\left[\int_0^1f^2-f\right]=\frac 56$$ thus $$\sup_{f\in A}\left|\int_0^1f^2-f \right|=\frac 56$$ and the upper bound is attained for $$x\mapsto -x$$.

• Good job! This one is relatively more rigorous.
– Bach
Sep 23, 2018 at 10:29

Consider the function $$g(x) = x^2 - x$$ defined on the interval $$[-a, a]$$, where $$0 \le a \le 1$$. Where is the maximum of $$g(x)$$? What is this maximum value?

Since $$g(x)$$ is a convex parabola, with only local minima in the interior of the interval the maximum must occur at an endpoint, i.e. at $$a$$ or $$-a$$. Comparing, we have, $$g(-a) = a^2 + a \ge a^2 - a = g(a),$$ so the maximum value occurs at $$x = -a$$.

Now, if $$f : [0, 1] \to [-1, 1]$$, with $$|f(x)| \le x$$ for all $$x \in [0, 1]$$, then $$f(x)^2 - f(x) \le x^2 + x,$$ using the above with $$a = x$$. This maximum is achieved when $$f(x) = -x$$. Given this pointwise inequality, it follows that $$\int_0^1 f(x)^2 - f(x) \; \mathrm{d}x \le \int_0^1 x^2 + x \; \mathrm{d}x = \frac{5}{6}.$$