Module 1 Random Variables (Corrected August 22 2022)

You might also like

You are on page 1of 37

Random Variables

Definition of Random Variables

● “A random variable is a variable (typically represented by x) that has


a single numerical value, determined by chance, for each outcome of
a procedure.” (Triola, 2018)
● For example, if one is to select a random student from an entire
population of a school, the student is sure to have characteristics
such as height, quiz performance, daily allowance, etc. which are all
random.
Definition of Random Variables

● The most used sample scenario to show random variables

is the toss coin. Imagine tossing n number of coins and

observing how many heads occur, denoted usually by a

capital letter X.
Discrete and Continuous Variables
Definition of Random Variables

According to Triola (2018), there are two types of random variables which are:
1. Discrete random variable which has a collection of values that are finite or
countable. For example, the number of cars at a given parking space or the
number of coins in the world.
2. Continuous random variables which has infinitely many values that are
uncountable. Bluman (2019) states that this type of variables are gathered
from data that are measured rather than counted. Examples of such
variables are a person’s height and weight, temperature, and time.
Discrete Random Variables

For this module, we will only focus on Discrete Random Variables. For example,

we toss 3 coins. What would be its sample space S?

𝑆 = 𝐻𝐻𝐻, 𝐻𝐻𝑇, 𝐻𝑇𝐻, HTT, THH, THT, TTH, TTT

Suppose we define a random variable 𝐿 to be the number of total heads. What

would be the values of 𝐿?

𝐿 = 1,2,3, or 0

These values are assigned to each outcome depending on the number of head.
Discrete Random Variables

𝐿 0 = 𝑇𝑇𝑇

𝐿 1 = 𝐻𝑇𝑇, 𝑇𝐻𝑇, 𝑇𝑇𝐻

𝐿 2 = 𝐻𝐻𝑇, 𝐻𝑇𝐻, 𝑇𝐻𝐻

𝐿 3 = 𝐻𝐻𝐻

Next, we define 𝑅𝐿 to be the range of 𝐿 or basically the set containing all the possible

values of 𝐿. In this case, what is 𝑅𝐿 ?

𝑅𝐿 = 0,1,2,3
Discrete Random Variables

For your short mental exercise, determine the range of the following:

1. Suppose I roll a 20-sided die 50 times. Let 𝑈 = number of 20s that I roll.

2. Suppose I pick a random student from a class of 40 with 1 male and a picked

student cannot be picked again. Let 𝑄 = number of picks I take until I select a

male.

3. Suppose you randomly pick n integers from 50 to 120 allowing for similar pickings

(that is, an integer can be chosen an infinite number of times) and 𝐺 = number of

primes I pick.
Discrete Random Variables

Here are the answers:

1. Since there is a possibility to pick 20s from 0 to 50 times, we have 𝑅𝑈 =

0,1,2, … , 50

2. Since there is a possibility to get a male on the first try, we know we start with 1.

However, this will not end until a male is picked, hence there is also a possibility to

get one after picking all females in the class, hence 𝑅𝑄 = 1, 2, 3, … , 40

3. 𝑅𝐺 = 0, ∞ (Can you explain why?)


Probability Distribution
Probability Mass Function (PMF)

Suppose we have a discrete random variable 𝐿. Then, we know that 𝐿 has a countable

range. This implies that the elements could be listed in the way:

𝑅𝐿 = 𝑙1 , 𝑙2 , 𝑙3 , …

Usually, one is interested in knowing the probability of a certain outcome in the range

of the random variable. That is, we want to know 𝑃 𝐿 = 𝑙𝑘 . We define 𝐴 as the set of

events 𝑠 in the sample space 𝑆 that satisfies the condition of 𝐿 = 𝑙𝑘 .


Probability Mass Function (PMF)

For example, if we have the random experiment of tossing 3 coins and 𝐿

be the number of heads, then 𝑅𝐿 = 0,1,2,3 and:

𝐴 0 = 𝑇𝑇𝑇

𝐴 1 = 𝐻𝑇𝑇, 𝑇𝐻𝑇, 𝑇𝑇𝐻 , etc.

And the probabilities of 𝐿 = 𝑙𝑘 is defined in the next slide.


