Integral inequality involving $f(x),\, x\,f(x),\, f(x)^2$ Let $f\colon[-1,1]\to\mathbb{R}$ be a continuous function. Prove that
$$
2\int_{-1}^{1}f(x)^2\: dx
-
\left(\int_{-1}^{1}f(x)\: dx\right)^2
\ge
3\,\left(\,\int\limits_{-1}^{1}x\,f(x)\: dx\right)^2
$$

I found something similar:
Integral Inequality $\int\limits_0^1f^2(x)dx\geq12\left( \int\limits_0^1xf(x)dx\right)^2.$
but don't know if estimation of that sort can be applied here.
 A: It is useful to exploit the fact that Legendre polynomials give a complete orthogonal base of $L^2(-1,1)$ with the usual inner product. Given:
$$ f(x) = \sum_{n\geq 0} a_n P_n(x) \tag{1}$$
we have:
$$ \begin{array}{llcl}\text{(Parseval's identity)}&\displaystyle\int_{-1}^{1}f(x)^2\,dx &=& \displaystyle2\sum_{n\geq 0}\frac{a_n^2}{2n+1},\\
 (P_0(x)=1)&\displaystyle\int_{-1}^{1} f(x)\,dx &=& \displaystyle2a_0,\tag{2}\\(P_1(x)=x)&
 \displaystyle\int_{-1}^{1} x\,f(x)\,dx &=& \displaystyle\frac{2}{3}a_1\end{array}$$
hence the original inequality is equivalent to:
$$ 4\sum_{n\geq 0}\frac{a_n^2}{2n+1}-4a_0^2\geq \frac{4}{3}a_1^2 \tag{3} $$
or to:

$$ \sum_{n\geq 2}\frac{a_n^2}{2n+1}\geq 0 \tag{4}$$

that is trivial. We also have that equality is attained only by linear functions, $f(x)=a+bx$.
A: Let $\displaystyle\;\bar{f} = \frac12\int_{-1}^1 f(x) dx\;$ and $g(x) = f(x) - \bar{f}$.
It is easy to check
$$\int_{-1}^1 g(x) dx = 0
\quad\text{ and }\quad
\int_{-1}^1 x g(x) dx = \int_{-1}^1 xf(x) dx
$$
The LHS of inequality at hand can be rewritten as
$$\verb/LHS/
= 2\int_{-1}^1 (g(x) + \bar{f})^2 dx - 4\bar{f}^2
= 2\int_{-1}^1 g(x)^2 dx
= 3\left(\int_{-1}^1 x^2 dx\right)\left(\int_{-1}^1 g(x)^2 dx\right)
$$
Apply Cauchy Schwarz to $x$ and $g(x)$ over $[-1,1]$, we find
$$\verb/LHS/ \ge 3 \left(\int_{-1}^1 xg(x)\right)^2
= 3 \left(\int_{-1}^1 xf(x) dx\right)^2
= \verb/RHS/
$$
