Wa0007.
Wa0007.
THEORY
CHAPTER 3
• Discrete Random Variables and Their Distribution
Functions
Random Variables
• In performing experiments, it often happens that we are not
interested in the actual outcome of the experiment but rather in
some function of the outcome.
• Thus, if a coin is tossed n times, one is interested in the total number
of heads or tails observed not in the 2n ordered outcomes in the
sample space.
• In the game of chance one is interested in the net gain or loss of a
certain player
Cont.
• Random variables are classified as either Discrete or Continuous. A
discrete R.V. is one which can take on only a finite or countably
infinite number of distinct values. A r.v. is said to be continuous in a
given range if it can assume any value in that range.
Random Variables
• A random variable defined on the sample space of a random
experiment can be thought of as a rule that associates a real number
with every possible outcome (or element of S).
• Definition: A random variable X takes on various variables arbitrarily
with probabilities specified with its probability distributions. The
range of X is denoted by Rx.
Cont.
• Since random variables are some special mathematical function of
some sort, we use a functional notation. Let ω (omega) be a generic
element of the sample space, then X(ω) will be the functional
representation of the random variable X.
• We use capital letters like U, V, W, etc. to represent random variables
and lower case letters like x, y, z etc. to represent a particular value in
the range of a random variable.
Example
• We roll a pair of dice 1 time. Let X(.) be the sum of the two numbers
that occur. Then the sample space is: S = ( x1, x2 ) : x1 = 1,2,...,6; x2 = 1,2,..6
• And we have defined X ( ) = x1 + x2 , for = ( x1 , x2 ) S .
• The range of X is Rx = {2, 3, …, 12}
• Consider an example of 3 flips of a fair coin. Suppose we are
interested in the number of heads, and we define the random
variable X as the number of heads observed.
• 𝑆 = {𝐻𝐻𝐻, 𝐻𝐻𝑇, 𝐻𝑇𝐻, 𝐻𝑇𝑇, 𝑇𝐻𝐻, 𝑇𝐻𝑇, 𝑇𝑇𝐻, 𝑇𝑇𝑇}
• The range of X is Rx = {0, 1, 2, 3}
Random Variables and Events
• The probability distribution for a discrete random variable, also called
a probability mass function of X is defined as
P X (.) = x = PX ( x ) , x Rx .
• The probability mass function of a discrete random variable X can be
easily found if X is defined on the sample space S and we know the
probability function for S.
• Let’s assume we have an experiment with sample space S and we
know probability function for S. For instance, suppose we have
S = 1 , 2 ,..., 7
Cont.
• And define the events
A = 1 , 3 , 4
B = 6 , 7
C = 2 , 5
• Then the probability function of X is:
P X = x1 = P ( A )
P X = x2 = P ( B )
P X = x3 = P ( C )
• Therefore, it is possible to find the probability function of a discrete
random variable because we know how to assign probabilities to events.
Example
• Suppose that a fair coin is tossed 3 times. Let the random variable X
be the number of heads observed.
• What is the sample space?
• What is the range of X?
• Find the probability distribution corresponding to the r.v. X.
• Construct a graph
Solution
• 𝑆 = 𝐻𝐻𝐻, 𝐻𝐻𝑇, 𝐻𝑇𝐻, 𝐻𝑇𝑇, 𝑇𝐻𝐻, 𝑇𝐻𝑇, 𝑇𝑇𝐻, 𝑇𝑇𝑇
1
• The probability of each outcome is since all the outcomes are equally
8
likely simple events. With each sample point we can associate a number of
X
Sample TTT TTH THT HTT HHT HTH THH HHH
Points
No. of 0 1 1 1 2 2 2 3
Heads
P(X = x) 1 1 1 1 1 1 1 1
8 8 8 8 8 8 8 8
• The Table shows that the r.v. can take the values 0, 1, 2, 3.
Example
• Suppose that a fair coin is tossed 3 times. Let the random variable X
be the number of heads observed.
• Then 𝑆 = 𝐻𝐻𝐻, 𝐻𝐻𝑇, 𝐻𝑇𝐻, 𝐻𝑇𝑇, 𝑇𝐻𝐻, 𝑇𝐻𝑇, 𝑇𝑇𝐻, 𝑇𝑇𝑇
• Then Rx = {0, 1, 2, 3}.
• We see that A = (TTT )
B = ( HTT ) , (THT ) , (TTH )
C = ( HHT ) , ( HTH ) , (THH )
D = ( HHH )
Cont.
• The probability function for X is
1
P X = 0 =
8
3
P X = 1 =
8
3
P X = 2 =
8
1
P X = 3 =
8
Probability Mass Function
• Now the Probability Mass Function of a discrete random variable can
be represented in a table as follows:
X 0 1 2 3 Total
P(X=x) 1/8 3/8 3/8 1/8 1
X 0 1 2 3 Total
P(X=x) 1/8 3/8 3/8 1/8 1
• Note that the above function is a true pdf and all the probabilities are
greater than 0.
Graph
Interpretation of Figure
• The figure clearly indicates that the events X = 1 and X = 2 are twice
as likely as the other two possible values.
Cont.
• If we wish to determine the probability that the discrete random
variable X is greater than or equal to a but less than or equal to b
(with a ≤ b), we only need to sum the probabilities of the occurrence
of the values a through b; that is
b
P (a X b) = P ( X = x)
x=a
Example
• Consider the experiment of throwing a pair of dice. We are interested
in the sum of the two numbers that occur. We know that X can
assume the numbers 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, and 12.
• What is the pmf of X?
• What is the probability that the number sum of numbers will be at
least 4 and at most 6?
• Find the probability that the sum will be at least 7.
• Find the probability that the sum will be at most 7.
Solution
𝒙 2 3 4 5 6 7 8 9 10 11 12 To
𝑃(𝑋 = 𝑥) 1/36 2/36 3/36 4/36 5/36 6/36 5/36 4/36 3/36 2/36 1/36 1
• 𝑃 4 ≤ 𝑋 ≤ 6 =?
• 𝑃(𝑋 ≥ 7)=?
• 𝑃 𝑋 ≤ 7 =?
Cont.
6
a ) P(4 X 6) = P( X = x) = PX ( x = 4) + PX ( x = 5) +PX ( x = 6)
x=4
12
b) P( X 7) = P( X = x)
x =7
7
c) P( X 7) = P( X = x)
x=2
Cont.
• The probability mass function of a discrete random variable X can be
represented in a table as follows:
x 0 1 2 3 4 5 Total
P(X = x) 1/6 5/18 2/9 1/6 1/9 1/18 1
• Any function of a real variable PX(x) that satisfies these two conditions
can serve as a probability mass function of a discrete random variable
X.
Example
1
x, if x Rx
g( x) = 10
0, otherwise
• 2. A discrete function
1
is given by
( 2 x + 3) , x = 1,2,3
PX ( x) = 21
0, elsewhere
2 = X 2 P( X ) − 2
Example
• Compute the variance and the standard deviation when a die is
rolled. = 3.5
• Recall , as computed in the previous example.
• Square each outcome and multiply by the corresponding probability,
sum those products and then subtract the square of the mean.
Expectation
• Another concept related to the mean for a probability distribution is
that of the expected value or expectation.
• It is used in various types of games of chance, in insurance, and other
areas such as decision theory.
Mathematical Expectation of Discrete
Variables
• Let 𝑥1 , 𝑥2 , … , 𝑥𝑛 be the range of a discrete r.v. 𝑋 which assumes the
value 𝑥𝑖 with the probability 𝑝 𝑥𝑖 , 𝑖 = 1,2, … 𝑛, then the
mathematical expectation of 𝑋 is given by
• 𝐸 𝑋 = σ 𝑥𝑖 𝑝 (𝑥𝑖 )
Cont.
• The formula for the expected value is the same as the formula for the
theoretical mean. The expected value, then, is the theoretical mean
of the probability distribution
• That is E (X ) =
Example
• Suppose that 4 children are planned in a family. Let the random
variable X stand for the number of boys. Discuss the probability
distribution of X.
• Find the mean and variance of the random variable X.
Exercise
• Recall an exercise on tossing a pair of dice and letting the random
variable X be the absolute difference of the two dots that appear.
• Find the expected value and the variance
Solution
• E(X) = 1.9444
• Var(X) = 2.0525
Variance of X
• Theorem: V (X ) = E( X 2
) − E ( X )
2
Var ( X ) = ( X − ) P[ X = x]
2
Exercise
• The probability mass function of a discrete random variable 𝑋is given
by
𝑥
,
𝑝 𝑥 =൝ 15 , 𝑥 = 1,2,3,4,5
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
FX ( x ) = P ( X x ) = P ( X = xi )
xi x
0, − x x1
p( x ) x1 x x2
1
p ( x1 ) + p ( x2 ) x2 x x3
F ( x ) = .
.
.
p ( x ) + p ( x ) + ... + p( x ) = 1 xn x +
1 2 n
Example
• A fair coin is tossed three times. Let 𝑋 represent the number of heads
which come up.
• (a) Find the cumulative distribution function and
• (b) Sketch its graph
Solution
• (a) To obtain the distribution function by definition, we need the
following steps:
• Step 1: Find the probability mass function of the random variable 𝑋.
The probability distribution of this example was:
𝒙𝒊
𝑝(𝒙𝒊 )
Solution
• (a) To obtain the distribution function by definition, we need the
following steps:
• Step 1: Find the probability mass function of the random variable 𝑋.
The probability distribution of this example was:
𝒙𝒊 0 1 2 3 Total
𝑝(𝒙𝒊 ) 1 3 3 1 1
8 8 8 8
0, t 0
1
, 0 t 1
8
1
FX ( t ) = , 1 t 2
2
7
8 , 2 t 3
1, t 3
Cont.
• The distribution function has the following properties:
a ) 0 FX ( t ) 1
b) lim FX ( t ) = 0, lim FX ( t ) = 1
t →− t →+
c) If a b, then FX ( a ) FX ( b ) .
Cont.
• All probability statements about a random variable X can be
evaluated from FX(t) by noting that
1.P ( X a ) = FX ( a )
2.P ( X a ) = 1 − FX ( a − )
3.P ( X a ) = 1 − P ( X a ) = 1 − FX (a )
4.P ( X a ) = P ( X a ) = FX (a −)
5.P ( a X b ) = P ( X b ) − P ( X a ) = FX ( b ) − FX ( a )
6.P ( X = a ) = P ( X a ) − P ( X a ) = FX ( a ) − FX ( a − )
Example
• The distribution function of a discrete random variable X is given by
0, k 1
0.1, 1 k 2
0.3, 2k3
FX ( k ) =
0.7, 3 k 4
0.8, 4k 5
1, k 5
• Find the probabilities:
• 𝑃 𝑋 = 2 ,𝑃 1 < 𝑋 ≤ 4 ,𝑃 𝑋 > 3
Example
• The cumulative distribution function of a discrete random variable X
is given by
0, k 1
0.1, 1 k 2
0.3, 2k3
FX ( k ) =
0.7, 3 k 4
0.8, 4k 5
1, k 5
σ 𝑥𝑖2 1+0+1+4 6
𝑋2 = = =
𝑛 4 4
σ 𝑥𝑖3 1+0+1+8 10
𝑋3 = = =
𝑛 4 4
σ 𝑥𝑖4 1+0+1+16 18
𝑋4 = = =
𝑛 4 4
The 𝑟 𝑡ℎ moment about the mean
• For a set of N numbers comprising of X1 , X 2 , … , X N , the r th moment
about the mean is defined as:
σ 𝑥𝑖 −𝑥ҧ 𝑟
• 𝑀𝑟 =
𝑛
σ 𝑥𝑖 −𝑥ҧ 1 σ 𝑥𝑖 −σ 𝑥ҧ ҧ 𝑥ҧ
𝑛𝑥−𝑛
𝑀1 = = = =0
𝑛 𝑛 𝑛
• Example:
• Suppose that the only 2 possible values of a random variable 𝑋 are
0 𝑎𝑛𝑑 1.
• Let 𝑃 𝑋 = 0 = 0.1
• 𝑃 𝑋 = 1 = 0.9
• Find the 𝑘 𝑡ℎ moment of the random variable 𝑋.
Solution
• 𝑋 is a discrete random variable because its possible values are
0 𝑎𝑛𝑑 1.
• Let 𝑘 be 1
E(X k
) = E ( X ) = x P[ X = x] = 0(0.1) + 1(0.9) = 0.9
3 3
Cont.
• Similarly, 𝐸 𝑥 4 = 𝐸 𝑥 5 = 𝐸 𝑥 𝑘 = 0.9
• What is the variance of X?
2 2 2
• 𝜎 =𝐸 𝑋 − 𝐸 𝑋 = 0.9 − 0.81 = 0.09
Theorem
• i) 𝑀1 = 𝐸 𝑥
• Ii) 𝑀2 = 𝛿 2 + 𝜇 2
Moment Generating Functions
• The moment generating function for a r.v 𝑋, denoted by Mx(t), is
given as: M X ( t ) = E etx for − t ,
where t is a rea l n umber
0 1 2 3 4
2 2 2 2 2
e 2 = + + + + + ...
0! 1! 2! 3! 4!
In General
0 1 2 3 4
(tx ) (tx ) (tx ) (tx ) (tx )
etx = + + + + + ...
0! 1! 2! 3! 4!
Mgf ( x) = M x (t ) = E e tx
Summary
• Discrete Distributions
M x (t ) = E (e tx
)= e P[ X = x ]
tx
overallx
• Continuous Distributions
M x (t ) = E (e tx
)= e tx
f X ( x ) dx
−
Example
• Given a probability distribution of some discrete distribution as
p X ( x) = (1 − )
1− x
x
, 0 x 1
x =0
Solution
1
M X (t ) = E (etx ) = etx x (1 − )1− x
x =0
30
M X (t ) = X = (1 / 10)dx
tx tx
e f ( x ) dx e
− 20
Solution
30
M X (t ) = X = (1 / 10)dx
tx tx
e f ( x ) dx e
− 20
e30t − e20t
=
10t
Another Example
• Let − x
e , x 0, 0
f X ( x) =
0, Otherwise
• Find the moment generating function of x.
Solution
M X (t ) =
−t
Chapter 4
Countinuous Random Variables - Introduction
• The probability that X falls between any two values 𝑎 𝑎𝑛𝑑 𝑏 is equal
to the area under the histogram between 𝑎 𝑎𝑛𝑑 𝑏. Because the
histogram in this case is represented by a curve, the probability would
be found by computing an integral.
• The random variable described here is an example of a continuous
random variable.
Countinuous Random Variables
• A random variable is continuous if its probabilities are given by areas
under a curve. The curve is called a probability density function for
the random variable. The probability density function is sometimes
called the probability distribution.
• Because the probability density function is a curve, the computations
of probabilities involve intergrals, rather than the sums that are used
in the discrete case.
Computing Probabilities with the Probability
Density Function
• Let 𝑋 be a continuous random variable. Let the function 𝑓(𝑥) be the
probability density function of 𝑋. Let 𝑎 𝑎𝑛𝑑 𝑏 be any two numbers,
with 𝑎 < 𝑏. Then
•𝑃 𝑎≤𝑋≤𝑏 =𝑃 𝑎≤𝑋<𝑏 =𝑃 𝑎<𝑋≤𝑏 =𝑃 𝑎<𝑋<𝑏
𝑏
• = 𝑓 𝑎 𝑥 𝑑𝑥 Equation 1
Cont.
• In addition,
𝑏
•𝑃 𝑋≤𝑏 =𝑃 𝑋<𝑏 = 𝑓 ∞ 𝑥 𝑑𝑥 𝑎𝑛𝑑 Equation 2
∞
•𝑃 𝑋≥𝑎 =𝑃 𝑋>𝑎 = 𝑥𝑑)𝑥(𝑓 𝑎 Equation 3
Cont.
• If 𝑓(𝑥) is the probability density function of a random variable 𝑋,
then the area under the entire curve from −∞ 𝑡𝑜 ∞ is the probability
that the value of 𝑋 is between −∞ 𝑎𝑛𝑑 ∞. This probability must be
equal to 1, because the value of 𝑋 is always between −∞ 𝑎𝑛𝑑 ∞.
Therefore the entire area under the curve 𝑓(𝑥) is equal to 1.
∞
• That is, −∞ 𝑓 𝑥 𝑑𝑥 = 1
Example
• a) Is the following a probability density function?
3e −3 x , 0 x
f X ( x) =
0, Otherwise
Example 1
• A hole is drilled in a sheet-metal component, and then a shaft is
inserted through the hole. The shaft clearance is equal to the
difference between the radius of the hole and the radius of the shaft.
Let the random variable 𝑋 denote the clearance, in millimetres. The
probability density function of 𝑋 is
1.25 1 − 𝑥 4 0<𝑥<1
• 𝑓 𝑥 =ቊ
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
• Is the above function a probability density function?
• Components with clearance larger than 0.8𝑚𝑚 must be scrapped.
What proportion of components are scrapped?
Solution
• The density function 𝑓 𝑥 𝑖𝑠 0 𝑓𝑜𝑟 𝑥 ≤ 0 𝑎𝑛𝑑 𝑓𝑜𝑟 𝑥 ≥ 1. This
indicates that the clearances are always between 0 𝑎𝑛𝑑 1𝑚𝑚. The
proportion of components that must be scrapped is 𝑃 𝑋 > 0.8 ,
which is equal to the area under the probability density function to
the right of 0.8.
1
• The area is given by 𝑃 𝑋 > 0.8 = 0.8 1.25 1 − 𝑥 4 𝑑𝑥 =?
Cont.
• The probability density function of 𝑋 is
1.25 1 − 𝑥 4 0<𝑥<1
• 𝑓 𝑥 =ቊ
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
0, x0
x
5
F ( x) = 1.25 x − , 0 x 1
5
1, x 1
Mean and Variance for Continuous Random
Variables
• The population mean and variance of a continuous random variable
are defined in the same way as those of a discrete random variable,
except that a probability density function is used instead of a
probability mass function.
• Let 𝑋 be a continuous random variable with probability density
function 𝑓 𝑥 . Then the mean of 𝑋 is given by
The Mean
∞
• 𝜇𝑥 = −∞ 𝑥𝑓 𝑥 𝑑𝑥
• The mean is sometimes called the expectation or the expected value
of 𝑋, and may be denoted by 𝐸(𝑋) or by 𝜇.
The Variance
• Let 𝑋 be a continuous random variable with probability density
function 𝑓 𝑥 . Then
• The variance of 𝑋 is given by
∞ 2
•𝑉 𝑋 = −∞ 𝑥 − 𝜇𝑥 𝑓 𝑥 𝑑𝑥
• Alternative formula for the variance is given by
∞ 2 2
•𝑉 𝑥 = −∞ 𝑥 𝑓 𝑥 𝑑𝑥 − 𝐸 𝑋
Example
• Find the mean and variance of the clearance.
Example
Let a probability density function be given by:
3e −3 x , 0 x
f X ( x) =
0, Otherwise
𝑥
•𝐹 𝑥 =𝑃 𝑋≤𝑥 = −∞ 𝑓 𝑡 𝑑𝑡
Exercise
• 1. The hydrogenation of benzene to cyclohexane is promoted with a
finely divided porous nickel catalyst. The catalyst particles can be
considered to be spheres of various sizes. All the particles have
masses between 10 𝑎𝑛𝑑 70 𝜇𝑔. Let 𝑋 be the mass of a randomly
chosen particle. The probability density function of 𝑋 is given by
𝑥−10
, 10 < 𝑥 < 70
𝑓 𝑥 = ቐ 1800
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Cont.
• A) What proportion of particles have masses less than 50𝜇𝑔?
• B) Find the mean mass of the particles.
• C) Find the standard deviation of the particles masses.
• Find the cumulative distribution function of the particle masses.
Cont.
• 2. A process that manufactures piston rings produces rings whose
diameters (in centimeters) vary according to the probability density
function
3 3 − 16 𝑥 − 10 2 , 9.75 < 𝑥 < 10.25
𝑓 𝑥 =ቊ
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
• Is the above function a probability density function?
• Find the mean and standard deviation of diameter of rings
manufactured by this process.
Test 1, Thursday, 20 February 2025
• Venue: ETF 3