# Inequalities in probability theory

I got stuck while solving this problem. First of all, i tried to prove directly from definition, but this doesnt led anywhere. Perhaps Jensen inequality may help? But we dont have convexity of f or of g. Any ideas on how we can tackle this problem?

Let $$X$$ and $$Y$$ be iid, then we have

$$E[(f(X)-f(Y))(g(X)-g(Y))] \ge 0$$

$$E[f(X)g(X)+f(Y)g(Y)-f(Y)g(X)-f(X)g(Y)] \ge 0$$

$$E[f(X)g(X)]+E[f(Y)g(Y)]-E[f(Y)g(X)]-E[f(X)g(Y)] \ge 0$$

By independence,

$$E[f(X)g(X)]+E[f(Y)g(Y)]-E[f(Y)]E[g(X)]-E[f(X)]E[g(Y)] \ge 0$$

Since $$X$$ and $$Y$$ are identically distributed

$$E[f(X)g(X)]+E[f(X)g(X)]-E[f(X)]E[g(X)]-E[f(X)]E[g(X)] \ge 0$$

$$2E[f(X)g(X)]-2E[f(X)]E[g(X)] \ge 0$$

$$E[f(X)g(X)] \ge E[f(X)]E[g(X)]$$

For every real number $$x$$, $$(f(X)-f(x))(g(X)-g(x)) \geq 0$$, thus $$\mathbb{E}[f(X)g(X)] + f(x)g(x) \geq f(x)\mathbb{E}[g(X)] + g(x)\mathbb{E}[f(x)$$.

Then integrate wrt $$dP_X$$.