# Find the maximum value of $I\left(f\right) - J\left(f\right)$ over all such functions $f$

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

So the problem is:

Step 1. For what values of $x$ does $$\frac{\textrm{d}x}{\textrm{d}y} \left[ \int_0^1 x^2f\left(x\right)\: \textrm{d}x - \int_0^1 xf\left(x\right)^2\:\textrm{d}x\right] = 0$$

Step 2. For what values of $x$ is this negative $$\frac{\textrm{d}^2x}{\textrm{d}y^2} \left[ \int_0^1 x^2f\left(x\right)\: \textrm{d}x - \int_0^1 xf\left(x\right)^2\:\textrm{d}x\right] = 0$$

Not sure exactly how to do that.

Page 281 Problem #80 in Calculus 9$^{th}$ edition by Larson No, its not homework its way to difficult for class, but I like math and the last problem is the most fun and I learn the most from.

-
This is a problem in calculus of variations. I don't think steps 1 and 2 are accurate. –  Gautam Shenoy Nov 17 '12 at 8:21
Check out Euler Lagrange condition for more details. –  Gautam Shenoy Nov 17 '12 at 8:21
@GautamShenoy I have googled Euler Lagrange condition and I vagle understand what I am reading, could you please explain more. Or atleast point me to a PDF textbook that will explain. I am in first year calculus. –  yiyi Nov 17 '12 at 8:41
If you are in first-year Calculus, then Calculus of Variations is a bit out of reach, I'm afraid. Did this question come up in first-year Calculus? or did you find it somewhere else? –  Gerry Myerson Nov 17 '12 at 8:44
–  Gerry Myerson Nov 17 '12 at 21:25

Step1. For the stationary $f$, $f(0)=0$. Otherwise, we can re-define $f$ on a right neighbourhood of zero and make the RHS strictly increase.
Step2. Assuming $x\in(0,1]$, take $g(x)=\frac{f(x)}{x}$. Then we have: $$RHS=\int_{(0,1]}\left(x^2 f-x f^2\right)\,dx = \int_{(0,1]}x^3 g (1-g)\,dx,$$ but $g(1-g)\leq\frac{1}{4}$ by the AM-GM inequality, so: $$RHS\leq \int_{(0,1]}\frac{x^3}{4}\,dx = \frac{1}{16},$$ with equality reached only when $g$ is constantly $\frac{1}{2}$, or $f(x)=\frac{x}{2}$.
What is the justification for replacing $g(1-g)$ with $1/4$? –  yiyi Nov 17 '12 at 13:30
Again: AM-GM. If two real numbers sum to one, their product is at most $1/4$, and it is exactly one fourth only when the two numbers are equal to $1/2$. –  Jack D'Aurizio Nov 17 '12 at 13:37