
> 
> 
> > 
> > I am trying to prove the following statement:
> >  $$
> > E[g(X)] E[X^2g(X)]\ge E[Xg(X)] E[Xg(X)]
> > $$
> >  where $X$ is a random variable, $E[\cdot]$ denotes the expectation operator with respect to $X$, and $g(\cdot)$ is a well-behaved,positive-valued, bounded function.
> > 
> > 
> > 
> 
> 
> 


For $X$ being discrete, I have both the intuition and the proof. For simplicity, assume $X$ takes only two values $x\_1$ and $x\_2$, with respective probabilities $p\_1$ and $p\_2$. Further, let $g(x\_1)=g\_1$ and $g(x\_2)=g\_2$. Then,
the left hand side of the above inequality is given as 
\begin{align}
E[g(X)] E[X^2g(X)]&=[g\_1p\_1+g\_2p\_2]\times[{x\_1}^2g\_1p\_1+{x\_2}^2g\_2p\_2] \\
&=x\_1^2g\_1^2p\_1^2+x\_2^2g\_1g\_2p\_1p\_2+x\_1^2g\_1g\_2p\_1p\_2+x\_2^2g\_2^2p\_2^2.
\end{align}
Similarly, the right hand side is given as
\begin{align}
E[Xg(X)] E[Xg(X)]&=[x\_1g\_1p\_1+x\_2g\_2p\_2]\times[x\_1g\_1p\_1+x\_2g\_2p\_2] \\
&=x\_1^2g\_1^2p\_1^2+2x\_1x\_2g\_1g\_2p\_1p\_2+x\_2^2g\_2^2p\_2^2.
\end{align}
So the difference between these two expressions is
$$
E[g(X)] E[X^2g(X)] - E[Xg(X)] E[Xg(X)] = (x\_1-x\_2)^2g\_1g\_2p\_1p\_2\ge0,
$$
which implies that the given inequality is correct. This procedure can be applied to the case where $X$ admits $n$ discrete data points instead of just two.



> 
> 
> > 
> > My question is how to prove the same relationship for continuous random variables, i.e., show that
> >  $$
> > \int g(x)f(x)dx \int x^2 g(x) f(x) dx \ge \int x g(x) f(x) dx \int x g(x) f(x) dx
> > $$
> >  where, $f(\cdot)$ is the probability density function of $X$ and $g(\cdot)\ge0$.
> > 
> > 
> > 
> 
> 
> 



An inequality based on expectation of continuous random variables
Converting Yemon Choi's comment to an answer:


If $E[X g(X)] \le 0$, we are done because the left side of your proposed inequality is nonnegative. So assume $E[X g(X)] \ge 0$.


First, by the triangle inequality we have $$E[X g(X)] \le E [|X| g(X)].\tag{1}$$


The Cauchy-Schwarz inequality says that for any random variables $Y,Z$ we have $$E[|YZ|] \le \sqrt{E[Y^2]\, E[Z^2]}.$$
Applying this with $Y = \sqrt{g(X)}$, $Z = X \sqrt{g(X)}$ we obtain
$$E[|X| g(X)] \le \sqrt{E[g(X)] \,E[X^2 g(X)]}. \tag{2}$$
Now combine (1) with (2) and square both sides.


