# expectation with indicator functions

I came across this inequality and I could not understand how they found it:

$$(E[X \mathbb{1_{X>0}}])^2 < E[X^2]P(X>0)$$

Can you explain the necessary steps?

-

It's the Cauchy-Schwarz inequality. $$(E[X \mathbb{1_{X>0}}])^{2} \leq E[X^{2}]\, E[\mathbb{1^2_{X>0}}]=E[X^{2}]\, E[\mathbb{1_{X>0}}]=E[X^{2}]\,P(X>0).$$