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$?

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.


The integrals above can be interpreted using the $L^2$ inner product $$ \langle f,g\rangle \;=\; \int_0^1 f(x)\,g(x)\,dx. $$ Specifically, we are given that $\langle 1,f\rangle = 0$ and $\langle x,f\rangle =1 $, and we are asked to find the minimum possible value of $\langle f,f\rangle$.

Since components of $f$ orthogonal to both $1$ and $x$ will only increase the norm of $f$, the minimizing function must lie in the subspace spanned by $1$ and $x$. A simple calculation shows that the minimum is obtained when $f(x) = 12x - 6$, in which case $\langle f,f\rangle = 12$.


Yes, it is true.

Consider the Hilbert space $L^2([0,1])$ of square integrable functions $f\colon[0,1]\to\mathbb{R}$ with inner product $\langle f,g\rangle = \int_0^1 f(x)g(x)\,dx$. Letting $V$ be two dimensional subspace generated by $u(x)=1$ and $v(x)=x$, then the function $g(x)=12(x-1/2)$ is in $V$ and satisfies $\langle g,u\rangle=0$ and $\langle g,v\rangle=1$. So, your question is equivalent to choosing $f$ to minimize $\langle f,f\rangle$ subject to $\langle f,h\rangle=\langle g,h\rangle$ for all $h\in V$. This condition is just saying that $g$ is the orthogonal projection of $f$ onto $V$.

So, any $f\in L^2$ satisfying the condition can be written as $$ f = g + h $$ where $h$ is in the orthogonal complement of $V$ and, therefore, $$ \langle f,f\rangle = \langle g,g\rangle+\langle h,h\rangle\ge \langle g,g\rangle=12 $$ with equality if and only if $f=g$ almost everywhere.


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$.