Chapter #3 Discrete RV Prob Dist Function
Chapter #3 Discrete RV Prob Dist Function
2
Definitions: Random Variables (RV)
▪ Random Variable (RV): A numeric outcome that results
from an experiment
▪ For each element of an experiment’s sample space, the
random variable can take on exactly one value
▪ Discrete Random Variable: An RV that can take on only a
finite or countably infinite set of outcomes
▪ Continuous Random Variable: An RV that can take on
any value along a continuum (but may be reported
“discretely”)
▪ Random Variables are denoted by upper case letters (𝒀)
▪ Individual outcomes for an RV are denoted by lower case
letters (𝒚)
Definitions
Random variable- A random variable associates a numerical value
with each outcome of an experiment. It is defined mathematically as a
real-valued function defined on a sample space.
4
3-1 Probability Distributions,
Discrete Random Variable
A probability distribution consists of the values of a random
variable and their corresponding probabilities.
Example:
The probability of a discrete random variable X occurring
x 2 2.5 3 3.5 4 4.5
a) Plot the table
P(X=x) 0.07 0.36 0.21 0.19 0.10 0.07
b) State P(X = 3.5)
c) Calculate P(x ≥ 3.0)
d) Calculate P(x) < 4.0)
e) Calculate P(x > 3.5)
f) Calculate P(x ≤ 3.9)
g) The variable x is sampled 50000 times. How many times would
you expected to have the value 2.5
5
Introductory Example
▪ Suppose that a day’s production of 850 manufacturing parts contains 50 parts
that do not conform to customer requirements.
▪ Two parts are selected at random, without replacement, from the batch.
▪ Let the random variable X equal the number of nonconforming parts in the
sample.
7
3-1 Probability Distributions and
Probability Mass Functions
Example: Bits in error
▪ There is a chance that a bit transmitted in a digital transmission channel
is received in error.
▪ Let X equal the number of bits in error in the next 4 bits transmitted.
▪ The possible values of X are (0,1,2,3,4).
8
3-1 Probability Distributions and
Probability Mass Functions (cont.)
𝑃(𝑥)
11
Example: Flip three coins
14
3-3 Cumulative Distribution Functions
Definition
15
3-3 Cumulative Distribution Functions
Example:
Consider a random variable X that is equal 1, 2 or 3.
If we know that 𝑝(𝑋 = 1) = 1/2 and 𝑝(𝑋 = 2) = 1/3.
1) What is the p(X=3) = ?
𝑝 𝑋=1 + 𝑝 𝑋=2 + 𝑝 𝑋=3 = 1
⇒ 𝑝 𝑋 = 3 = 1/6
2) Draw the cumulative distribution function F(x).
𝟎 𝒙<𝟏
𝟏
𝟏≤𝒙<𝟐
𝑭 𝑿=𝒙 = 𝟐
𝟓
𝟐≤𝒙<𝟑
𝟔
𝟏 𝟑≤𝒙
16
Example 3-8
▪ Supposes that a day’s production of 850 manufacturing parts contains
50 parts that do not conform to customer requirements.
▪ Two parts are selected at random, without replacement, from the
batch.
▪ Let the random variable X equal the number of nonconforming parts in
the sample.
▪ What is the cumulative distribution function of X?
Answer:
17
Example 3-8
𝐹 0 = 𝑃(𝑋 ≤ 0) = 𝑃(𝑋 = 0) = 0.886
𝐹 1 = 𝑃 𝑋 ≤ 1 = 𝑃 𝑋 = 0 + 𝑃 𝑋 = 1 = 0.997
𝐹 2 = 𝑃 𝑋 ≤ 2 = 𝑃 𝑋 = 0 + 𝑃 𝑋 = 1 + 𝑃(𝑋 = 0) = 1
𝐶𝐷𝐹 𝑜𝑓 𝑋:
0 𝑥<0
0.886 0≤𝑥<1
𝐹 𝑥 =
0.997 1≤𝑥<2
1 2≤𝑥
19
Cumulative Distribution Function (CDF)
Example 2
𝐶𝐷𝐹 𝑜𝑓 𝑋:
0 𝑥<1
0.7 1≤𝑥<4
𝐹 𝑥 =
0.9 4≤𝑥<7
1 7≤𝑥
Determine each of the following probabilities:
𝑃 𝑋 ≤ 4 = 𝐹 4 = 0.9
𝑃 𝑋 > 5 =1-P(X ≤5)=1-F(5)=1-0.9=0.1
𝑃 𝑋 < 2 = P(X ≤1)=F(1)=0.7
P(X<4)=P(X ≤3)=F(3)=0.7
P(2 ≤X ≤5)=F(5)-F(2)=0.9-0.7=0.2
20
Cumulative Distribution Function (CDF)
Example 2
𝐶𝐷𝐹 𝑜𝑓 𝑋:
0 𝑥<1
0.7 1≤𝑥<4
𝐹 𝑥 =
0.9 4≤𝑥<7
1 7≤𝑥
Determine the probability mass function of X:
X={1, 4, 7}
𝑓 1 = 𝑃 𝑋 = 1 = 𝐹 1 − 𝐹 0 = 0.7
𝑓 4 = 𝑃 𝑋 = 4 = 𝐹 4 − 𝐹 1 = 0.9 − 0.7 = 0.2
𝑓 7 = 𝑃 𝑋 = 7 = 𝐹 7 − 𝐹 4 = 1 − 0.9 = 0.1
21
Cumulative Distribution Function (CDF)
In General
• 𝑃 𝑋≤𝑎 =𝐹 𝑎
• P(X<a)=P(X ≤a-1)=F(a-1)
• P(X>a)=1-P(X ≤a)=1-F(a)
• 𝑃 𝑋 =𝑎 =𝐹 𝑎 −𝐹 𝑎−1
F a = 𝑓 1 + 𝑓 2 + ⋯+ 𝑓 𝑎
F a − 1 = 𝑓 1 + 𝑓 2 + ⋯+ 𝑓 𝑎 − 1
So F a − 𝐹(𝑎 − 1) = 𝑓 𝑎
22
Probability Distributions and
Probability Mass Functions
23
Probability Distributions
▪ Probability Distribution: Table, Graph, or Formula that
describes values a random variable can take on, and its
corresponding probability (discrete RV) or density
(continuous RV)
▪ Discrete Probability Distribution: Assigns probabilities
(masses) to the individual outcomes
▪ Continuous Probability Distribution: Assigns density at
individual points, probability of ranges can be obtained by
integrating density function
F (−) = 0 F () = 1
F ( y ) is monotonically increasing in y
Example – Rolling 2 Dice (Red/Green)
Y = Sum of the up faces of the two die.
Table gives value of y for all elements in S
Red\ Green 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
Rolling 2 Dice – Probability Mass Function &
CDF
y p(y) F(y)
2 1/36 1/36 # of ways 2 die can sum to y
3 2/36 3/36
p( y) =
# of ways 2 die can result in
4 3/36 6/36
y
5 4/36 10/36
F ( y ) = p (t )
6 5/36 15/36 t =2
7 6/36 21/36
8 5/36 26/36
9 4/36 30/36
10 3/36 33/36
11 2/36 35/36
12 1/36 36/36
Rolling 2 Dice – Probability Mass Function
Dice Rolling Probability Function
0.18
0.16
0.14
0.12
0.1
p(y)
0.08
0.06
0.04
0.02
0
2 3 4 5 6 7 8 9 10 11 12
y
Rolling 2 Dice – Cumulative Distribution Function
0.9
0.8
0.7
0.6
F(y)
0.5
0.4
0.3
0.2
0.1
0
1 2 3 4 5 6 7 8 9 10 11 12 13
y
3-4 Mean Value
If {𝑥1 , 𝑥2 , … , 𝑥𝑛 } is a set of n numbers, then the mean value of these
numbers is denoted by 𝑥ҧ
𝑛
1
𝑥ҧ = 𝑥𝑖
𝑛
𝑖=1
Example: Find the mean value of -1, 0, 1
Calculating 𝑥𝑖 − 𝑥,ҧ i = 1, 2,...,n is tedious for large n hence we use the formula
σ𝑛 2
𝑖=1 𝑖 −𝑛𝑥ҧ
𝑥 2
𝑣𝑎𝑟 =
𝑛
σ𝑛 2 ഥ2
𝑖=1 𝑥𝑖 −𝑛𝑥
and 𝑆𝐷 = 𝑛
𝜇 = σ𝑛𝑖=1 𝑥𝑖𝑃(𝑥𝑖 )
Example: Consider the probability distribution
𝒙𝒊 0 1 2 3 4
𝑷 𝒙𝒊 0.1 0.2 0.4 0.15 0.15
32
3-4 Standard Deviation of Discrete RV
If a discrete random variable can take values 𝑥1 , 𝑥2 , ⋯ ; 𝑥𝑛 with the
respective probability 𝑃 𝑥1 , 𝑃 𝑥2 , ⋯ , 𝑃 𝑥𝑛 respectively, then the variance
of the random variable 𝜎 2 is
𝑛
𝜎 2 = 𝑃 𝑥𝑖 𝑥𝑖 − 𝜇 2
𝑖=1
The standard deviation 𝜎 of the discrete random variable is
𝑛
𝜎= 𝑃 𝑥𝑖 𝑥𝑖 − 𝜇 2
𝑖=1
Definition
34
3-4 Mean and Variance of a Discrete
Random Variable
Parts (a) and (b) illustrate equal means, but Part (a) illustrates a larger
variance.
35
3-4 Mean and Variance of a Discrete
Random Variable
The probability distribution illustrated in Parts (a) and (b) differ even
though they have equal means and equal variances.
What does the length of each line represent in the above graphs?
36
Example 3-11
The number of messages sent per hour over a computer network has
the following distribution:
37
3-4 Mean and Variance of a Discrete
Random Variable
Example: the expected value of the function (X-)2 is the variance of the
random variable X.
38
3-4 Mean and Variance of a Discrete
Random Variable
Example: Bits in error (see slide #6)
▪ Let X equal the number of bits in error in the next 4 bits transmitted.
P(X=0) = 0.656; P(X=1) = 0.292; P(X=2) = 0.049;
P(X=3) = 0.004; P(X=4) = 0.0001
𝐸ℎ 𝑋
×
= 02 0.656 + 12 × 0.292 + 22 × 0.049 + 32 × 0.004 + 42
× 0.0001 = 0.52
Is 𝑬[𝑿𝟐] = (𝑬 𝑿 )𝟐 ?
If in doubt try it at home!!!
39
3-5 Discrete Uniform Distribution
Definition
Example:
42
3-5 Discrete Uniform Distribution
Example of work sampling:
• A voice communication system for a business contain 48 external lines.
• At a particular time, the system is observed and some of the lines are used.
• X denotes the number of lines in use (0 ≤ 𝑋 ≤ 48).
• Assume X is uniformly distributed (range: 0-48).
Solution:
𝑬[𝑿] = (𝟒𝟖 + 𝟎)/𝟐 = 𝟐𝟒
𝟒𝟖−𝟎+𝟏 𝟐− 𝟏
= = 𝟏𝟒. 𝟏𝟒 ≡ Standard deviation
𝟏𝟐
Example:
Let Y denote the proportion of the 48 lines that are in use at
particular time. Then Y = X/48. What is the E[Y] ?
Solution:
E[Y] = E[X]/48 = 24/48 = 0.5 = 50%
V(Y) = V(X)/(48)2 = 0.087
43
End of Discrete Uniform Distribution
44
Any example of Random experiment with (only)
two possible outcomes?
Examples:
• Tossing a coin
• The gender of an expected baby
• The result of a basketball match
• Whether a produced part is good or defective
• Etc. success with
probability p
Two
options
failure with
probability 1-p
Bernoulli Distribution
45
Bernoulli Distribution
47
3-6 Binomial Distribution (cont.)
Random experiments and random variables
5. A multiple choice test contains 10 questions. Each with 4
choices, and you guess at each question. Let X = number of
questions answered correctly.
6. In the next 20 births at a hospital, let X= the number of female
births.
7. Of all patients suffering a particular illness, 35% experience
improvement from a particular medication. In the next 100
patients administered the medication, Let X = the number of
patients who experience improvement.
48
3-6 Binomial Distribution (cont.)
In a single trial a particular result may or may not be obtained. For example, in
an examination, a student may pass or fail; when testing a component it may
work or do not work. The important point is that the two outcomes are
complementary (mutually exclusive)
Definition
51
3-6 Binomial Distribution (cont.)
The following formula is used to determine the probability of a success
for a single trial of a probability experiment. From the example above
we can work out the probability of k successes from n trials
𝑃(𝑋 = 𝑘) = 𝐶 𝑛, 𝑘 𝑝𝑘 1 − 𝑝 𝑛−𝑘
; 𝑘 = 0, 1, ⋯ , 𝑛
where:
n: the total number of trials
k: the number of successes (1, 2, 3, ⋯ , 𝑛)
p: the probability of a success
➢ Determine P(X = 2) ?
Answer:
▪ Let E denotes a bit in Error, and O denotes the bit is Correct.
▪ The outcomes can be represented as following: (next slide)
54
3-6 Binomial Distribution (cont.)
▪ Let E denotes a bit in Error, and O denotes the bit is Correct.
▪ The outcomes can be represented as following:
55
3-6 Binomial Distribution (cont.)
▪ Let E denotes a bit in Error, and O denotes the bit is Correct.
▪ The outcomes can be represented as following:
57
3-6 Binomial Distribution (cont.)
Example:
Each sample of water has a 10% of containing a particular organic
pollutant. Assume that the samples are independent with regard to the
presence of the pollutant. Find the probability that in the next 18
samples, exactly 2 contain the pollutant.
Solution:
➢ Let X = the number of samples that contain the pollutant in the next 18
samples analyzed.
➢ Then, X is a binomial random variable with 𝑝 = 0.1 and 𝑛 = 18.
➢ Number of ways success (2 contain the pollutant) can occur:
18 18!
𝐶 18,2 = = = 153
2 2! 18 − 2 !
➢ Finally:
18 2 16
𝑃 𝑋=2 = 0.1 0.9 = 0.284
2
58
3-6 Binomial Distribution (cont.)
Example (cont.):
Determine the probability that at least 4 samples
contain the pollutant.
Answer:
18
18 𝑥 18−𝑥
𝑃 𝑋≥4 = 0.1 0.9
𝑥
𝑥=4
However, it easier to use the complementary event:
𝑃 𝑋 ≥4 =1−𝑃 𝑋 <4
3
18 𝑥 18−𝑥
=1− 0.1 0.9
𝑥
𝑥=0
= 1 − 0.15 + 0.3 + 0.284 + 0.168 = 0.098
59
3-6 Binomial Distribution
Example (cont.):
Determine the probability that 3 ≤ 𝑋 < 7.
Answer:
60
3-6 Binomial Distribution (cont.)
61
End Binomial Distribution
3-7 Geometric Distribution
Definition
64
3-7 Geometric Distributions (cont.)
Example:
The Probability that a bit transmitted through a digital transmission
channel is received in error is 0.1. Assume the transmissions are
independent events, and let the random variable X denote the number of
bits transmitted until the first error. What is the probability that the 5th bit
is in error?
Answer:
𝑃 𝑋 = 5 = 𝑃 𝑂𝑂𝑂𝑂𝐸 = 1 − 𝑝 5−1 𝑝
65
3-7 Geometric Distributions (cont.)
Probability decreases
as in Geometric
series. That is why it is
called Geometric.
Answer:
▪ Let X denote the number of samples analyzed until a large particle
is detected.
▪ Then X is a geometric random variable with p = 0.01.
▪ The requested probability is:
67
3-7 Geometric Distributions
Definition
68
3-7 Geometric Distribution (cont.)
Example-2:
▪ X: a random variable denotes the number of times a Die need to be
thrown to get face number 2 on top.
▪ What is the probability that exactly 3 trials will be needed to get face n2
on top for the first time ?
Answer:
5 2 1 25
𝑃 𝑋=3 =𝑓 3 = ∗ =
6 6 216
➢ What is the probability of getting face n2 for the first time in the 5th
trial, knowing that the first two trials are unsuccessful ?
Answer:
𝑃 𝑋=5 𝑃 𝑋=5 25
𝑃 𝑋 = 5 /𝑋 > 2 = = =
1−𝑃 𝑋 ≤2 1 − 𝑃 𝑋 = 1 − 𝑃(𝑋 = 2) 216
→ 𝑃 𝑋 = 3 = 𝑃 𝑋 = 5 /𝑋 > 2 69
3-7 Geometric Distribution
70
3-7 Geometric Distribution
71
Name Probability Distribution Mean Variance
Discrete
Uniform 1 𝑏+𝑎 2
𝑏−𝑎+1 −1
, 𝑎≤𝑏
𝑛 2 12
Binomial 𝑛 𝑥
𝑝 1 − 𝑝 𝑛−𝑥
𝒏 𝑥 𝑛𝑝 𝑛𝑝(1 − 𝑝)
𝒙 𝑥 = 0,1, … , 𝑛, 0≤𝑝≤1
𝑥−1
1−𝑝 𝑝 𝑥 = 1,2 … , 0≤ 1 1−𝑝
Geometric
𝑝≤1 𝑝 𝑝2
𝑒 −𝜆 𝜆𝑥 𝜆 𝜆
Poisson 𝑥 = 1,2 … , 0<𝜆
𝑥!
Continuous
Uniform 1 𝑏+𝑎 2
𝑏−𝑎
, 𝑎≤𝑥≤𝑏
𝑏−𝑎 2 12
1 1 𝑥−𝜇 2
−
𝑒 2 𝜎
Normal 𝜎 2𝜋 𝜇 𝜎2
−∞ ≤ 𝑥 ≤ +∞ − ∞ ≤ 𝜇 ≤ +∞
0<𝜎
1 1
Exponential 𝜆𝑒 −𝜆 𝑥 0 ≤ 𝑥, 0≤𝜆 72
𝜆 𝜆2
Poisson Distribution
73
3-8 Poisson Distribution
This distribution is used when the variable occurs over a period of time,
volume, area, etc.
➢ Poisson distribution models the number of occurrences of an event in a
given interval.
For example: used to describe
✓ the arrivals of airplanes at an airport,
✓ the number of phone calls per hour for a 911 operator,
✓ the density of a certain species of plants over a geographic region,
✓ the number of white blood cells on a fixed area.
▪ The number of independent occurrences of an event in a given
time period is a discrete random variable X with values 0, 1, 2,
… Let μ be the expected value of X (𝜇 = 𝐸[𝑋]).
➢ The probability that X = r is
𝑒 −𝝀 𝝀𝑟
𝑃 𝑋 = 𝑟 = ; 𝑟 = 0, 1, 2, ⋯
𝑟!
▪ The expected value μ = 𝝀 and the variance 𝝈2 of the Poisson
distribution are both equal.
74
Poisson Distribution (cont.)
Definition
75
Poisson Distribution (cont.)
Answer:
On average three emergency calls per day = 𝝀 = 3
𝑒 −𝝀 𝝀𝑟 𝑒 −3 33
a) P(X=3) = =
𝑟! 3!
𝑒 −3 32
b) P(X=2) =
2!
𝑒 −3 34
c) P(X=4) =
4!
76
Poisson Distribution (cont.)
Example:
▪ Consider the transmission of n bits over a digital
communication channel.
▪ Let the RV equal the number of bits in error.
▪ When the probability that a bit is in error is constant and the
transmissions are independent, X has a binomial distribution.
▪ Let p denote the probability that a bit is in error.
▪ Let = pn. Then E(x) = pn = .
MEAN an VARIANCE
77
Poisson Distribution (cont.)
Example: optical storage contamination
▪ Contamination is a problem in the manufacture of optical storage disks.
▪ The number of particles of contamination that occur on an optical disk
has a Poisson distribution, and the average number of particles per
centimeter squared of media surface is 0.1.
▪ The area of a disk under study is 100 squared centimeters.
▪ Find the probability that 12 particles occur in the area of a disk under
study.
Answer:
▪ Let X denote the number of particles in the area of a disk under study.
▪ Because the mean number of particles is 0.1 particles per cm2, then:
▪ Therefore
78
Poisson Distribution (cont.)
Example: optical storage contamination
▪ The probability that zero particles occur in the area of the
disk is:
Answer:
▪ The probability is:
80
Poisson Distribution (cont.)
Example: The copper wire
• Suppose that the number of flaws follow a Poisson distribution with
mean of 2.3 flaws per millimeter.
• Determine the probability of exactly 2 flaws in 1 millimeter of wire
Answer:
P(X=2) = e-2.3 2.32/2! = 0.265
81
Poisson approximation to the Binomial
Distribution
▪ When n is large and p is small such that np is finite then the
binomial distribution can be approximated by the Poisson
distribution:
Answer:
n = 250 people p = 0.02 q = 0.98 k = 250
Binomial Distribution: 𝑃(𝑋 = 𝑘) = 𝐶 𝑛, 𝑘 𝑝𝑘 1 − 𝑝 𝑛−𝑘 ; 𝑘 = 0, 1, ⋯ , 𝑛
𝑒 −𝝀 𝝀𝑘
Poisson: 𝑃 𝑋 = 𝑘 = 𝑘!
μ = 𝝀 = np = 250x0.02 = 5
82
Tutorial
✓ The probability of the random variable y is given as
y -3 -2 -1 0 1 2 3
P(y) 0.63 0.2 0.09 0.04 0.02 0.01 0.01
(a) Calculate P(y ≥ 0) (b) P(y ≤ 1) (c) P(| y |≤ 1) (d) P(y2 > 3) (e) P(y2 ≤ 6)
Number of packets 17 54 32 6 1
83