Variance and Standard Deviation of a Random Variable
We have already looked at Variance and Standard deviation as measures of
dispersion under the section on
Averages. We can also measure the dispersion of Random variables across
a given distribution using Variance and Standard deviation. This allows us to better
understand whatever the distribution represents.
The Variance of a random variable X is also denoted by σ;^{2}
but when sometimes can be written as Var(X).
Variance of a random variable can be defined as the expected value of the square
of the difference between the random variable and the mean.
Given that the random variable X has a mean of μ, then the variance
is expressed as:
In the previous section on
Expected value of a random variable, we saw that the method/formula for
calculating the expected value varied depending on whether the random variable was
discrete or continuous. As a consequence, we have two different methods for calculating
the variance of a random variable depending on whether the random variable is discrete
or continuous.

For a Discrete random variable, the variance σ^{2} is
calculated as: 
For a Continuous random variable, the variance σ^{2}
is calculated as:
In both cases f(x) is the probability density function.
The Standard Deviation σ in both cases can be found by taking
the square root of the variance.
Example 1
A software engineering company tested a new product of theirs and found that the
number of errors per 100 CDs of the new software had the following probability distribution:
x  f(x) 

2  0.01 
3  0.25 
4  0.4 
5  0.3 
6  0.04 
Find the Variance of X
Solution
The probability distribution given is discrete and so we can find the variance from
the following:
We need to find the mean μ first:
Then we find the variance:
Example 2
Find the Standard Deviation of a random variable X whose probability density function
is given by f(x) where:
Solution
Since the random variable X is continuous, we use the following formula to calculate
the variance:
First we find the mean μ
Then we find the variance as:
Simplifying the Variance formula
We have seen that variance of a random variable is given by:
We can attempt to simplify this formula by expanding the quadratic in the formula
above as follows:
We shall see in the next section that the expected value of a linear combination
behaves as follows:
Substituting the expanded form into the variance equation:
Remember that after you’ve calculated the mean μ, the result is a constant
and the expected value of a constant is that same constant.
This simplifies the formula as shown below:
but
which means that;
The above is a simplified formula for calculating the variance.
We can also derive the above for a discrete random variable as follows:
but since the total probability is 1
and
Therefore,
where by;
Hence
For a continuous random variable:
whereby
which means that
Variance of an Arbitrary function of a random variable g(X)
Consider an arbitrary function g(X), we saw that the expected value of this function
is given by:

For a discrete case

For a continuous case
The variance of this functiong(X) is denoted as σ_{g(X)}
and can be found as follows:

For X is a discrete random variable

For X is a continuous random variable
Covariance
In the section on
probability distributions, we saw that at times we might have to deal with
more than one random variable at a time, hence the need to study Joint Probability
Distributions.
Just as we can find the Expected value of a joint pair of random variables X
and Y, we can also find the variance and this is what we refer to as the
Covariance.
The Covariance of a joint pair of random variables X and Y is denoted
by:
Cov(X,Y).