# If $Var(X)=0$ then is $X$ a constant?

We know that the variance of a constant is $0$. Is the converse also true? Can we say that if the variance of some random variable is $0$ it is a constant?

• If "the variance of some random variable is 0" then it is almost surely constant. $\;$ – user57159 Oct 25 '14 at 6:08
• @RickyDemer So in other words there can be no non constant variable with 0 variance? – Heisenberg Oct 25 '14 at 6:11
• "almost surely constant" $\: \neq \:$ "constant" $\;$, $\;$ although in most cases the difference does not matter. $\hspace{.64 in}$ – user57159 Oct 25 '14 at 6:17
• Possible duplicate of Zero variance Random variables – Jack Nov 28 '16 at 22:53

If $\text{Var }X = 0$:

First, as $\text{Var }X < \infty$, both $E[X]$ and $E[X^2]$ exist.

$$E[(X-E[X])^2] = 0$$ and as $(X-E[X])^2 \ge 0$ this implies $P((X-E[X])^2 \neq 0) = 0$. In other words, $$X = E[X] \text{ a.s.}$$

Alternative:

one always has

$$E[X^2] \ge E[X]^2$$ because of the Cauchy-Schwarz inequality (with $X$ and $1$). If $$0 = \text{Var }X =E[X^2] - E[X]^2$$then using the equality case: $$\exists \lambda \ \ \ X = \lambda \times 1 \text{ a.s.}$$

• How can $(X−E[X])^2≥0$ imply $P((X−E[X])^2≠0)=0$? Since $(X−E[X])^2$ can be greater that 0 too – Heisenberg Oct 25 '14 at 11:48
• you also use $E((X - E[X])^2) = 0$ – mookid Oct 25 '14 at 12:16
• Ya but you have seems like you have ignored ">" and just focused on "=" – Heisenberg Oct 25 '14 at 12:18
• I thinks you did not understand my answer. – mookid Oct 25 '14 at 12:56
• @Heisenberg He's using the definition of the variance to demonstrate that $X=E[X], a.s.$ The variance must be non-negative. However, since the variance is zero, it also cannot be positive. This means that X cannot have a non-zero probability of being anything other than $E[X]$, because if it did, then the variance would no longer be zero (by the non-negativity of variance), as there would be some non-zero weight (its probability of being non zero) times a positive number (the epected distance of X from its mean, squared, given that its not equal to its mean) – user76844 Oct 27 '14 at 4:09

Let $f\geq 0$ be a measurable function on $X$ with $\int_X f = 0$. We claim that $f$ is zero a.e. Suppose that this is not the case. For each $\epsilon > 0$, the set $U_\epsilon = f^{-1}(\epsilon, \infty)$ is measurable. Since $f^{-1}(0, \infty) = \bigcup_{n=1}^\infty U_{1/n}$, some $U_\epsilon$ must have measure $\mu > 0$. Thus $\int_X f \geq \int_{U_\epsilon} f \geq \epsilon \mu > 0$.

Thus if $X$ is a random variable with variance $\operatorname{Var}(X) = E[(X - E[X])^2] =0$, then $X -E[X]$ must vanish almost surely.