given $f:[0,1] \to \Bbb{R}$, find the maximum value of $$\int_0^1 x^2f(x) - xf^2(x) dx$$

I tried to factorize it as such: $$I = \int_0^1 xf(x) ( x - f(x) )dx$$ Then tried Cauchy-Schwarz $$\int_0^1 xf(x)(x-f(x))dx \le \sqrt{\int_0^1(xf(x))^2dx \cdot \int_0^1 (x-f(x))^2 dx}$$ RHS is maximum when $\int_0^1 (xf(x))^2 dx = \int_0^1 (x-f(x))^2 dx$. Solving this, $$\int_0^1x^2 f^2(x) dx= \int_0^1 x^2 + f^2(x) - 2xf(x)dx \\ \int_0^1 f^2(x)(1-x^2)-2xf(x)+x^2 dx = 0 \\ \int_0^1 f(x)(f(x)(1-x^2) + 2x) = -\frac 13$$ And I got stuck here. I think I'm just overcomplicating things with this method. Is there a simpler way to do this?

  • $\begingroup$ Are you familiar with calculus of variations? $\endgroup$ May 23, 2020 at 4:40

3 Answers 3


I don't know if you are aware of the Euler-Lagrange Identity, but that would solve this in one line. So for any integral of the form

$$J[f] = \int_{x_1}^{x_2} L(x,f(x), f'(x))dx$$

The minima or maxima will occur when $f$ satisfies the following differential equation

$$\frac{\partial L}{\partial f} - \frac{d}{dx}\frac{\partial L}{\partial f'} = 0$$

The derivation is quite well explained here, and should be easy enough to follow: https://en.wikipedia.org/wiki/Calculus_of_variations

So using this, with $L(x,f(x)) = x^2f(x) - xf^2(x)$,

$$\frac{\partial L}{\partial f} = x^2 - 2xf(x) = 0$$

Hence $f(x) = \frac{x}{2}$, and maximum value is $\frac{1}{16}$

Alternate Solution

Rewrite the integral as

$$I = \int_0^1x^3\left(\frac{f(x)}{x} - \left(\frac{f(x)}{x}\right)^2\right)dx$$ Let $\frac{f(x)}{x} = y(x)$

$$I = \int_0^1x^3y(1-y)dx$$

Now, tha maximum attainable value for $y(1-y)$ is when $y = \frac{1}{2}$

Hence, $$I \leq \int_0^1 \frac{x^3}{4}dx$$

With equality occuring only when $f(x) = \frac{x}{2}$

  • $\begingroup$ This only shows that $f=\frac{x}2$ is an extremal, not even that it is a local maximizer. We'd have to prove that a global maximizer exists to make this a solution. Generally, claculus of variations is an overkill for this problem, and the Euler-Lagrange equation is insufficient to solve it. $\endgroup$
    – Conifold
    May 23, 2020 at 4:52
  • $\begingroup$ Well, if you see the nature of the integral, you'd observe that it's positive only when $0 \leq f(x) \leq x$, and it goes to zero at 0 and at $f(x) = x$, so this would be at least a local maxima $\endgroup$ May 23, 2020 at 4:54
  • $\begingroup$ Even if the integral is bounded from above it does not prove that a maximizer exists, or that this extremal is it. $\endgroup$
    – Conifold
    May 23, 2020 at 4:55
  • $\begingroup$ Does the alternate solution work better? $\endgroup$ May 23, 2020 at 5:07
  • 1
    $\begingroup$ Yes. You didn't even have to rewrite it this way. $F(y)=x^2y-y^2x$ is a parabola in $y$ that opens down, hence the value of $F$ is maximized at its vertex for each $x$. Choosing the vertex value $y=\frac{x}2$ at each $x$ maximizes the integral. $\endgroup$
    – Conifold
    May 23, 2020 at 5:12

One only has to maximize the value of $x^2f(x)-xf(x)^2$ for every $x\in [0,1]$. The function $y\mapsto x^2y-xy^2$ has derivative $x^2-2xy$, so it attains its maximum when $y=x/2$.

Hence we have

$$ \int_0^1 x^2f(x) - xf^2(x) \,\mathrm{d}x \leq \int_0^1 x^2\frac{x}{2}-x\left(\frac{x}{2}\right)^2 \,\mathrm{d}x = \frac{1}{16}, $$

and the equality holds for $f(x)=x/2$.

  • $\begingroup$ How do you know that maximizing $g(x)$ will lead to a maximal value of $\int_{x_1}^{x_2} g(x) dx$? $\endgroup$ May 23, 2020 at 5:54
  • $\begingroup$ I'm not sure that I understand your question. The core of my answer is the inequality $\int_0^1 x^2f(x) - xf^2(x) \,\mathrm{d}x \leq \int_0^1 x^2\frac{x}{2}-x\left(\frac{x}{2}\right)^2 \,\mathrm{d}x$ $\endgroup$
    – tristan
    May 23, 2020 at 6:00
  • $\begingroup$ @AniruddhaDeb if $f(x) > g(x)$, then $\int_{x_1}^{x_2} f(x)dx > \int_{x_1}^{x_2} g(x)dx$ $\endgroup$ May 23, 2020 at 6:01

Starting with the conjecture that $f(x) = x/2$, let $f(x) = x/2+g(x)$.

Then $f(x)(x-f(x)) = (x/2+g(x))(x-(x/2+g(x))) = (x/2+g(x))(x/2-g(x)) =(x/2)^2-g^2(x) $ so $I = \int_0^1 xf(x) ( x - f(x) )dx = \int_0^1 x((x/2)^2-g^2(x))dx = \int_0^1 x((x/2)^2)dx-\int_0^1 xg^2(x))dx \le 1/16 $ with equality only when $g(x) \equiv 0$.

Therefore the maximum is when $f(x) = x/2$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .