What is the mathematical formula for calculating the variance of a discrete random variable?

1 Answer
Oct 24, 2015

Let #mu_{X}=E[X]=sum_{i=1}^{infty}x_{i} * p_{i}# be the mean (expected value) of a discrete random variable #X# that can take on values #x_{1},x_{2},x_{3},...# with probabilities #P(X=x_{i})=p_{i}# (these lists may be finite or infinite and the sum may be finite or infinite). The variance is #sigma_{X}^{2}=E[(X-mu_{X})^2]=sum_{i=1}^{infty}(x_{i}-mu_{X})^2 * p_{i}#

Explanation:

The previous paragraph is the definition of the variance #sigma_{X}^{2}#. The following bit of algebra, using the linearity of the expected value operator #E#, shows an alternative formula for it, which is often easier to use.

#sigma_{X}^{2}=E[(X-mu_{X})^2]=E[X^2-2mu_{X}X+mu_{X}^{2}]#

#=E[X^2]-2mu_{X}E[X]+mu_{X}^{2}=E[X^2]-2mu_{X}^{2}+mu_{X}^{2}#

#=E[X^2]-mu_{X}^{2}=E[X^{2}]-(E[X])^2#,

where #E[X^{2}]=sum_{i=1}^{infty}x_{i}^{2} * p_{i}#