# Maximize $\int_0^1 x^2f(x)~\mathrm dx - \int_0^1 xf(x)^2~\mathrm dx$ among continuous $f:[0,1]\to\Bbb R$

For a function $f$, let

$$a = \int_{0}^{1} x^2f(x) \mathrm{d}x\\ b = \int_{0}^{1} xf^2(x) \mathrm{d}x,$$

where $f$ is a continuous function from $[0,1]$ to $\mathbb{R}$. Then find $\text{max}\{a-b\}$ for all such $f$.

I am getting $\dfrac {1}{16}$. Note that it can be written as $\int_{0}^{1} \left({\dfrac{x^3}{4}-x(f(x)-\dfrac{x}{2})^2}\right)dx$. I guess that's less than $\int_{0}^{1} \dfrac{x^3}{4} dx$ which is $\dfrac {1}{16}$.

• I get the idea that some information is missing. I would start by noting that since $[0, 1]$ is compact, $f(x)$ can be bounded from above by some constant $M$, and then you can estimate the integral by replacing $f(x) \to M$, leading to something like $1/3M - 1/2M^2$ as a first upper bound. However, I don't quite see how to get rid of $M$ without more information on $f$. – CompuChip Nov 18 '13 at 11:44
• Your result is right, the maximum is $\frac{1}{16}$. You wrote the difference as the difference of a fixed function, and a square involving $f$ (times $x$), and the difference is maximised when the square - $(f(x) - \frac{x}{2})^2$ - is $0$. – Daniel Fischer Nov 18 '13 at 12:55

Here is another approach in the case we can't express the integral in the way you did (see the comment of @DanielFischer). Let $X=C([0,1])$ and $I:X\to\mathbb{R}$ be defined by $$I(f)=\int_0^1 x^2f(x)-\int_0^1xf(x)^2$$

Note that $I$ is a continuously differentiable function and $$\langle I'(f),g\rangle =\int_0^1 (x^2 g(x)-2xf(x)g(x)),\ \forall\ f,g\in X$$

We want to find $f\in X$ such that $$\langle I'(f),g\rangle=0,\ \forall\ g\in X$$

Therefore $$f(x)=\frac{x}{2}$$

To verify that $f$ is a maximum, note that $$I(f+h)=\int_0^1\left(\frac{x^3}{4}-xh(x)^2\right)$$

• Can you please specify what g(x) is? – Apurv Nov 18 '13 at 13:43
• I have specified: $g\in X=C([0,1])$. – Tomás Nov 18 '13 at 13:56
• Ok.. Didn't note that.. Thanks ! – Apurv Nov 18 '13 at 13:59
• Ok, you are welcome @Apurv. Note that the equation $$\langle I'(f),g\rangle =0,\ \forall\ g\in X$$ comes from the fact that we want to find a critical point of $I$, i.e. a point $f$ satisfying $$I'(f)=0$$ – Tomás Nov 18 '13 at 14:05