Lecture 3
Discrete Random
Variables and their
distributions
DR. MAHA HASSANEIN
Example: Throwing two dice
1,1 , 1,2 , (1,3) …
Sample Space 2,1 2,2 , 2,3 … . .
, 6,6
Sample Space and Probabilities:
The 36 events are equally likely.
Each has probability (1/36)
Let X =sum of two dice.
𝑋 = 2,3,4,5,6,7,8,9,10,11,12
Spring 2024 DR. MAHA A. HASSANEIN
Types of Random Variables
Two different broad classes of random variables:
Discrete Random Variables: These are variables that take
on a countable number of distinct values. Examples include
the number of heads when flipping three coins or the
number of defective items in a batch.
Continuous Random Variables: These are variables that can
take on an infinite number of possible values, often any
value within a specified interval. Examples include the
height of students in a class or the amount of rain in a city
on a given day.
Spring 2024 DR. MAHA A. HASSANEIN
Probability mass function
(pmf)
Probability Mass Function (PMF): This is a function that
gives the probability that a discrete random variable is
exactly equal to some value.
𝑓(𝑥) = 𝑃(𝑋 = 𝑥)
Ex. Find the pmf of Tossing a coin twice with X defined as
the number of heads to occur
Spring 2024 DR. MAHA A. HASSANEIN
Example 1 . Cnt’d.
Throwing two dice: The pmf of X, f(x) where X =sum of two
dice. 𝑋 = 2,3,4,5,6,7,8,9,10,11,12
Find all simple events for which X = k, for each possible
value k.
X=k 2 3 4 5 6 7 8 9 10 11 12
events (1,1) (1,2) (1,3) (1,4) (1/5 (1/6 (2/6 (3/6 (4/6 (5/6 (6,6)
for (2,1) (2,2) (2,3) (2,4) (2,5) (3,5) (4,5) (5,5) (6,5)
which (3,1) (3,2) (3,3) (3,4) (4,4) (5,4) (6,4)
X=k (4,1) (4,2) (4,3) (5,3) (6,3)
(5,1) (5,2) (6,2)
(6,1)
Spring 2024 DR. MAHA A. HASSANEIN
Example 1 . Pmf f(x) Cntd
x 2 3 4 5 6 7 8 9 10 11 12
Pmf 1/36 2/36 3/36 4/36 5/36 6/36 5/36 4/36 3/26 2/36 1/36
f(x)
f(x)
9/50
4/25
7/50
3/25
1/10
2/25 f(x)
3/50
1/25
1/50
0
2 3 4 5 6 7 8 9 10 11 12
Spring 2024 DR. MAHA A. HASSANEIN
Properties of f(x)
For a Discrete Random Variable (DRV) X with possible values
𝑥1 , 𝑥2 , … , 𝑥𝑁 , a probability mass function (pmf ) satisfies
𝑓 𝑥 ≥0
𝑓 𝑥 =𝑃 𝑋=𝑥
𝑓(𝑥) = 1
𝑥
For all possible values 𝑥 = 𝑥𝑘
Spring 2024 DR. MAHA A. HASSANEIN
Cumulative Distribution
Function
𝐹 𝑥 =𝑃 𝑋 ≤𝑥
Properties of cdf:
• 𝐹(𝑥) is non decreasing
• lim 𝐹 𝑥 = 0 and
𝑥→−∞
lim 𝐹 𝑥 = 1
𝑥→∞
• 𝐹(𝑥) is continuous
Spring 2024 DR. MAHA A. HASSANEIN
Computing F(x) , X DRV
◦ It adds up or accumulate all the prob. assigned to that value and
smaller values
F(𝑥) = 𝑃 𝑋 ≤ 𝑥
= 𝑓(𝑥𝑘 )
𝑥≤𝑥𝑘
We can find probabilities in intervals using cdf
o𝑃 𝑎 < 𝑋 ≤ 𝑏 = 𝐹 𝑏 − 𝐹 𝑎
o𝑃 𝑋 ≤ 𝑎 = 𝐹 𝑎
o𝑃 𝑋 > 𝑎 = 1 − 𝐹 𝑎
Spring 2024 DR. MAHA A. HASSANEIN
Example 1: Throwing two dice
Let X =sum of two dice
𝑋 = 2,3,4,5,6,7,8,9,10,11,12
x 2 3 4 5 6 7 8 9 10 11 12
f(x) 1/36 2/36 3/36 4/36 5/36 6/36 5/36 4/36 3/26 2/36 1/36
F(x) 1/36 3/36 6/36 10/36 15/36 21/36 26/36 30/36 33/36 35/36 1
Spring 2024 DR. MAHA A. HASSANEIN
Example 1: Graph pmf and cdf
Spring 2024 DR. MAHA A. HASSANEIN
Example 2
0 𝑥<0
1
0≤𝑥<1
𝐹 𝑥 = 4
3
1≤𝑥<2
4
1 2≤𝑥<∞
Compute the following probabilities
𝑃 0<𝑋≤2
𝑃 𝑋≤1
𝑃 𝑋>1
Spring 2024 DR. MAHA A. HASSANEIN
Expectations and Variance of
Discrete Random Variables
Goal. To understand the behavior and characteristics of
random variables.
These are measures that help us analyze the central
tendency and variability of discrete random variables.
Spring 2024 DR. MAHA A. HASSANEIN
Expected Value E(X) or μ
The expectation, denoted by E(X) or μ, is a measure of the
central tendency or the average value of a random variable.
It provides insight into what value we would expect the
random variable to take on in the long run.
The expected value of a random variable is the mean value
of the variable X in the sample space of possible outcomes.
If X is a random variable with possible values x1, x2, x3, . . . ,
with pmf 𝑓(𝑥) then the expected value of X is calculated
μ = 𝐸(𝑋) = σ𝑘 𝑥𝑘 𝑓(𝑥𝑘 )
Spring 2024 DR. MAHA A. HASSANEIN
Example 1 : Tossing a coin
twice
Let X be the number of heads to occur
𝑋 = 0,1,2
The pmf 𝑓 𝑥
X 0 1 2
𝑓(𝑥) 1/4 1/2 ¼
The mean
μ = E(𝑋) = 𝑥𝑘 𝑓(𝑥𝑘 )
𝑘
1 1 1
=0∗𝑓 0 + 1 ∗𝑓 1 +2∗𝑓 2 =0∗ +1∗ +2∗ =1
4 2 4
Spring 2024 DR. MAHA A. HASSANEIN
Example 2: Throwing two dice
Let X =sum of two dice
𝑋 = 2,3,4,5,6,7,8,9,10,11,12
x 2 3 4 5 6 7 8 9 10 11 12
f(x) 1/36 2/36 3/36 4/36 5/36 6/36 5/36 4/36 3/26 2/36 1/36
The mean
μ = E(𝑋) = 𝑥𝑘 𝑓(𝑥𝑘 ) = 7
𝑘
Spring 2024 DR. MAHA A. HASSANEIN
Properties of Expectations
From summation properties, given a and b constants
𝐸 𝑎𝑋 + 𝑏 = 𝑎𝐸 𝑋 + 𝑏
𝐸(𝑋 2 ) = 𝑥𝑘 2 𝑓(𝑥𝑘 )
𝑘
𝐸 𝑔 𝑋 = 𝑔 𝑥𝑘 𝑓 𝑥𝑘 , 𝑔 𝑋 𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛 𝑜𝑓 𝑋
𝑘
Spring 2024 DR. MAHA A. HASSANEIN
Variance of X Var(X)
The variance, denoted by Var(X) or 𝜎 2 , quantifies the spread or
variability of a random variable. It tells us how much the values of
the random variable deviate from their average (expectation).
The Variance of a R.V. X is a measure of dispersion or scatter in
the possible values for X
𝜎 2 = 𝑉𝑎𝑟 𝑋 = 𝐸 𝑋 − 𝜇 2
= 𝑥𝑘 − 𝐸(𝑋) 𝑓 𝑥𝑘
𝑘
A simpler Formula :
𝜎 2 = 𝐸(𝑋 2 ) − 𝜇2 = 𝑥𝑘2 𝑓 𝑥𝑘 − 𝐸 𝑋 2
Spring 2024 DR. MAHA A. HASSANEIN
Properties of Var(X)
A useful identity , for any a and b constants
𝑉𝑎𝑟 𝑎𝑋 + 𝑏 = 𝑎2 𝑉𝑎𝑟 𝑋
Prove.
Spring 2024 DR. MAHA A. HASSANEIN
The Standard Deviation
The standard deviation, denoted by SD(X) or σ, is the
positive square root of the variance. It provides a measure
of the average distance between each value of the random
variable and the expectation.
The standard deviation of X is the average distance the
random variable falls from its mean over the long run.
𝜎= 𝑉𝑎𝑟 𝑋
It provides a more interpretable measure of variability, as it
is expressed in the same units as the random variable itself.
Spring 2024 DR. MAHA A. HASSANEIN
Example
The number of messages sent per hour over a computer
network has the following distribution
x 10 11 12 13 14 15
f(x) 0.08 0.15 0.3 0.2 0.2 0.07
a)Determine the mean and standard deviation of the
number of messages sent per hour
b) What is the expected value of the square of the number
of messages per hour
c) Compute E(3X+2) and V(2X+4)
Spring 2024 DR. MAHA A. HASSANEIN
Discrete Distributions
◦ Bernoulli Process
◦ Geometric Distributions
◦ Binomial Distributions
◦ Poisson Distribution
◦ *Multinomial Distributions
◦ *Hypergeometric Distribution
◦ *Negative Binomial
Spring 2024 DR. MAHA A. HASSANEIN
Bernoulli Trial
A Bernoulli trial is a trial in which we have only Two possible
outcomes
The outcomes are either Succes or Failure.
The probability of success, p (constant from trial to trial)
The probability of failure , 𝑞 = 1 − 𝑝
The repeated trials are independent
Spring 2024 DR. MAHA A. HASSANEIN
Bernoulli Random Variable
A Bernoulli random variable X with only two possible
outcomes
𝑋 = 0,1
Follows a Bernoulli distribution with success probability p .
The pmf Bernoulli Distribution 2/3
pdf
0.7
0.6
x f(x) 0.5
0 q 0.4 1/3
1 p 0.3
0.2
0.1
0
0 1
Spring 2024 DR. MAHA A. HASSANEIN
Mean and Variance
Mean
𝐸 𝑋 = 0 𝑞+ 1 𝑝=𝑝
Variance
𝑉 𝑋 = 𝐸 𝑋 2 − 𝑝2 = 𝑝𝑞
Spring 2024 DR. MAHA A. HASSANEIN
Geometric Probability Distribution
Assume, repeated independent Bernoulli trials result in a success
with probability p and a failure with probability q=1-p.
Define X= the number of the trials on which the first success
occurs
Then the probability distribution of X is a geometric R.V. with pmf
f x = pqx−1 , x = 1,2,3, … …
Note. X cannot be zero since at least you need one trial to reach a
success
Spring 2024 DR. MAHA A. HASSANEIN
Mean and Variance of a
Geometric Distribution
Theorem: The mean and variance of a geometric RVis given
by
1
𝜇=
𝑝
1−𝑝 𝑞
𝜎2 = 2 = 2
𝑝 𝑝
Prove.
Spring 2024 DR. MAHA A. HASSANEIN
Example : Geometric Distribution
Roll a single die and let a 5 or 6 be a success. Repeat the
experiment until a success occurs. Let X= number of trials
until a success. Make a table and graph of the pdf.
x f(x)
1 1/3 Geometric Distribution pdf
2 2/9 1/3
3 1/7 2/7
4 0.0988 1/4
5 0.0658 1/5
6 0.0439 1/7
7 0.0293 0
8 0.0195
0
9 0.0130
0
10 0.0087 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Spring 2024 DR. MAHA A. HASSANEIN
Example
In a manufacturing process it is known that on the average ,
0.01 items are defective. What is the probability that the
third item inspected is the first defective item found?
Spring 2024 DR. MAHA A. HASSANEIN
Binomial Distribution
The probability distribution of the binomial random variable X is
given by
𝑛 𝑥
𝑓 𝑥 = 𝑝 (1 − 𝑝)𝑛−𝑥 , 𝑥 = 0,1,2, … , 𝑛
𝑥
Known as the Binomial Distribution.
Verify σ𝑛𝑖=1 𝑓(𝑥𝑖 ) = 1
Very famous in applications.
Spring 2024 DR. MAHA A. HASSANEIN
Binomial Distribution
Binomial Distribution
Rolling 3 Dice
0.50
0.44
0.45
0.40
0.35
0.30
0.30
0.25 0.22
0.20
0.15
0.10
0.05 0.04
0.00
1 2 3 4
Spring 2024 DR. MAHA A. HASSANEIN
Mean and Variance of a
Binomial R.V.
Theorem: The mean and variance of a binomial RV is given
by
𝜇 = 𝑛𝑝 and 𝜎 2 = 𝑛𝑝𝑞
Prove.
Spring 2024 DR. MAHA A. HASSANEIN
Example
Select at random 3 items from a Batch of which 25% are
defective. Find the probability that exactly two items
selected are defective. Find the mean and variance of the
binomial random variable
Spring 2024 DR. MAHA A. HASSANEIN
Example 7
Let 5% of products are defective. If a man is buying a lot of
35 of them. What is the probability that exactly 15 of them
are defective? At most 2 is defective? At least 3 is defective?
Spring 2024 DR. MAHA A. HASSANEIN
Binomial(35,0.05)
mean 1.194547
variance 1.6625
Binomial (35,0.05)
0.3500
0.3000
0.2500
0.2000
0.1500
0.1000
0.0500
0.0000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
Spring 2024 DR. MAHA A. HASSANEIN
Binomial versus Geometric
Distributions
BINOMIAL R.V. GEOMETRIC R.V.
X Random Variable is the Random Variable is the
number of successes in n number of independent
independent Bernoulli trials Bernoulli trials until a
success occurs
Number of trials is not
Number of trials is known n. known x
Discrete Random Variable Discrete Random Variable
X={0,1,2,..,n} X={1,2,3,…..}
Spring 2024 DR. MAHA A. HASSANEIN
Poisson Distribution
X = the number of occurrences of an event over a fixed interval t
𝑋 = {0,1,2,3, … . . }
is known as a Poisson random variable . The probability
Distribution of a Poisson RV X is
𝑒 −𝜇 (𝜇)𝑥
𝑓 𝑥 = , 𝑥 = 0,1,2, … .
𝑥!
where
Mean = 𝜇 = 𝜆𝑡
Variance = 𝜎 2 = 𝜇
𝜆= the rate of occurrence (arrivals)
t = specific time or region of interest
Spring 2024 DR. MAHA A. HASSANEIN
Illustrative Example
𝜆= 10 occurrences per hour , t = 1 hours
𝜇 = 𝜆𝑡 = 10 1 = 10
10𝑥 𝑒 −10
𝑓 𝑥 = , 𝑥 = 0,1,2, …
x f(x)
𝑥!
0 4.53999E-05 Poisson Distribution
1 0.000453999
0.14
2 0.002269996
0.12
3 0.007566655
0.1
4 0.018916637
0.08
5 0.037833275
0.06
6 0.063055458
7 0.090079226 0.04
8 0.112599032 0.02
9 0.125110036 0
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49
10 0.125110036
Spring 2024 DR. MAHA A. HASSANEIN
Mean and Variance of a
Poisson Distribution
Theorem: The mean and variance of a geometric RV is given
by
𝜇 = 𝜆𝑡 and 𝜎 2 = λ𝑡
Example 1:
a) 𝜇 = 𝜆𝑡 = 10 and 𝜎 2 = λ𝑡 = 10
b) 𝜇 = 𝜆𝑡 = 2.5 and 𝜎 2 = λ𝑡 = 2.5
c) 𝜇 = 𝜆𝑡 = 5 and 𝜎 2 = λ𝑡 = 5
Spring 2024 DR. MAHA A. HASSANEIN
Example 8
The number of telephone calls arriving at an exchange is
modelled by a Poisson distribution. Assume on the average
that there are 10 calls per hour
a) What is the probability that there are exactly 5 calls in an
hour
b) What is the probability that there are at most 2 calls in
15 minutes
c) What is the probability that there are at least 2 calls in
half an hour
Spring 2024 DR. MAHA A. HASSANEIN
Poisson Distribution as a
Limiting Form of the Binomial
Let X be a binomial RV with probability distribution f(x)
When 𝑛 → ∞, 𝑝 → 0, 𝑎𝑛𝑑 𝑛𝑝 → 𝜇 remains constant ,
𝑛 𝑥
𝑓 𝑥 = 𝑝 (1 − 𝑝)𝑛−𝑥 , 𝑥 = 0,1,2, … , 𝑛
𝑥
𝑒 −𝜆𝑡 (𝜆𝑡) 𝑥
𝑓 𝑥 = , 𝑥 = 0,1,2, … .
𝑥!
Spring 2024 DR. MAHA A. HASSANEIN
Example
In a manufacturing process, glass products are defective with
probability 0.001 . What is the probability that a random
sample of 8000 will yield less than 7 defective glasses ?
Spring 2024 DR. MAHA A. HASSANEIN
Multinomial Probabilities
If a trial can result in 3 different outcomes 𝐸1 , 𝐸2 , 𝐸3 with
probabilities 𝑝1 , 𝑝2 , 𝑝3 , then the probability distribution of
the random variables 𝑋1 , 𝑋2 , 𝑋3 representing the number of
successes in each outcome respectively ,in n independent
trial is
𝑛 𝑥1 𝑥2 𝑥3
𝑓 𝑥1 , 𝑥2 , 𝑥3 = 𝑥 , 𝑥 , 𝑥 𝑝1 𝑝2 𝑝3
1 2 3
where 𝑥1 + 𝑥2 + 𝑥3 = 𝑛 𝑎𝑛𝑑 𝑝1 + 𝑝2 + 𝑝3 = 1
𝑛 𝑛!
𝑥1 , 𝑥2 , 𝑥3 = 𝑥1 ! 𝑥2 ! 𝑥3 !
This can be generalized for any number of outcomes.
Spring 2024 DR. MAHA A. HASSANEIN
Example
In an airport ; the probability that runway 1 , 2 and 3 are
accessed by a plane is 2/9, 1/6, 11/18. What is the
probability that 6 planes arriving are distributed to runway
1, 2 and 3 as 2, 1, 3 airplanes .
Spring 2024 DR. MAHA A. HASSANEIN
Hypergeometric Distribution
The hypergeometric distribution is one that posses the
following properties :
1. A random sample of size n is selected without
replacement from N items
2. k of the N items may be classified as successes and N-k
are classified as failures
The number X of successes of hypergeometric is a
hypergeometric random variable with pmf
𝑘 𝑁−𝑘
𝑥 𝑛−𝑥
𝑓 𝑥; 𝑁, 𝑛, 𝑘 = 𝑁 , 𝑥 ≤ min{𝑛, 𝑘}
𝑛
Spring 2024 DR. MAHA A. HASSANEIN
Example
We have a lot of 100 items of which 12 are defective . What
is the probability that in a sample of 10, 3 are defective ?
Using the hypergeometric pmf
12 88
3 7
𝑓 3; 100,10,12 = 100 = 0.08 , 𝑥 = 3 ≤ min{10,12}
10
Spring 2024 DR. MAHA A. HASSANEIN
Relationship between
distributions
Hypergeometric vs Binomial
If n<<N , a binomial dist. Approximates the hypergeometric
with k/N =p probability of success of the binomial .
Spring 2024 DR. MAHA A. HASSANEIN
Negative Binomial
Distribution
Negative Binomial Experiment consists of :
The Bernoulli trials are repeated until k successes occur.
The number of trials X to produce the k successes is a negative
binomial RV.
The probability of kth success on the xth trial is 𝑝. 𝑝𝑘−1 𝑞 𝑥−𝑘
The total number of samples with k-1 successes in x-1 trials is
𝑥−1
𝑘−1
The negative binomial pmf is given by
𝑥 − 1 𝑘 𝑥−𝑘
𝑏 ∗ 𝑥; 𝑘, 𝑝 = 𝑝 𝑞 , 𝑥 = 𝑘, 𝑘 + 1, 𝑘 + 2, …
𝑘−1
Spring 2024 DR. MAHA A. HASSANEIN
Example
In a championship, the team who wins 4 games of 7 is a
winner. Team A has probability 0.55 of winning over team B
What is the probability that team A will win the series in six
games?
5
𝑏 ∗ 6; 4,0.55 = 0.554 (1 − 0.55)6−4 = 0.1853
3
What is the probability that team A will win the series?
𝑏 ∗ 4; 4,0.55 + 𝑏 ∗ 5; 4,0.55 + 𝑏 ∗ 6; 4,0.55
+ 𝑏 ∗ 7; 4,0.55 = 0.6083
Spring 2024 DR. MAHA A. HASSANEIN
Discrete Distributions using
Excel
In an excel spreadsheet –
Select insert function fx
Select Category : Statistical
Select the distribution name ; e.g;
Binomial
Poisson
In the popup menu , enter the parameters of the
distribution
Spring 2024 DR. MAHA A. HASSANEIN
Text Book
Chapter 4: Sec 4.1 Sec 4.4
References
Spring 2024 DR. MAHA A. HASSANEIN