Note that EX=EY=0. Although both random variables have the same mean value, their distribution
is completely different. Y is always equal to its mean of $0$, while X is either $100$ or −100,
quite far from its mean value. The variance is a measure of how spread out the distribution of
a random variable is. Here, the variance of Y is quite small since its distribution is concentrated at
a single value, while the variance of X will be larger since its distribution is more spread out.
The variance of a random variable X, with mean EX=μX, is defined as
Var(X)=E[(X−μX)2].
By definition, the variance of X is the average value of (X−μX)2. Since (X−μX)2≥0,
the variance is always larger than or equal to zero. A large value of the variance means that (X−μX)2
is often large, so X often takes values far from its mean. This means that the distribution is very
spread out. On the other hand, a low variance means that the distribution is concentrated around its average.
Note that if we did not square the difference between X and its mean, the result would be $0$. That is
E[X−μX]=EX−E[μX]=μX−μX=0.
X is sometimes below its average and sometimes above its average. Thus, X−μX is sometimes
negative and sometimes positive, but on average it is zero.
To compute Var(X)=E[(X−μX)2], note that we need to find the expected value of g(X)=(X−μX)2,
so we can use LOTUS. In particular, we can write
Var(X)=E[(X−μX)2]=xk∈RX∑(xk−μX)2PX(xk).
For example, for X and Y defined in Equations 3.3 and 3.4, we have
Var(X)=(−100−0)2(0.5)+(100−0)2(0.5)=10,000
Var(Y)=(0−0)2(1)=0.
As we expect, X has a very large variance while Var(Y)=0.
Note that Var(X) has a different unit than X. For example, if X is measured in meters then
Var(X) is in meters2. To solve this issue, we define another measure, called the standard deviation,
usually shown as σX, which is simply the square root of variance.
The standard deviation of a random variable X is defined as
SD(X)=σX=Var(X).
The standard deviation of X has the same unit as X. For X and Y defined in Equations 3.3 and 3.4,
we have
σX
=10,000=100
σY
=0=0.
Here is a useful formula for computing the variance.
Computational formula for the variance:
Var(X)=E[X2]−[EX]2(3.5)
To prove it note that
\begin{align}%\label{}
\nonumber \textrm{Var}(X) &= E\big[ (X-\mu_X)^2\big]\
\nonumber &= E \big[ X^2-2 \mu_X X + \mu_X^2 \big]\
\nonumber &= E\big[X^2\big]-2E\big[\mu_X X\big]+E\big[\mu_X^2\big] &\textrm{ by linearity of expectation.}
\end{align}
Note that for a given random variable X, μX is just a constant real number. Thus,
E[μXX]=μXE[X]=μX2, and E[μX2]=μX2, so we have
From Equation 3.6, we conclude that, for standard deviation, SD(aX+b)=∣a∣SD(X). We
mentioned that variance is NOT a linear operation. But there is a very important case, in which
variance behaves like a linear operation and that is when we look at sum of independent random variables.
Theorem
If X1,X2,⋯,Xn are independent random variables and X=X1+X2+⋯+Xn, then
Var(X)=Var(X1)+Var(X2)+⋯+Var(Xn)(3.7)
We will prove this theorem in Chapter 6, but for now we can look at an example to see how we can use it.
Example
If X∼Binomial(n,p) find Var(X).
Solution
We know that we can write a Binomial(n,p) random variable as the sum of nindependentBernoulli(p) random variables, i.e., X=X1+X2+⋯+Xn. Thus, we conclude