In this explainer, we will learn how to calculate the variance of discrete random variables.

In order to find the variance of a discrete random variable, it is helpful to
recall what a **discrete random variable** is.

### Definition: Discrete Random Variable

A **discrete random variable** is a variable that can only assume a
countable number of numerical values. The value that the variable takes on is
determined by the outcome of a random phenomenon or experiment. Such a variable is often denoted by an upper case , with the value that
the variable takes on denoted by a lower case .

In order to represent a **discrete random variable**, we can use a **probability
distribution function**. This is a function that maps the values of the discrete
random variable to their associated probabilities.

### Definition: Probability Distribution Function

A **probability distribution function** is a function that generates
probabilities of value
given an outcome of value and must hold the
following properties:

- for all values of the random variable can take,
- each value of must lie in the interval .

We can represent a probability distribution function in many ways, including a table, in the form or as a formula that relates and .

### Definition: Variance of a Discrete Random Variable

The **variance** of a discrete random variable is the measure of the extent to
which the values of the variable differ from the expected value . We denote this as
where is the standard deviation of the distribution.

This can be found using the following formula: where is the expected value of and represents all the values can take.

The formula for the variance of can be expanded to give where and .

When calculating the variance of a discrete random variable, it is easier to use the form ; however, with the next example, we will use both this version and the form to demonstrate how to apply them.

### Example 1: Finding the Variance of a Discrete Random Variable from a Table

The function in the given table is a probability function of a discrete random variable . Find the variance of . If necessary, give your answer to two decimal places.

3 | 5 | 7 | 8 | |

### Answer

First, we need to find the value of in the table. Recall that for a discrete random variable, . Therefore, we can use this fact to find the value of :

As each value of must lie in the interval , we need to check which value or values of are valid solutions.

If , then by substituting into the expression for we get the following.

3 | 5 | 7 | 8 | |

We can see that each value of lies in the interval ; therefore, is a valid solution.

If , then by substituting into the expression for we get the following.

3 | 5 | 7 | 8 | |

We can see that at least one of the values of does not lie in the interval ; therefore, is not a valid solution.

Note that, in this case, none of the values were in the interval , but if at least one value is outside this interval, then it cannot be a valid probability distribution function.

Now, we will find the variance using the formula where and . We therefore use the values in the table to calculate . Note that refers to the value of corresponding to the value of .

3 | 5 | 7 | 8 | |

To calculate in this instance, it is helpful to calculate and separately first.

For ,

For ,

Then, we substitute and into the formula:

So, the variance is 4.16 correct to 2 decimal places.

In our previous example, we demonstrated how to find the variance using the formula . We will now see how using the alternative form will give us the same result.

We will use the value that we computed previously and then calculate and its square for each value of . It is helpful to add rows to the table to do this.

3 | 5 | 7 | 8 | |

We next calculate , the variance, noting that refers to the value of in the table:

So, the variance is 4.16 correct to 2 decimal places.

Note that although both the approach in the example and the approach here are valid, the approach in the example is the recommended one as there are fewer opportunities to make arithmetic errors.

The following example denotes the probability distribution function in the form for the discrete random variable . Again, we are required to find the variance; however, this time we will use only the formula to do this.

### Example 2: Finding the Variance of a Discrete Random Variable

Let denote a discrete random variable that can take the values 2, 3, 5, and 8. Given that , , , and , find the variance of . Give your answer to two decimal places.

### Answer

In order to calculate the variance of discrete random variable, we can use the formula

It is helpful to calculate and separately first when calculating .

For ,

For ,

Then, we substitute and into the formula:

So, the variance is 3.33 correct to 2 decimal places.

In the next example, we will find the variance of when given a probability distribution function in the form . The approach is similar to that of when is presented in a table or in the form , except that we need to generate the values of by evaluating the function for the given values of .

### Example 3: Finding the Variance of a Discrete Random Variable

Let denote a discrete random variable that can take the values , , , and 2. Given that has probability distribution function , find the variance of .

### Answer

First, as we have an unknown value , we need to calculate this. We know that for any probability distribution function, , so we can use this in order to determine the unknown value of .

In order to find an expression for , we need to substitute the values , , , and 2 for into .

When ,

When ,

When ,

When ,

So, to find , we form an equation using and solve for :

Next, we calculate using :

Now that we have found and the corresponding value of , we can calculate the variance of . We will use the formula to do this. Note that refers to the value of corresponding to the value of .

It is helpful to calculate and separately first when calculating .

For ,

For ,

Finally, we substitute and into the formula:

So, the variance is .

In the next example, we will find the variance of a discrete random variable in the form of a probability distribution function, where the coefficient of the function is unknown.

### Example 4: Finding the Variance of a Discrete Random Variable

Let denote a discrete random variable that can take the values 3, 4, and 5. Given that , find the variance of . If necessary, give your answer to two decimal places.

### Answer

First, we need to find a, the unknown coefficient in the probability distribution function . In order to do this, we use the fact that for to be a valid probability distribution function, then .

To find , we must first find for each value of , which in this case takes values 3, 4, and 5.

For ,

For ,

For ,

To find , we substitute into the formula :

Next, since we have found the value of , we can determine the probability distribution function by substituting :

So, for each value of , and 5 we have the following:

We can now find the variance of the discrete random variable. We do this using the formula . Note that refers to the value of corresponding to the value of .

It is helpful to calculate and separately first when calculating .

For ,

For ,

Finally, we substitute and into the formula:

So, the variance is 0.64 correct to 2 decimal places.

In this explainer, we have learned how to find the variance of a discrete random variable, as well as solve problems on finding the variance where there are unknown in the probability distribution function.

### Key Points

- The variance of a discrete random variable can be
found using one of the two following formulae:
- , where ,
- , where and .