TITLE: Value of $I=\inf_{f\in S} \int_0^1 f(x)^2 \, \text{d}x$
QUESTION [5 upvotes]: I was asked the following question

Consider the set
$$S=\left\{f:[0,1]\to \mathbb R : f \text{ is continuous}, \int_0^1 f(x)\,\text{d}x=5, \int_0^1 xf(x) \, \text{d}x=3\right\}$$
Let
$$I=\inf_{f\in S} \int_0^1 f(x)^2 \,\text{d}x$$
Find the value of $I$.

I can understand that we need an inequality (or an equality) involving the terms $\int_0^1 f(x) \, \text{d}x=5$, $\int_0^1 xf(x)\,\text{d}x=3$ and $\int_0^1 f(x)^2 \,\text{d}x$. But I don't have any idea of where to start or how to proceed. I guess, first we need to find a relation between $\left(\int_0^1 f(x) \, \text{d}x\right)^2$ and $\int_0^1 f(x)^2 \,\text{d}x$, but still, it's not clear to me how to proceed.
Any help would be appreciated.

REPLY [11 votes]: Here is an approach using linear algebra. Consider the inner product $\langle \cdot,\cdot \rangle:C([0,1])\times C([0,1])\to \mathbb{R}$ by
$$\langle f,g\rangle=\int_0^1 f(x)g(x)~dx.$$
Now consider the subspace $W:=\operatorname{span}\{1,x\}$ of $C([0,1])$. By the Gram-Schmidt process, one finds the orthonormal basis $\{e_1,e_2\}$ for $W$ with
$$e_1(x)=1,\quad e_2(x)=2\sqrt{3}(x-1/2).$$
The orthogonal projection $P_W$ onto $W$ is then given by
$$(P_W f)(x)=\sum_{i=1}^2 \langle f,e_i\rangle e_i(x)=6x+2,$$
where we have used that $\langle f,e_1\rangle=5$ and $\langle f,e_2\rangle=\sqrt{3}$ (note the integrals that $f\in S$ must satisfy). It is well-known for orthogonal projections that we have $\|P_W f\|\leq \|f\|$ for all $f\in C([0,1])$, hence it follows from the fact that $\|P_W f\|^2=\int_0^1 (6x+2)^2~dx=28$ that $\|f\|^2\geq 28$ for all $f\in S$. Hence we have that $I=28$, where the infimum is attained at $f(x)=6x+2$.