Probability Mass Function (PMF)

Probability Mass Function of a random variable 𝐿 is defined by Pishro-Nik (2022) as

the function

𝑃𝐿 𝑙𝑘 = 𝑃 𝐿 = 𝑙𝑘 , for 𝑘 = 1,2,3, …

Citing the previous example, the notation 𝑃𝐿 1 means the probability of 𝐿 = 1 or the

probability of getting exactly one head.

Consequently, PMF is also called probability distribution for discrete random

variables.
Probability Mass Function (PMF)

Sample Problem:

Suppose we have the random experiment of tossing three coins. Let

O = number of tails. Find S, 𝑅 𝑂 , 𝑃𝑂 𝑜𝑘 .


Probability Mass Function (PMF)

Solution: Recall that 𝑆 means sample space of the random event. Thus

𝑆 = 𝐻𝐻𝐻, 𝐻𝐻𝑇, 𝐻𝑇𝐻, 𝐻𝑇𝑇, 𝑇𝐻𝐻, 𝑇𝐻𝑇, 𝑇𝑇𝐻, 𝑇𝑇𝑇

The number of tails per event can amount from 0, 1, 2, to 3. Hence,

𝑅𝑂 = 0,1,2,3 .

Since the range is countable, we could find 𝑃𝑂 𝑜𝑘 .


Probability Mass Function (PMF)

1
𝑃𝑂 0 =
8
3
𝑃𝑂 1 =
8
3
𝑃𝑂 2 =
8
1
𝑃𝑂 3 =
8
Probability Mass Function (PMF)

Sample Problem 2:
Suppose we roll a dice twice. Let 𝑂 = sum equal to 8. Find
𝑆, 𝑅𝑂 , and 𝑃𝑂 𝑜𝑘 .
Probability Mass Function (PMF)

Solution:
Supposing we roll a dice twice, we know there are 36 possible combinations. Such
combinations are shown in the table below:

Sum 1 2 3 4 5 6
1 2 3 4 5 6 7
2 3 4 5 6 7 8
3 4 5 6 7 8 9
4 5 6 7 8 9 10
5 6 7 8 9 10 11
6 7 8 9 10 11 12
Probability Mass Function (PMF)

Hence, we have
𝑆 = 2,3,3,4,4,4,5,5,5,5, … , 12
The range could be tricky since we’re not counting for heads or tails this
time but for exact events. Hence, only two things could happen; the sum
could be 8 or it could be another integer. This means that
𝑅𝑂 = sum of 8, sum of other integer
For brevity, let us simply denote 𝑎 = sum of 8, 𝑏 = not a sum of 8 so we have
𝑅𝑂 = 𝑎, 𝑏
Probability Mass Function (PMF)

Then we have:

5
𝑃𝑂 𝑎 =
36
31
𝑃𝑂 𝑏 =
36
Notice that in the previous table, there are only 5 outcomes where the
sum is 8. All the remaining 31 outcomes are complements of the event.
End of 1st Meet Assignment

1. Suppose we roll two six-sided dice and let 𝑈 = getting a

sum less than 5. Find 𝑆, 𝑅𝑈 , 𝑃𝑈 𝑢𝑘 .

2. Suppose we toss 5 coins and let 𝑁 = getting exactly 3

heads. Find the probability of 𝑁.


Probability Mass Function (PMF)

Sample Problem 2:
Suppose we have the random event of throwing a dice twice. We let
𝑈 = the sum of the die being a prime number. Find 𝑆, 𝑅𝑈 , 𝑃𝑈 𝑢𝑘 .
Probability Mass Function (PMF)

Solution:
𝑆 = 1 + 1, 1 + 2, 1 + 3, 1 + 4, … , 6 + 6
To see 𝑆 more clearly, we again have the table:

Sum 1 2 3 4 5 6
1 2 3 4 5 6 7
2 3 4 5 6 7 8
3 4 5 6 7 8 9
4 5 6 7 8 9 10
5 6 7 8 9 10 11
6 7 8 9 10 11 12
Probability Mass Function (PMF)

For 𝑅𝑈 , we know that the sum is only prime or composite. Hence, we

can simply say 𝑅𝑈 = prime, composite or we can denote them as 𝑅𝑈 =

