Math 301 CH 3 & CH 4 Random Variables
Math 301 CH 3 & CH 4 Random Variables
Chapter 3
Random Variables and Probability
Distributions
&
Chapter 4
Mathematical Expectation
Prepared by:
Dr. Walaa El Sharkawy
Contents
1. Introduction.
2. Random variable.
3. Discrete Random variable.
4. Continuous Random variable.
5. Mathematical Expectation.
Introduction
Note that:
➢ Capital letters, such as X,Y, Z,…will be used to denote random
variables.
➢ Random variable is classified as discrete and continuous.
Random variable
➢ Discrete variable: A variable whose values are either finite or countably
infinite.
Example:
1- Number of children in a family
2- The number of houses in a certain block.
3- The number of defectives in a sample of k items.
2) σ𝒙 𝒇 𝒙 = 𝟏
Discrete Random Variable
Example: Suppose that the random variable 𝑋 denotes the number of boys in
all families with two children. Construct the probability distribution of 𝑋.
Discrete Random Variable
Solution:
𝑆 = {𝐵𝐵, 𝐵𝐺, 𝐺𝐵, 𝐺𝐺}
𝑋: 0, 1, 2
1
𝑃 𝑋 = 0 = 𝑃 {𝐺𝐺} =
4
2
𝑃 𝑋 = 1 = 𝑃 𝐵𝐺, 𝐺𝐵 =
4
1
𝑃 𝑋 = 2 = 𝑃 𝐵𝐵 =
4
Discrete Random Variable
Solution:
𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 𝐷𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛: 𝑇𝑎𝑏𝑢𝑙𝑎𝑟 𝐹𝑜𝑟𝑚 & Graphical Form
Discrete Random Variable
Example: A shipment of 20 similar laptop computers to a retail outlet contains
3 that are defective. If a school makes a random purchase of 2 of these
computers, find the probability distribution for the number of defectives.
Discrete Random Variable
Solution:
• Let D be the event that represent the defective computers
purchased by the school.
• Let 𝑿 be a random variable whose values 𝒙 are the possible
numbers of defective computers purchased by the school.
• 𝒙 can only take the numbers 0, 1, and 2.
𝟏𝟔 𝟏𝟕 𝟔𝟖
ഥ𝟏 ∩ 𝑫
𝒇 𝟎 = 𝑷 𝑿 = 𝟎 = P(𝑫 ഥ 𝟐 ) = P (𝑫
ഥ 𝟐 |𝑫
ഥ 𝟏) 𝑷 𝑫
ഥ𝟏 = =
𝟏𝟗 𝟐𝟎 𝟗𝟓
ഥ 𝟏 ∩ 𝑫𝟐 ) + P(𝑫
𝒇 𝟏 = 𝑷 𝑿 = 𝟏 = P(𝑫 ഥ 𝟐 ∩ 𝑫𝟏 )
𝟑 𝟏𝟕 𝟏𝟕 𝟑 𝟓𝟏
ഥ 𝟏 )P(𝑫
= P(𝑫𝟐 |𝑫 ഥ 𝟏 )+P(𝑫
ഥ 𝟐 |𝑫𝟏 )P(𝑫𝟏 ) = + =
𝟏𝟗 𝟐𝟎 𝟏𝟗 𝟐𝟎 𝟏𝟗𝟎
𝟐 𝟑 𝟑
𝒇 𝟐 = 𝑷 𝑿 = 𝟐 = P(𝑫𝟏 ∩ 𝑫𝟐 ) =P(𝑫𝟐 |𝑫𝟏 )P(𝑫𝟏) = =
𝟏𝟗 𝟐𝟎 𝟏𝟗𝟎
𝑭 𝒙 = 𝑷 𝑿 ≤ 𝒙 = 𝒇(𝒙𝒊 )
𝒊:𝒙𝒊 ≤𝒙
Discrete Random Variable
Note that:
➢ The function 𝑭 𝒙 is sometimes referred to simply as the distribution
function of X.
1- Find the cumulative distribution function of the X and plot both 𝒇(𝒙) and 𝑭(𝒙).
2- Using 𝑭(𝒙), verify that 𝒇(𝟐) = 𝟑/𝟖.
Solution:
𝒙 0 1 2 3 4
𝒇 𝒙 1/16 1/4 3/8 1/4 1/16
Discrete Random variable
Solution:
𝟏
𝑭 𝟎 = 𝑷 𝑿 ≤ 𝟎 = 𝒇(𝟎) =
𝟏𝟔
𝟓
𝑭 𝟏 =𝑷 𝑿≤𝟏 =𝒇 𝟎 + 𝒇 𝟏 =
𝟏𝟔
𝟏𝟏
𝑭 𝟐 = 𝑷 𝑿 ≤ 𝟐 = 𝒇(𝟎) + 𝒇(𝟏) + 𝒇(𝟐) =
𝟏𝟔
𝟏𝟓
𝑭 𝟑 =𝑷 𝑿≤𝟑 =𝒇 𝟎 + 𝒇 𝟏 + 𝒇 𝟐 + 𝒇 𝟑 =
𝟏𝟔
𝑭 𝟒 = 𝑷 𝑿 ≤ 𝟒 = 𝒇 𝟎 + 𝒇 𝟏 + 𝒇 𝟐 + 𝒇 𝟑 + 𝒇 𝟒 = 𝟏.
Hence,
𝟎, 𝒙<𝟎
𝟏
, 𝟎≤𝒙<𝟏
𝟏𝟔
𝟓
, 𝟏≤𝒙<𝟐
𝑭 𝒙 = 𝟏𝟔
𝟏𝟏
, 𝟐≤𝒙<𝟑
𝟏𝟔
𝟏𝟓
, 𝟑≤𝒙<𝟒
𝟏𝟔
𝟏, 𝒙≥𝟒
Discrete Random variable
Note that:
➢ 𝒇(𝒄), the value of the p.d.f. of X at 𝒄, does not give 𝑷(𝑿 = 𝒄) as in the discrete case. In
connection with continuous r.v.'s, probabilities are always associated with intervals and
𝑷 𝑿 = 𝒄 = 𝟎, for any real constant 𝒄.
➢ It does not matter whether we include the endpoints of the interval from 𝒂 to 𝒃;
symbolically, 𝑷 𝒂 ≤ 𝑿 ≤ 𝒃 = 𝑷 𝒂 ≤ 𝑿 < 𝒃 = 𝑷 𝒂 < 𝑿 ≤ 𝒃 = 𝑷(𝒂 < 𝑿 < 𝒃)
Continuous Random variable
Example : If X has the p.d.f.
𝒌𝒆−𝟑𝒙 ; 𝒙 > 𝟎
𝒇 𝒙 =ቊ
𝟎 ; 𝒐. 𝒘.
Find:
1- The value of 𝒌.
2- 𝑷 (𝟎. 𝟓 < 𝑿 < 𝟏).
Continuous Random variable
Solution:
1- The value of 𝒌
∞ ∞
∵ −∞ 𝒇 𝒙 𝒅𝒙 = 𝟏 ⇒ 𝒌 𝒆 𝟎−𝟑𝒙 𝒅𝒙 = 𝟏⇒ 𝒌 = 𝟑
𝟏 𝟏
2- 𝑷 𝟎. 𝟓 < 𝑿 < 𝟏 = 𝟎.𝟓 𝟑𝒆−𝟑𝒙 𝒅𝒙 = −𝒆−𝟑𝒙 | = 𝒆−𝟏.𝟓 − 𝒆−𝟑 = 𝟎. 𝟏𝟕𝟑.
𝟎. 𝟓
Continuous Random variable
Solution:
For 𝒙 < 𝟎
𝒙
𝑭 𝒙 = න 𝟎 𝒅𝒕 = 𝟎
−∞
For 𝒙 ≥ 𝟎
𝟎 𝒙
𝑭 𝒙 = −∞ 𝟎𝒅𝒙 + 𝟑 𝒆 𝟎−𝟑𝒕 𝒅𝒕 = 𝟏 − 𝒆−𝟑𝒙
Then,
𝟎, 𝒙<𝟎
𝑭 𝒙 =ቊ
𝟏 − 𝒆−𝟑𝒙 , 𝒙 ≥ 𝟎
⇒ 𝑭 𝒙 = 𝟎. 𝟐𝒙 − 𝟎. 𝟎𝟎𝟓 𝒙𝟐 − 𝟏
Continuous Random variable
Solution:
• For the interval: 𝟐𝟎 ≤ 𝒙 < ∞
𝟎 𝟏𝟎 𝟐𝟎 𝒙
𝑭 𝒙 = න 𝟎 𝒅𝒕 + න 𝟎. 𝟎𝟏 𝒕 𝒅𝒕 + න 𝟎. 𝟎𝟏 𝟐𝟎 − 𝒕 𝒅𝒕 + න 𝟎 𝒅𝒕
−∞ 𝟎 𝟏𝟎 𝟐𝟎
=𝟏
Continuous Random variable
Solution:
𝟎 ; −∞ < 𝒙 < 𝟎
𝟎. 𝟎𝟎𝟓 𝒙𝟐 ; 𝟎 ≤ 𝒙 < 𝟏𝟎
𝑭 𝒙 =
𝟎. 𝟐𝒙 − 𝟎. 𝟎𝟎𝟓 𝒙𝟐 − 𝟏 ; 𝟏𝟎 ≤ 𝒙 < 𝟐𝟎
𝟏 ; 𝟐𝟎 ≤ 𝒙 < ∞
Continuous Random variable
Solution:
𝑷 𝑿 > 𝟖 = 𝑭 ∞ − 𝑭 𝟖 = 𝟏 − 𝟎. 𝟎𝟎𝟓 ∗ 𝟖𝟐 = 𝟎. 𝟔𝟖
𝑷 𝟓 < 𝑿 < 𝟏𝟓 = 𝑭 𝟏𝟓 − 𝑭 𝟓
𝑬 𝒙 = 𝒙𝒊 𝒇 𝒙𝒊
𝒊
Correspondingly, if X is a continuous r.v. with p.d.f. 𝒇(𝒙), the expected value of X
∞
is
𝑬 𝒙 = න 𝒙 𝒇 𝒙 𝒅𝒙
−∞
➢ In this definition it is assumed, of course, that the sum or the integral exists;
otherwise, the mathematical expectation is undefined.
Mathematical Expectation
Example : The probability distribution of X is given by,
𝒙 0 1 2
𝒇(𝒙) 12/22 9/22 1/22
𝟏𝟐 𝟗 𝟏 𝟏
𝑬 𝒙 = 𝟎 ∗ + 𝟏 ∗ + 𝟐 ∗ =
𝟐𝟐 𝟐𝟐 𝟐𝟐 𝟐
Mathematical Expectation
Example: Certain coded measurements of the pitch diameter of threads of a
fitting have the following p.d.f.
𝟒
;𝟎 < 𝒙 < 𝟏
𝒇 𝒙 = ൞𝝅 𝟏 + 𝒙𝟐
𝟎 ; 𝒐. 𝒘.
Find the expected value of this r.v.
Solution:
𝟏
𝟒 𝟏 𝒙𝒅𝒙 𝟐
𝑬 𝒙 = න 𝒙𝒇 𝒙 𝒅𝒙 = න 𝟐
= ln 𝟐 = 𝟎. 𝟒𝟒
𝟎 𝝅 𝟎 𝟏+𝒙 𝝅
Mathematical Expectation
Definition: If X is a r.v. then the expected value of 𝒈 𝑿 is given by
𝒈 𝒙𝒊 𝒇 𝒙𝒊 ; 𝒊𝒇 𝑿 𝒊𝒔 𝒅𝒊𝒔𝒄𝒓𝒆𝒕𝒆
𝑬𝒈 𝑿 = 𝒊
∞
න 𝒈 𝒙 𝒇(𝒙)𝒅𝒙 ; 𝒊𝒇 𝑿 𝒊𝒔 𝒄𝒐𝒏𝒕𝒊𝒏𝒖𝒐𝒖𝒔
−∞
Mathematical Expectation
Example : If X is the number of points rolled with a fair die, find the expected
value of 𝒈 𝒙 = 𝟐𝒙𝟐 + 𝟏
Solution:
𝟔
𝟏 𝟗𝟒
𝟐
𝑬𝒈 𝑿 = 𝒈 𝒙𝒊 𝒇(𝒙𝒊 ) = 𝟐𝒙 + 𝟏 ∗ =
𝟔 𝟑
𝒊 𝒙=𝟏
Mathematical Expectation
Example : If The p.d.f. of the r.v. X is given by:
𝒌𝒙 𝟏 − 𝒙𝟐 ; 𝟎<𝒙<𝟏
𝒇(𝒙) = ൝
𝟎; 𝒐. 𝒘.
∞ 𝟏
𝟏
𝑬 𝑿𝟐 = න 𝒙𝟐 𝒇(𝒙)𝒅𝒙 = 𝟒 න 𝒙𝟑 𝟏 − 𝒙𝟐 𝒅𝒙 =
−∞ 𝟎 𝟑
Mathematical Expectation
Properties: If 𝒄, 𝒄𝟏 and 𝒄𝟐 are constants, then:
1- 𝑬 𝒄 = 𝒄,
2- 𝑬 𝒄𝒈 𝑿 = 𝒄𝑬 𝒈 𝑿 ,
3- 𝑬 𝒄𝟏𝒈𝟏 𝑿 + 𝒄𝟐𝒈𝟐 𝑿 = 𝒄𝟏𝑬 𝒈𝟏 𝑿 + 𝒄𝟐𝑬[𝒈𝟐(𝑿)]
Mathematical Expectation
Example: If The p.d.f. of the r.v. X is given by:
𝟐 𝟏−𝒙 ; 𝟎<𝒙<𝟏
𝒇(𝒙) = ቊ
𝟎; 𝒐. 𝒘.
𝟐
1- Show that 𝑬( 𝑿𝒓 ) = , and
(𝒓+𝟏) (𝒓+𝟐)
𝟖 𝟖
𝑬 𝟐𝑿 + 𝟏 𝟐 = 𝑬 𝟒𝑿𝟐 + 𝟒𝑿 + 𝟏 = 𝟒𝑬 𝑿𝟐 + 𝟒𝑬 𝑿 + 𝟏 = + +𝟏=𝟑
𝟏𝟐 𝟔
Mean and Variance
Definition: The mean of X or the mean of the distribution of X, denoted by
μ is given by:
𝝁 = 𝑬(𝑿)
➢ The mean of X is of special importance in statistics because it describes
where the probability distribution is centered.
𝝈𝟐 = 𝒗𝒂𝒓 𝑿 = 𝑬( 𝑿 − 𝝁 𝟐 )
And the positive square root of the variance, 𝝈 is called the standard deviation.
Mean and Variance
Note that:
➢ An alternative and preferred formula for finding 𝝈𝟐, which often simplifies the
calculations, is given as follows
𝝈𝟐 = 𝑬[𝑿𝟐] − 𝝁𝟐
Mean and Variance
Example : The weekly demand for Pepsi, in thousands of liters, from a local
chain of efficiency stores, is a continuous r.v. X having the p.d.f.
𝟐 𝒙−𝟏 ; 𝟏<𝒙<𝟐
𝒇(𝒙) = ቊ
𝟎; 𝒐. 𝒘.
Solution:
𝟐
𝟓
𝑬 𝑿 = න 𝟐𝒙 𝒙 − 𝟏 𝒅𝒙 =
𝟏 𝟑
𝟐
𝟐𝟓 𝟏𝟕 𝟐𝟓 𝟏
𝝈𝟐 = 𝑬 𝑿𝟐 − 𝝁𝟐 = න 𝟐𝒙𝟐 𝒙 − 𝟏 𝒅𝒙 − = − =
𝟏 𝟗 𝟔 𝟗 𝟏𝟖
Mean and Variance
Property: If 𝒂 and b are constants, then
𝝈𝟐𝒂𝑿+𝒃 = 𝒂𝟐𝝈𝟐
or
𝒗𝒂𝒓 𝒂𝑿 + 𝒃 = 𝒂𝟐𝒗𝒂𝒓 𝑿
Solution:
𝑉𝑎𝑟 5𝑋 + 6 = 25 𝑉𝑎𝑟 𝑋 = 25/18