Discrete Random Variable
Discrete Random Variable
Recap
› A discrete sample space , 𝑆𝑆, consists of a finite or countable infinite set of all possible
outcomes of a random experiment 𝑠𝑠1 , 𝑠𝑠2 , …
› The probability of an outcome, 𝑠𝑠, is denoted as P(𝑠𝑠)
› An event, 𝐸𝐸, is a subset of 𝑆𝑆. The probability of an event 𝐸𝐸 equals to the sum of all
probabilities of the outcomes in 𝐸𝐸 i.e. P E = ∑𝑠𝑠∈𝐸𝐸 𝑃𝑃(𝑠𝑠)
2
It is ‘random’ because its
value depends on a
random outcome of an
experiment. Also, X is
treated like a usual
› The function that associates a number with the outcome of a random experiment is
referred to as a random variable
› Notation is used to distinguish between a random variable and the real number
3
Discrete and Continuous Random Variables
› A discrete random variable is a random variable with a finite (or
countably infinite) range
› A continuous random variable is a random variable with an interval
(either finite or infinite) of real numbers for its range
4
Example 3.1 | Flash Recharge Time
› The time to recharge the flash is tested in three
cellphone cameras Table 3.1 Camera Flash Tests
o The probability that a camera passes the test Camera #
is 0.8 and the cameras perform independently. 1 2 3 Probability X
Pass Pass Pass 0.512 3
› Table 3.1 shows the sample space for the Fail Pass Pass 0.128 2
experiment and associated probabilities. Pass Fail Pass 0.128 2
o For example, because the cameras are Fail Fail Pass 0.032 1
independent, the probability that the first and Pass Pass Fail 0.128 2
second cameras pass the test and the third Fail Pass Fail 0.032 1
one fails, denoted as 𝑝𝑝𝑝𝑝𝑝𝑝, is Pass Fail Fail 0.032 1
𝑃𝑃(𝑝𝑝𝑝𝑝𝑝𝑝) = (0.8)(0.8)(0.2) = 0.128 Fail Fail Fail 0.008 0
Sum 1.000
› The random variable 𝑋𝑋 denotes the number of
cameras that pass the test. The last column
shows the values of 𝑋𝑋 assigned to each outcome
Sec 3.1 Probability Distributions and Mass Functions
of the experiment.
5
It is not a
6
Note
A random experiment can often
be summarized with a random
Example 3.3 | Digital Channel variable and its distribution. The
details of the sample space can
often be omitted.
› There is a 0.1 chance that a bit
transmitted through a digital
transmission channel is received in
error.
› Let 𝑋𝑋 equal the number of bits
received in error in the next 4 bits
transmitted.
› The associated probability Figure 3.1 Probability distribution for bits in error.
distribution of 𝑋𝑋 is shown in the
table. P(X =0) = 0.6561
P(X =1) = 0.2916
› The probability distribution of 𝑋𝑋 is P(X =2) = 0.0486
given by the possible values along P(X =3) = 0.0036
with their probabilities. P(X =4) = 0.0001
Sec 3.1 Probability Distributions and Mass Functions
1.0000
7
Probability Mass Function
For a discrete random variable 𝑋𝑋 with possible values 𝑥𝑥1, 𝑥𝑥2, … , 𝑥𝑥𝑛𝑛, a
probability mass function is a function such that:
(1) 𝑓𝑓 𝑥𝑥𝑖𝑖 ≥ 0
8
Example 3.4 | Wafer Contamination
9
Note outcomes in the
new sample space are
Example 3.5 | Consider the probability distribution for the digital channel example.
The last column shows the cumulative probabilities of getting an error 𝑥𝑥 or less.
0 𝑥𝑥 < −2
0.2 − 2 ≤ 𝑥𝑥 < 0
𝐹𝐹 𝑥𝑥 =
0.7 0 ≤ 𝑥𝑥 < 2
Figure 3.3 Cumulative Distribution Function
1 2 ≤ 𝑥𝑥
Note
Even if the random variable 𝑋𝑋 can assume only
𝑓𝑓 −2 = 0.2 − 0 = 0.2
integer values, the cumulative distribution
𝑓𝑓 0 = 0.7 − 0.2 = 0.5 function is defined at non-integer values.
𝑓𝑓 2 = 1.0 − 0.7 = 0.3
Sec 3.2 Cumulative Distribution Functions
11
Cumulative Distribution Function and Properties
The cumulative distribution function, is the probability that a random
variable 𝑋𝑋 with a given probability distribution, will be found at a value less
than or equal to 𝑥𝑥. Mathematically,
𝐹𝐹 𝑥𝑥 = 𝑃𝑃 𝑋𝑋 ≤ 𝑥𝑥 = � 𝑓𝑓 𝑥𝑥𝑖𝑖
𝑥𝑥𝑖𝑖 ≤𝑥𝑥
For a discrete random variable 𝑋𝑋, 𝐹𝐹(𝑥𝑥) satisfies the following properties:
(2) 0 ≤ 𝐹𝐹 𝑥𝑥 ≤ 1
12
Let’s recap (Simple Example)
› Suppose we are interested in the random experiment
where one flips a coin 3 times. The sample space for this
random experiment consists of 8 equally likely
possibilities: HHH HHT HTH HTT THH THT TTH TTT
› Now let the random variable X be the number of heads
seen. The new sample space is then 3 2 2 1 2 1 1 0
› In Example 3.3, there is a chance that 𝑥𝑥 (𝑥𝑥 − 0.4) (𝑥𝑥 − 0.4)2 𝑓𝑓(𝑥𝑥) 𝑓𝑓(𝑥𝑥)(𝑥𝑥 − 0.4)2
a bit transmitted through a digital
transmission channel is received in 0 −0.4 0.160 0.6561 0.1050
error. 𝑋𝑋 is the number of bits 1 0.6 0.360 0.2916 0.1050
received in error of the
next 4 transmitted. 2 1.6 2.560 0.0486 0.1244
𝐸𝐸[ℎ(𝑥𝑥)] = � ℎ(𝑥𝑥)𝑓𝑓(𝑥𝑥)
𝑥𝑥
17
Example 3.9 | Digital Channel
› In Example 3.7, 𝑋𝑋 is the number of bits received in error of the next 4 transmitted.
› The probabilities are shown in the table in the 𝑓𝑓 𝑥𝑥 column.
› What is the expected value of the square of the number of bits in error?
› ℎ 𝑋𝑋 = 𝑋𝑋 2
18
Discrete Uniform Distribution
19
Mean and Variance of Discrete Uniform
Distribution
› Let 𝑋𝑋 be a discrete random variable ranging from 𝑎𝑎, 𝑎𝑎 + 1, 𝑎𝑎 + 2, … , 𝑏𝑏,
𝑓𝑓𝑓𝑓𝑓𝑓 𝑎𝑎 ≤ 𝑏𝑏.
› There are 𝑏𝑏 – (𝑎𝑎 − 1) values in the inclusive interval.
› Therefore 𝑓𝑓(𝑥𝑥) = 1/(𝑏𝑏 − 𝑎𝑎 + 1)
20
Example 3.11 | Number of Voice Lines
Let the random variable 𝑋𝑋 denote the number of the 48 voice lines that are in use at a
particular time. Assume that 𝑋𝑋 is a discrete uniform random variable with a range of 0
to 48.
Find 𝐸𝐸(𝑋𝑋) & 𝜎𝜎.
21
Simple but
most
important!
Bernoulli test
› Models one trial in an experiment that can result in either
success or failure
› A random variable 𝑋𝑋 has a Bernoulli distribution with
parameter 𝑝𝑝 if: Give me
examples of
– 𝑋𝑋 takes the values 0 and 1. random
experiments
– 𝑃𝑃(𝑋𝑋 = 1) = 𝑝𝑝 and 𝑃𝑃 (𝑋𝑋 = 0) = 1 − 𝑝𝑝 that fit
Bernoulli
Binomial Distribution: A random experiment consists of n Bernoulli trials
› Suppose we are interested in the probability of seeing exactly 5
errors in a stream of 20 transmitted bits or we draw 7 parts (with
replacement) from a batch of machined parts and want to know
how often we expect to see a defective part.
Bernoulli
› The 4 Characteristics of Binomial Experiments
– There must be a fixed number of trials, which we typically denote by n. (e.g.,
number of bits in stream, machined parts in a batch, number of students, etc)
– Each trial can have only two outcomes, which we frequently refer to as
success and failure. (e.g., seeing an error vs. not seeing an error, getting
“defective" vs. getting “non-defective“ parts, etc.)
– The outcomes of each trial are independent of each other (e.g., knowledge of
a previous bit, or flaws in a drawn part, with replacement does not affect the
probabilities of doing the same a second time.)
– The probability of success (and failure) remain the same for each trial. We
denote the probability of success by p and the probability of failure by q=1-p.
(e.g., for an error in a single bit, p=0.01,q=0.99)
23
Binomial Distribution
The random variable 𝑋𝑋 that equals the number of trials that result in
a success is a binomial random variable with parameters
0 < 𝑝𝑝 < 1 and 𝑛𝑛 = 1, 2, … .
24
Example 3.15a: Organic Pollution
Each sample of water has a 10% chance 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.
Answer: Let 𝑋𝑋 denote the number of samples that contain the pollutant in the next
18 samples analyzed. Then 𝑋𝑋 is a binomial random variable with 𝑝𝑝 = 0.1 and 𝑛𝑛 =
18.
18
𝑃𝑃 𝑋𝑋 = 2 = 0.12 1 − 0.1 18−2 = 153 0.1 2 0.9 16 = 0.2835
2
In Microsoft Excel®, use the BINOM.DIST function to calculate 𝑃𝑃 𝑋𝑋 = 2 by:
25
Example 3.15b: Organic Pollution
Determine the probability that at least 4 samples contain the pollutant.
Answer: The problem calls for calculating 𝑃𝑃 𝑋𝑋 ≥ 4 but is easier to calculate the
complementary event, 𝑃𝑃 𝑋𝑋 ≤ 3 , so that:
3
18
𝑃𝑃 𝑋𝑋 ≥ 4 = 1 − � 0.1𝑥𝑥 0.9 18−𝑥𝑥 = 1 − 0.150 + 0.300 + 0.284 + 0.168 = 0.098
𝑥𝑥
𝑥𝑥=0
Answer:
6
18
𝑃𝑃 3 ≤ 𝑋𝑋 < 7 = � 0.1𝑥𝑥 0.9 18−𝑥𝑥 = 0.168 + 0.070 + 0.022 + 0.005 = 0.265
𝑥𝑥
𝑥𝑥=3
= 𝐁𝐁𝐁𝐁𝐁𝐁𝐁𝐁𝐁𝐁. 𝐃𝐃𝐃𝐃𝐃𝐃𝐃𝐃 𝟔𝟔, 𝟏𝟏𝟏𝟏, 𝟎𝟎. 𝟏𝟏, 𝐓𝐓𝐓𝐓𝐓𝐓𝐓𝐓 − 𝐁𝐁𝐁𝐁𝐁𝐁𝐁𝐁𝐁𝐁. 𝐃𝐃𝐃𝐃𝐃𝐃𝐃𝐃(𝟐𝟐, 𝟏𝟏𝟏𝟏, 𝟎𝟎. 𝟏𝟏, 𝐓𝐓𝐓𝐓𝐓𝐓𝐓𝐓)
27
Binomial Mean and Variance
If 𝑋𝑋 is a binomial random variable with parameters 𝑝𝑝 and 𝑛𝑛,
› The mean of 𝑋𝑋 is:
𝜇𝜇 = 𝐸𝐸(𝑋𝑋) = 𝑛𝑛𝑛𝑛
28
Example 3.16 | Binomial Mean and Variance
For the number of transmitted bits received in error in Example 3.13,
𝑛𝑛 = 4 and 𝑝𝑝 = 0.1. Find the mean and variance of the binomial
random variable.
Answer:
𝜇𝜇 = 𝐸𝐸 𝑋𝑋 = 𝑛𝑛𝑛𝑛 = 4 ⋅ 0.1 = 0.4
29
Drawing Without Replacement
› While drawing with replacement satisfies the independence criterion for a binomial experiment,
drawing without replacement does not!
› Consider the case where we draw 5 part from a batch that initially contains 10 defective parts
and 10 non-defective part.
– If our first part drawn is defective, the probability of drawing a second defective part is 9/19≈0.473.
– If our first part drawn is non-defective, the probability of drawing a defective part is 10/19≈0.526.
› Clearly, the flaws associated with the 1st and 2nd draws are not independent events.
› However, if we had 10000 defective parts and 10000 non-defective parts in our batch initially,
consider the probabilities involved.
– If the first part is defective, the probability the second is defective is 9999/19999≈0.49997
– If the first part is non-defective, the probability the second is defective is 10000/19999≈0.50003
31
Example 3.18 | Wafer Contamination
› The probability that a wafer contains a large particle of contamination is 0.01. Assume
that the wafers are independent. What is the probability that exactly 125 wafers need
to be analyzed before a particle is detected?
Let 𝑋𝑋 denote the number of samples analyzed until a large particle is detected. Then
𝑋𝑋 is a geometric random variable with parameter 𝑝𝑝 = 0.01.
32
Geometric Mean and Variance
33
Example 3.19 | Mean and Standard Deviation
› Consider the transmission of bits in Example 3.17.
› The probability that a bit transmitted through a digital transmission channel is received in
error is 𝑝𝑝 = 0.1.
› Assume that the transmissions are independent events, and let the random variable 𝑋𝑋
denote the number of bits transmitted until the first error. Find the mean and standard
deviation.
34
Lack of Memory Property
› For a geometric random variable, the trials are independent
– Count of the number of trials until the next success can be started at any trial without
changing the probability distribution of the random variable.
35
Example 3.20 | Lack of Memory Property
In Example 3.17, the probability that a bit is transmitted in error is 𝑝𝑝 = 0.1. Suppose 50 bits
have been transmitted. What is the mean number of bits transmitted until the next error?
The mean number of bits transmitted until the next error, after 50 bits have already
been transmitted, is 1/0.1 = 10, the same result as the mean number of bits until the
first error.
36
Poisson Distribution
› Suppose one expects to find on average λ randomly and
uniformly distributed objects or independent occurrences
of something in a given area, volume, measure of time,
etc
37
Examples of Poisson Distributions
› The number of cars that pass through a certain point on a road (sufficiently distant from traffic lights)
during a given period of time.
› The number of spelling mistakes one makes while typing a single page.
› The number of phone calls at a call center per minute.
› The number of times a web server is accessed per minute.
› The number of animals killed found per unit length of road.
› The number of mutations in a given stretch of DNA after a certain amount of radiation.
› The number of pine trees per unit area of mixed forest.
› The number of stars in a given volume of space.
› The number of soldiers killed by horse-kicks each year in each corps in the Prussian cavalry.
› The number of light bulbs that burn out in a certain amount of time.
› The number of viruses that can infect a cell in cell culture.
› The number of inventions invented over a span of time in an inventor's career.
› The number of particles that "scatter" off of a target in a nuclear or high energy physics experiment
Example 3.27a | Wire Flaws
› Flaws occur at random along the length of a thin copper wire.
› Let 𝑋𝑋 denote the random variable that counts the number of flaws in a length of 𝑇𝑇 𝑚𝑚𝑚𝑚 of
wire and suppose that the average number of flaws is 2.3 𝑝𝑝𝑝𝑝𝑝𝑝 𝑚𝑚𝑚𝑚.
› Find the probability of exactly 10 𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓 𝑖𝑖𝑖𝑖 5 𝑚𝑚𝑚𝑚 of wire.
Let 𝑋𝑋 denote the number of flaws in 5 mm of wire. Then 𝑋𝑋 has the Poisson distribution
with
Therefore,
Let 𝑋𝑋 denote the number of flaws in 2 mm of wire. Then 𝑋𝑋 has the Poisson distribution
with
Therefore,
› The mean and variance of the Poisson model are the same.
› For example, if particle counts follow a Poisson distribution with a mean of
25 particles per square centimeter, the variance is also 25 and the
standard deviation of the counts is 5 per square centimeter.
› If the variance of a data is much greater than the mean, then the Poisson
distribution would not be a good model for the distribution of the random
variable.
Sec 3.8 Poisson Distribution
41
Poisson Distribution ~ Binomial Distribution
› The Poisson distribution is actually a limiting case of a
Binomial distribution when the number of trials, n, gets
very large and p, the probability of success, is small.