# Find $f:[0, 1]\to \mathbb R$ that maximizes $I(f)-J(f)$, where $I(f)=\int_0^1 {x^2 f(x)dx}$, $J(f)=\int_0^1{x\left(f(x)\right)^2 dx}$

I've never seen this kind of problems - finding a function with almost no conditions which maximizes the integral - so I'm asking for a hint. The problem is as follows.

Find a continuous function $$f:[0, 1]\to \mathbb R$$ that maximizes $$I(f)-J(f)$$, where $$I(f)=\int_0^1 {x^2 f(x)dx},\ \ \ \ \ \ J(f)=\int_0^1{x\left(f(x)\right)^2 dx}$$

I tried to select candidates of types of functions that can possibly make the given integration maximum. Assuming that $$f$$ is a function that $$\exists I(f), J(f)$$, I considered a function $$g(x):=xf(x)\{x-f(x)\}$$, but still don't have a idea. Any helps will be very appreciated. Thanks.

Hint: For any $$x \in [0,1]$$, we have $$xy(x-y) \le \dfrac{x^3}{4}$$ for all $$y \in \mathbb{R}$$, with equality if $$y = \dfrac{x}{2}$$.
You can prove this using basic calculus. Can you use this to find the maximum of $$I(f)-J(f) = \displaystyle\int_{0}^{1}xf(x)(x-f(x))\,dx$$?