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