TITLE: What's the minimum of $\int_0^1 f(x)^2 \: dx$, subject to $\int_0^1 f(x) \: dx = 0, \int_0^1 x f(x) \: dx = 1$?
QUESTION [22 upvotes]: The question is as in the title: what's the minimum of $\int_0^1 f(x)^2 \: dx$, subject to $\int_0^1 f(x) \: dx = 0, \int_0^1 x f(x) \: dx = 1$? (Assume suitable smoothness conditions.)
A problem in the textbook for the course I am TEACHING (not taking) reduces to minimizing $w_1^2 + w_2^2 + w_3^2$ subject to $w_1 + w_2 + w_3 = 0, w_1 + 2w_2 + 3w_3 = 1$. Of course there's nothing special about the number $3$ here, and so one can ask for the minimum of $\sum_{i=1}^n w_i^2$ subject to $\sum_{i=1}^n w_i = 0, \sum_{i=1}^n iw_i = 1$. At least when $n = 3, 4, 5$, we get $w_i = c_n(i-(n+1)/2)$, for some constant $c_n$ which depends on $n$. So for fixed $n$, $w_i$ is a linear function of $i$. (This is a bit of an annoying computation, so I won't reproduce it here.)
So it seems like there should be a continuous analogue of this. If we have 
$$ \int_0^1 f(x) \: dx = 0, \int_0^1 x f(x) \: dx = 1 $$
and $f(x)$ is linear, then we get $f(x) = 12(x-1/2)$, and $\int_0^1 f(x)^2 \: dx = 12$.  Is this the function satisfying these integral conditions with smallest $\int_0^1 f(x)^2 \: dx$? That is, is it the case that
$$ \int_0^1 f(x)^2 \: dx \ge 12 $$
for every $f(x)$ satisfying the two conditions above and whatever smoothness conditions are necessary?
I've tagged this calculus-of-variations because that's what it looks like to me. But I don't know the calculus of variations, which is why I can't just solve the problem myself.

REPLY [10 votes]: Seeing the very nice solutions using linear algebra that have been posted, I am again reminded that the calculus of variations is a bigger and less elegant hammer than is necessary for most nails. For what it's worth, here is how you could solve this problem with the calculus of variations. José Figueroa-O'Farrill has some nice notes which cover this: http://www.maths.ed.ac.uk/~jmf/Teaching/Lectures/CoV.pdf
As we have two constraints, we introduce two Lagrange multipliers $\lambda$ and $\mu$, and attempt to extremize the functional $$S[f] = \int_0^1 \big( f(x)^2 + \lambda f(x) + \mu x f(x) \big) dx.$$ Let us denote the integrand by $$L\big(x,f(x),f'(x)\big) = f(x)^2 + \lambda f(x) + \mu x f(x).$$
The function $f$ which is a stationary point of the functional $S[f]$ satisfies the corresponding Euler-Lagrange equation, $$\frac{\partial L}{\partial f} = \frac{d}{dx} \frac{\partial L}{\partial f'}$$ which in this case reduces to $$2f(x) + \lambda + \mu x = 0.$$ So we see that the extremal $f(x)$ is indeed linear, and the values of $\lambda$ and $\mu$ can be obtained from the constraints $\int_0^1 f(x) dx = 0$ and $\int_0^1 xf(x) dx = 1$.