Determine whether the following integral inequality holds Suppose that $\int_0^1 f dx = 0$. Is it true that
$$\left( \int_0^1 fg dx \right)^2 \leq \left( \int_0^1 g^2 dx - \left( \int_0^1 g dx \right)^2 \right) \left( \int_0^1 f^2 dx \right)$$
For context, this was stated as a true or false question on an old qualifying exam. I've tried noting that
$$ \int_0^1 fg dx  = \int_0^1 f (g-1) dx$$
Then, employing Cauchy-Schwarz gives
$$\left( \int_0^1 f g dx \right)^2 \leq \left( \int_0^1 g^2 dx - 2 \int_0^1 g dx +1 \right) \left( \int_0^1 f^2 dx \right)$$
From here, I thought I had it, since we have that $-2 \int_0^1 g dx + 1 \geq -\left( \int_0^1 g dx \right)^2$, but of course the inequality is going in the wrong direction. I tried to build some counterexamples, but everything I've tried has shown the inequality to be true. Any help is appreciated!
 A: This is true. If $\int_0^1g(x)dx=0$, this is just Cauchy-Schwarz. Now note that neither side changes if you shift $g$ by a constant. 
A: This is actually true. Consider the original work done in the answer, and assume without loss of generality that $||g||_2 = ||f||_2 = 1$ (this denotes $L^2$-norm). Then, we get
$$||f g||_1^2 \leq 2 - 2 ||g||_2$$
Consider now the transformation $f \mapsto c \cdot f$, $g \mapsto \frac{g}{c}$. Note that this leaves the left hand side invariant, however, the right hand side changes as
$$||f g ||_1^2 \leq c^2 - 2 c ||g||_2 + 1$$
For all $c$. Now, optimize in $c$; taking the derivative with respect to $c$ and setting equal to $0$ yields
$$c = ||g||_2$$
Plugging back in, we see
$$||fg||_1^2 \leq ||g||_2^2 - 2 ||g||_2 \cdot ||g||_2 + 1 = 1 - ||g||_2^2$$
Which is precisely the inequality we wanted to prove.
A: If probabilistic arguments are employed, we can simplify the arguments without writing integrals.
Suppose $X\sim U[0,1]$.  We rewrite the given inequality in terms of expected values:
$$E[f(X)g(X)]^2 \le var[g(X)]E[f(X)^2].$$
As @Jason points out, shifting $g$ by a constant doesn't affect the inequality (since $E[f(X)]=0$, so $E[f(X)(g(X)+k)]=E[f(X)g(X)+kf(X)]=E[f(X)g(X)]$), so the given inequality holds if and only if
$$E[f(X)(g(X)-k)]^2 \le var[g(X)-k]E[f(X)^2].$$
To apply the Cauchy-Schwartz inequality, we take $k=E[g(X)]$, so that $var[g(X)-k]=E[(g(X)-k)^2]$.  Then it's equivalent to
$$E[f(X)(g(X)-E[g(X)])]^2 \le E[(g(X)-E[g(X)])^2]E[f(X)^2].$$
This is the Cauchy-Schwartz inequality which holds for any random variables.
