4. Probability Distributions: Random Variables
Variance of a Random Variable
Definition
The variance of a random variable #X# is the average squared deviation from its expected value.
#\phantom{0}#
The standard deviation of #X# is the positive square root of the variance. A benefit of the standard deviation is that it is expressed in the same units of measurements as #X#.
Notation
\[\sigma^2\]
Alternatives: #\sigma_X^2# or #Var[X]#
\[\sigma\]
Alternatives: #\sigma_X# or #SD[X]#
Variance and Standard Deviation of a Discrete Random Variable
Let #X# be a discrete random variable with expected value #\mathbb{E}[X]#.
Then the variance of #X# is calculated as follows:
\[\sigma^2=\mathbb{E}[(X - \mathbb{E}[X])^2]\]
Which can be rewritten in a way that is easier to compute:
\[\sigma^2=\mathbb{E}[X^2] - (E[X])^2\]
To calculate the standard deviation, simply take the positive square root of the variance:
\[\sigma=\sqrt{\sigma^2}\]
Consider the following probability distribution of a discrete variable #X#:
#x# | #0# | #1# | #2# | #3# |
#\mathbb{P}(X=x)# | #0.3# | #0.2# | #0.4# | #0.1# |
Calculate the variance and standard deviation of #X#.
To calculate the variance of #X#, use the following formula:
\[\sigma^2=\mathbb{E}[X^2] - (E[X])^2\]
Calculate #\mathbb{E}[X]#:
\[\begin{array}{rcl}
\mathbb{E}[X]&=&\sum\limits_{\text{all }x\text{ in }R(X)}x\cdot f(x)\\
&=&0 \cdot \mathbb{P}(X=0) + 1 \cdot \mathbb{P}(X=1) +2 \cdot \mathbb{P}(X=2) +3 \cdot \mathbb{P}(X=3) \\
&=&0 \cdot 0.3 + 1 \cdot 0.2 + 2 \cdot 0.4 + 3 \cdot 0.1\\
&=& 1.3\\
\end{array}\]
Calculate #\mathbb{E}[X^2]#:
\[\begin{array}{rcl}
\mathbb{E}[X^2]&=&\sum\limits_{\text{all }x\text{ in }R(X)}x^2\cdot f(x)\\
&=&0^2 \cdot \mathbb{P}(X=0) + 1^2 \cdot \mathbb{P}(X=1) +2^2 \cdot \mathbb{P}(X=2) +3^2 \cdot \mathbb{P}(X=3) \\
&=&0^2 \cdot 0.3 + 1^2 \cdot 0.2 + 2^2 \cdot 0.4 + 3^2 \cdot 0.1\\
&=& 2.7\\
\end{array}\]
Calculate #\sigma^2#:
\[\begin{array}{rcl}
\sigma^2 &=& \mathbb{E}[X^2] - (E[X])^2\\
&=& 2.7 - 1.3^2\\
&=& 1.01
\end{array}\]
To calculate the standard deviation, take the positive square root of the variance:
\[\sigma = \sqrt{\sigma^2} = \sqrt{1.01} = 1.005\]
#\phantom{0}#
Variance and Standard Deviation of a Continuous Random Variable
The variance of a continuous random variable is computed using integral calculus and is beyond the scope of this course.