# Solved – Variance of a bounded random variable

measurement errorstandard deviationvariance

Suppose that a random variable has a lower and an upper bound [0,1]. How to compute the variance of such a variable?

You can prove Popoviciu's inequality as follows. Use the notation $$m=\inf X$$ and $$M=\sup X$$. Define a function $$g$$ by $$g(t)=\mathbb{E}\left[\left(X-t\right)^2\right] \, .$$ Computing the derivative $$g'$$, and solving $$g'(t) = -2\mathbb{E}[X] +2t=0 \, ,$$ we find that $$g$$ achieves its minimum at $$t=\mathbb{E}[X]$$ (note that $$g''>0$$).
Now, consider the value of the function $$g$$ at the special point $$t=\frac{M+m}{2}$$. It must be the case that $$\mathbb{Var}[X]=g(\mathbb{E}[X])\leq g\left(\frac{M+m}{2}\right) \, .$$ But $$g\left(\frac{M+m}{2}\right) = \mathbb{E}\left[\left(X - \frac{M+m}{2}\right)^2 \right] = \frac{1}{4}\mathbb{E}\left[\left((X-m) + (X-M)\right)^2 \right] \, .$$ Since $$X-m\geq 0$$ and $$X-M\leq 0$$, we have $$\left((X-m)+(X-M)\right)^2\leq\left((X-m)-(X-M)\right)^2=\left(M-m\right)^2 \, ,$$ implying that $$\frac{1}{4}\mathbb{E}\left[\left((X-m) + (X-M)\right)^2 \right] \leq \frac{1}{4}\mathbb{E}\left[\left((X-m) - (X-M)\right)^2 \right] = \frac{(M-m)^2}{4} \, .$$ Therefore, we proved Popoviciu's inequality $$\mathbb{Var}[X]\leq \frac{(M-m)^2}{4} \, .$$