Lesson Explainer: Variance of Discrete Random Variables | Nagwa Lesson Explainer: Variance of Discrete Random Variables | Nagwa

Lesson Explainer: Variance of Discrete Random Variables Mathematics • Third Year of Secondary School

Join Nagwa Classes

Attend live Mathematics sessions on Nagwa Classes to learn more about this topic from an expert teacher!

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:

  • 𝑓(𝑥)=1 for all values of 𝑥 the random variable can take,
  • each value of 𝑓(𝑥) must lie in the interval [0,1].

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 Var(𝑋)=𝜎, where 𝜎 is the standard deviation of the distribution.

This can be found using the following formula: Var(𝑋)=𝐸(𝑋𝜇), where 𝜇=𝐸(𝑋)=(𝑥×𝑃(𝑋=𝑥)) is the expected value of 𝑋 and 𝑥 represents all the values 𝑋 can take.

The formula for the variance of 𝑋 can be expanded to give VarsincesinceVar(𝑋)=𝐸(𝑋𝜇)=𝐸𝑋2𝑋𝜇+𝜇=𝐸𝑋2𝑋×𝐸(𝑋)+𝐸(𝑋)(𝜇=𝐸(𝑋))=𝐸𝑋𝐸[2𝑋×𝐸(𝑋)]+𝐸𝐸(𝑋)=𝐸𝑋2𝐸(𝑋)×𝐸(𝑋)+𝐸(𝑋)(𝐸[𝐸(𝑋)]=𝐸(𝑋))=𝐸𝑋2𝐸(𝑋)+𝐸(𝑋)(𝑋)=𝐸𝑋𝐸(𝑋), where 𝐸𝑋=𝑥×𝑃(𝑋=𝑥) and 𝐸(𝑋)=(𝑥×𝑃(𝑋=𝑥)).

When calculating the variance of a discrete random variable, it is easier to use the form Var(𝑋)=𝐸𝑋𝐸(𝑋); however, with the next example, we will use both this version and the form Var(𝑋)=𝐸(𝑋𝜇) 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.

𝑥3578
𝑓(𝑥)2𝐴5𝐴5𝐴𝐴

Answer

First, we need to find the value of 𝐴 in the table. Recall that for a discrete random variable, 𝑓(𝑥)=1. Therefore, we can use this fact to find the value of 𝐴: 2𝐴+5𝐴+5𝐴+𝐴=110𝐴+3𝐴1=0(5𝐴1)(2𝐴+1)=05𝐴1=02𝐴+1=05𝐴=12𝐴=1𝐴=15𝐴=12.ororor

As each value of 𝑓(𝑥) must lie in the interval [0,1], we need to check which value or values of 𝐴 are valid solutions.

If 𝐴=15, then by substituting into the expression for 𝑓(𝑥) we get the following.

𝑥3578
𝑓(𝑥)2×15=255×15=525=155×15=525=1515

We can see that each value of 𝑓(𝑥) lies in the interval [0,1]; therefore, 𝐴=15 is a valid solution.

If 𝐴=12, then by substituting into the expression for 𝑓(𝑥) we get the following.

𝑥3578
𝑓(𝑥)2×12=15×12=545×12=5412

We can see that at least one of the values of 𝑓(𝑥) does not lie in the interval [0,1]; therefore, 𝐴=12 is not a valid solution.

Note that, in this case, none of the values were in the interval [0,1], 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 Var(𝑋)=𝐸𝑋𝐸(𝑋), where 𝐸𝑋=𝑥×𝑃(𝑋=𝑥) and 𝐸(𝑋)=(𝑥×𝑃(𝑋=𝑥)). We therefore use the values in the table to calculate Var(𝑋). Note that 𝑃(𝑋=𝑥) refers to the value of 𝑓(𝑥) corresponding to the value of 𝑥.

𝑥3578
𝑓(𝑥)25151515

To calculate Var(𝑋) in this instance, it is helpful to calculate 𝐸(𝑋) and 𝐸𝑋 separately first.

For 𝐸(𝑋), 𝐸(𝑋)=(𝑥×𝑃(𝑋=𝑥))=3×25+5×15+7×15+8×15=65+55+75+85=265.

For 𝐸𝑋, 𝐸𝑋=𝑥×𝑃(𝑋=𝑥)=9×25+25×15+49×15+64×15=185+255+495+645=1565.

Then, we substitute 𝐸(𝑋) and 𝐸𝑋 into the formula: Var(𝑋)=𝐸𝑋𝐸(𝑋)=1565265=156567625=4.16.

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 Var(𝑋)=𝐸𝑋𝐸(𝑋). We will now see how using the alternative form Var(𝑋)=𝐸(𝑋𝜇) will give us the same result.

We will use the value 𝐸(𝑋)=265 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.

𝑥3578
𝑓(𝑥)25151515
𝑋𝜇3265=1155265=157265=958265=145
(𝑋𝜇)12125125812519625

We next calculate 𝐸(𝑋𝜇), the variance, noting that 𝑃(𝑋=𝑥) refers to the value of 𝑓(𝑥) in the table: Var(𝑋)=𝐸(𝑋𝜇)=(𝑋𝜇)×𝑃(𝑋=𝑥)=12125×25+125×15+8125×15+19625×15=242125+1125+81125+196125=4.16.

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 Var(𝑋)=𝐸𝑋𝐸(𝑋) 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 𝑃(𝑋=2)=124, 𝑃(𝑋=3)=512, 𝑃(𝑋=5)=38, and 𝑃(𝑋=8)=16, 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 Var(𝑋)=𝐸𝑋𝐸(𝑋).

