Putnam 2006, Problem B-5

For each continuous function $f : [0, 1] \to \mathbb{R}$, let $I(f) = \int_0^1 x^2 f(x) \, dx$ and $J(f) = \int_0^1 x (f(x))^2 \, dx$. Find the maximum value of $I(f) - J(f)$ over all such functions $f$.

Solution:
The answer is $1/16$. We have
$$\int_0^1 x^2 f(x) dx - \int_0^1 x f(x)^2 dx$$
$$= \int_0^1 (x^3/4 - x(f(x) - x/2)^2) dx$$
$$\leq \int_0^1 x^3/4 dx = 1/16,$$
with equality when $f(x) = x/2$.