# Suppose $g\geq0$ and $E[g(X)] = 0$. Then $P(g(X)>0) = 0$. Hence $g(X) = 0$ a.s.

$$\textbf{Motivation: }$$ I was thinking about what happens when $$\text{Var}(X)= 0$$. It is known that this happens if and only if $$X=a$$ for some constant $$a$$. The proof in one direction (assuming $$X=a$$) is trivial. To do the other I found some argument, which basically boils down to the proposition below. Problem is that I don't know if the proposition is correct, and I don't know whether my proof for it is correct.

So the question is whether the following is sound:

$$\textbf{Proposition: }$$Suppose $$g\geq0$$ and $$E[g(X)] = 0$$. Then $$P(g(X)>0) = 0$$. Hence $$g(X) = 0$$ a.s.

$$\textbf{Proof: }$$ Suppose $$g\geq0$$ and $$E[g(X)] = 0$$ but now suppose $$P(g(X)>0)\neq 0$$. Hence $$g(X)$$ is non-zero somewhere with non-zero probability. Suppose it is non-zero on some $$A\subseteq \mathbb{R}$$. Then $$0=E[g(X)] = \int_\mathbb{R}g(X)dF(x) = \int_Ag(X)dF(x).$$ Since $$g>0$$ on $$A$$ this is a contradiction.

$$\textbf{Application: }$$ Now take $$g(X) = (X-E(X))^2$$. Then $$E[g(X)] = 0$$ implies $$X = E(X)$$ almost everywhere since $$P(X-E(X) = 0) = 1$$.

• Do note: I have not done measure theory yet (beside when talking about Lebesgue integration), and I strongly suspect this has something more to do with measure theory. Mar 5 '20 at 15:35
• Looks right to me. I don't know any measure theory either, but I don't think you need that much machinery. Mar 5 '20 at 15:50
• It feels like Markov's inequality could be relevant here: if $Z$ is a nonnegative RV, then for some $a >0$, $Pr(Z\geq a) \leq E[Z]/a$. So what if you take $Z = g(X) + \sqrt{a}$, and look at the limit as $a\to 0$? (Also your proof looks right, but I'm also terrified of measure theory, so thinking of an alternative...) Mar 5 '20 at 15:54
• The Proposition is correct but the formulation is unnecessarily cumbersome in my opinion. This formulation might be a little bit better: „Let $Y$ be a random variable that is non-negative almost everywhere and $\mathsf E(Y)=0$. Then $Y=0$ almost everywhere.“ Mar 5 '20 at 16:52
• If $g$ is non-zero on some $A\subseteq \mathbb R$, it cannot contradicts to $\mathbb Eg(X)=0$. Say, $g(x)=x^2\mathbb 1_{x\leq 0}$ is positive on whole halfline and for $X=3$ a.s. $\mathbb E[g(X)]=0$. None contradiction arises.
– NCh
Mar 5 '20 at 17:35