It is helpful to calculate 𝐸(𝑋) and 𝐸𝑋 separately first when calculating Var(𝑋).

For 𝐸(𝑋), 𝐸(𝑋)=(𝑥×𝑃(𝑋=𝑥))=2×124+3×512+5×38+8×16=224+1512+158+86=10924.

For 𝐸𝑋, 𝐸𝑋=𝑥×𝑃(𝑋=𝑥)=2×124+3×512+5×38+8×16=424+4512+758+646=57524.

Then, we substitute 𝐸(𝑋) and 𝐸𝑋 into the formula: Varcorrectto2decimalplaces(𝑋)=𝐸𝑋𝐸(𝑋)=5752410924=1919576=3.33.

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 2, 1, 𝑀, and 2. Given that 𝑋 has probability distribution function 𝑓(𝑥)=𝑥+416, 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, 𝑓(𝑥)=1, 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 2, 1, 𝑀, and 2 for 𝑥 into 𝑓(𝑥).

When 𝑥=2, 𝑓(2)=2+416=216.

When 𝑥=1, 𝑓(1)=1+416=316.

When 𝑥=𝑀, 𝑓(𝑀)=𝑀+416.

When 𝑥=2, 𝑓(2)=2+416=616.

So, to find 𝑀, we form an equation using 𝑓(𝑥)=1 and solve for 𝑀: 𝑓(𝑥)=𝑓(2)+𝑓(1)+𝑓(𝑀)+𝑓(2)=1216+316+𝑀+416+616=12+3+𝑀+4+616=1𝑀+1516=1𝑀+15=16𝑀=1.

Next, we calculate 𝑓(𝑀) using 𝑀=1: 𝑓(1)=1+416=516.

Now that we have found 𝑀=1 and the corresponding value of 𝑓(𝑀), we can calculate the variance of 𝑋. We will use the formula Var(𝑋)=𝐸𝑋𝐸(𝑋) 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 Var(𝑋).

For 𝐸(𝑋), 𝐸(𝑋)=(𝑥×𝑃(𝑋=𝑥))=2×216+1×316+1×516+2×616=416316+516+1216=1016=58.

For 𝐸𝑋, 𝐸𝑋=𝑥×𝑃(𝑋=𝑥)=(2)×216+(1)×316+1×516+2×616=816+316+516+2416=4016=52.

Finally, we substitute 𝐸(𝑋) and 𝐸𝑋 into the formula: Var(𝑋)=𝐸𝑋𝐸(𝑋)=5258=13564.

So, the variance is 13564.

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 𝑓(𝑥)=𝑎𝑥12, 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 𝑓(𝑥)=1.

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

For 𝑥=3, 𝑓(3)=𝑎×312=3𝑎12.

For 𝑥=4, 𝑓(4)=𝑎×412=4𝑎12.

For 𝑥=5, 𝑓(5)=𝑎×512=5𝑎12.

To find 𝑎, we substitute into the formula 𝑓(𝑥)=1: 𝑓(𝑥)=𝑓(3)+𝑓(4)+𝑓(5)=13𝑎12+4𝑎12+5𝑎12=112𝑎12=1𝑎=1.

Next, since we have found the value of 𝑎, we can determine the probability distribution function 𝑓(𝑥) by substituting 𝑎: 𝑓(𝑥)=1×𝑥12=𝑥12.

So, for each value of 𝑥=3,4, and 5 we have the following: 𝑓(3)=312,𝑓(4)=412,𝑓(5)=512.

We can now find the variance of the discrete random variable. We do this using the formula Var(𝑋)=𝐸𝑋𝐸(𝑋). Note that 𝑃(𝑋=𝑥) refers to the value of 𝑓(𝑥) corresponding to the value of 𝑥.

It is helpful to calculate 𝐸(𝑋) and 𝐸𝑋 separately first when calculating Var(𝑋).

For 𝐸(𝑋), 𝐸(𝑋)=(𝑥×𝑃(𝑋=𝑥))=3×312+4×412+5×512=912+1612+2512=5012=256.

For 𝐸𝑋, 𝐸𝑋=𝑥×𝑃(𝑋=𝑥)=3×312+4×412+5×512=2712+6412+12512=21612=18.

Finally, we substitute 𝐸(𝑋) and 𝐸𝑋 into the formula: Varcorrectto2decimalplaces(𝑋)=𝐸𝑋𝐸(𝑋)=18256=0.64.

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:
    • Var(𝑋)=𝐸(𝑋𝜇), where 𝜇=𝐸(𝑋)=(𝑥×𝑃(𝑋=𝑥)),
    • Var(𝑋)=𝐸𝑋𝐸(𝑋), where 𝐸𝑋=𝑥×𝑃(𝑋=𝑥) and 𝐸(𝑋)=(𝑥×𝑃(𝑋=𝑥)).

Join Nagwa Classes

Attend live sessions on Nagwa Classes to boost your learning with guidance and advice from an expert teacher!

  • Interactive Sessions
  • Chat & Messaging
  • Realistic Exam Questions

Nagwa uses cookies to ensure you get the best experience on our website. Learn more about our Privacy Policy