Lesson Explainer: Variance of Discrete Random Variables Mathematics

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)=0∴5π΄βˆ’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=155Γ—ο€Ό15=525=1515

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=545Γ—ο€Όβˆ’12=54οŠ¨βˆ’12

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(𝑋)=πΈο€Ήπ‘‹ο…βˆ’πΈ(𝑋)=1565βˆ’ο€Ό265=1565βˆ’67625=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
π‘‹βˆ’πœ‡3βˆ’265=βˆ’1155βˆ’265=βˆ’157βˆ’265=958βˆ’265=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(𝑋)=πΈο€Ήπ‘‹ο…βˆ’πΈ(𝑋)=57524βˆ’ο€Ό10924=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=βˆ’416βˆ’316+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(𝑋)=πΈο€Ήπ‘‹ο…βˆ’πΈ(𝑋)=52βˆ’ο€Ό58=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(𝑋)=πΈο€Ήπ‘‹ο…βˆ’πΈ(𝑋)=18βˆ’ο€Ό256=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 𝐸(𝑋)=ο’ο„š(π‘₯×𝑃(𝑋=π‘₯)).

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