𝑝, 𝑐 where 𝑝 = prime sum and 𝑐 = composite sum.


Probability Mass Function (PMF)

For 𝑃𝑈 𝑝 , we have the prime numbers 2, 3, 5, 7, 11. Based on the table


before, there are 15 outcomes that satisfy 𝑈 = 𝑝, thus

15 5
𝑃𝑈 𝑝 = =
36 12
Hence

21 7
𝑃𝑈 𝑐 = =
36 12
Probability Mass Function (PMF)

Pishro-Nik (retrived, 2022) states that we could extend PMS to all real-

number 𝑙 such that

𝑃 𝐿 = 𝑙𝑘 if 𝑙𝑘 ∈ 𝑅𝐿
𝑃𝐿 𝑙𝑘 ቊ
0 if 𝑙𝑘 ∉ 𝑅𝐿

It is also noted that σ𝑛𝑘=1 𝑃𝐿 𝑙𝑘 = 1.


Exercise

Suppose we toss a coin 5 times. What is the probability of getting at

least 3 heads?
Mean, Standard Deviation, and Variance of PMF

The mean of a random variable 𝐿, denoted as 𝜇𝐿 is defined by

𝜇𝐿 = ෍ 𝐿𝑝 𝐿
for all 𝐿

That is, the summation of all 𝐿 multiplied by their respective

probabilities. This mean is also called the expected value of 𝐿.


Mean, Standard Deviation, and Variance of PMF

The variance of a random variable 𝐿, denoted as 𝜎𝐿2 could be found

using the formula

𝜎𝐿2 = ෍ [ 𝐿 − 𝜇 2 𝑝 𝐿 ]
for all 𝐿

Recall that the variance is simply the square of standard deviation.


Mean, Standard Deviation, and Variance of PMF

Suppose we have the random experiment earlier which is tossing three

coins and have 𝐽 = number of tails. We have 𝑅𝐽 = 0,1,2,3 and

1 3 3 1
𝑃𝐽 0 = , 𝑃𝐽 1 = , 𝑃𝐽 2 = , 𝑃𝐽 3 =
8 8 8 8

With these information, we can find the expected values of 𝐽 as well as

its variance and standard deviation.


Mean, Standard Deviation, and Variance of PMF

For the mean, we have:

1 3 3 1 3 3 3 3
𝜇𝐽 = ෍ 𝐽𝑝 𝐽 = 0 +1 +2 +3 =0+ + + =
8 8 8 8 8 4 8 2
for all 𝐽

This implies that there is an expected value of 1.5 tails in every throw.
Mean, Standard Deviation, and Variance of PMF

For the variance, we have:

2 2 2 2
2 2
3 1 3 3 3 3 3 1
𝜎𝐽 = ෍ [ 𝐽 − 𝜇 𝑝 𝐽 ] = 0 − + 1− + 2− + 3−
2 8 2 8 2 8 2 8
for all 𝐽

9 1 1 3 1 3 9 1
= + + + = 0.75
4 8 4 8 4 8 4 8

Further, the standard deviation of 𝐽 is 0.75 = 0.8660


Mean, Standard Deviation, and Variance of PMF

Suppose we have a random event 𝑇 of processing chocolate cookies in a


bread factory. These cookies are divided depending on how many nuts
are in the product. The PMF is in the table below:
Number of Nuts Probability
3 0.15
4 0.25
5 0.10
6 0.30
7 0.20
Mean, Standard Deviation, and Variance of PMF

Find the expected value of 𝑇 as well as its variance and standard


deviation.
Quiz

Find the range, probability distribution, expected


value, and variance of the following:
1. Tossing five fair coins and 𝑇 = number of tails
2. Drawing a card each from four 52-card decks and
𝐽 = number of face cards.
Quiz

3. Suppose we roll two six-sided dice and a coin. What


is the probability of getting a sum of less than 6
and a tail?
4. Rolling an 𝑛 number of coins, describe the
probability distribution for 𝑘 number of heads. Do
so in less than 5 sentences.
References

● Pishro-Nik, H. (retrieved, July 2022). Introduction to Probability, Statistics, and Random Processes. Link

You might also like