Lectures 5 & 6
Distribution of function of random variables
* Given that 𝑋 is a random variable with 𝑝𝑑𝑓 𝑓(𝑥). Let 𝑌 = 𝑢(𝑋) be a function
of 𝑋. What is the 𝑝𝑑𝑓 of 𝑌 ?
* Given that 𝑋1 and 𝑋2 are two random variables with joint 𝑝𝑑𝑓 𝑓(𝑥1 , 𝑥2 ). Let
𝑌1 = 𝑢1 (𝑋1 , 𝑋2 ) be a function of 𝑋1 and 𝑋2 . What is the 𝑝𝑑𝑓 of 𝑌1 ?
Define another function of 𝑋1 and 𝑋2 (𝑌2 = 𝑢2 (𝑋1 , 𝑋2 ), say). What is the
joint 𝑝𝑑𝑓 of 𝑌1 and 𝑌2 ?
* Given that 𝑋1 , 𝑋2 , … , 𝑋𝑛 are 𝑛 random variables with joint 𝑝𝑑𝑓
𝑓(𝑥1 , 𝑥2 , … , 𝑥𝑛 ). Define 𝑌 = 𝑢1 (𝑋1 , 𝑋2 , … , 𝑋𝑛 ) to be a function of 𝑋1 ,
𝑋2 , … , 𝑋𝑛 . What is the 𝑝𝑑𝑓 of 𝑌 ?
There are three methods to answer such of the above questions:
1. Distribution Function Method
2. Transformation Method
3. Moment generating Function (MGF) Method
Distribution Function Method
Definition: If 𝑋 is a random variable with 𝑝𝑑𝑓 𝑓(𝑥) then the distribution
function (or cumulative distribution function, 𝑐𝑑𝑓) of 𝑋 is defined by
𝐹𝑋 (𝑥) = 𝑃(𝑋 ≤ 𝑥), ∀𝑥
* If 𝑋 is a continuous random variable then
1
𝑑𝐹𝑋 (𝑥)
𝑓(𝑥) = = 𝐹𝑋′ (𝑥).
𝑑𝑥
Example 1: Let 𝑋 be a random variable with 𝑝𝑑𝑓
2𝑥 , 0 < 𝑥 < 1
𝑓(𝑥) = {
0 , 𝑜. 𝑤
Find
1. 𝑃(𝑋 ≤ −1) 2. 𝑃(𝑋 ≤ 0.6) 3. 𝑃(𝑋 ≤ 3) 4. 𝐹𝑋 (𝑥)
5. the 𝑝𝑑𝑓 of 𝑌 = 2𝑋 + 1 by using the distribution function method.
6. the 𝑝𝑑𝑓 of 𝑌 = 1 − 2𝑋 by using the distribution function method.
Solution:
−1 −1
1. 𝑃(𝑋 ≤ −1) = ∫−∞ 𝑓(𝑥)𝑑𝑥 = ∫−∞ 0 𝑑𝑥 = 0.
0.6
2. 𝑃(𝑋 ≤ 0.6) = ∫−∞ 𝑓(𝑥)𝑑𝑥
0 0.6
= ∫ 0 𝑑𝑥 + ∫ 2𝑥𝑑𝑥
−∞ 0
0.6
= 0 + ∫ 2𝑥𝑑𝑥
0
= 0.62 = 0.36
−3
3. 𝑃(𝑋 ≤ 3) = ∫−∞ 𝑓(𝑥)𝑑𝑥
0 1 3
= ∫ 0𝑑𝑥 + ∫ 2𝑥𝑑𝑥 + ∫ 0𝑑𝑥
−∞ 0 1
1
= 0 + ∫ 2𝑥𝑑𝑥 + 0
0
=1
4. 𝐹𝑋 (𝑥) = 𝑃(𝑋 ≤ 𝑥), ∀ 𝑥 ∈ (−∞, ∞)
2
0, 𝑥<0
𝐹𝑋 (𝑥) = {𝑥 2 , 0 ≤ 𝑥 < 1
1, 𝑥≥1
5. 𝑌 = 2𝑋 + 1. If 0 < 𝑥 < 1 then 1<𝑦<3
Note that: If you take all values of 𝑥 ∈ (−∞, ∞) then 𝑦 ∈ (−∞, ∞).
To find the 𝑝𝑑𝑓 of 𝑌 by using the distribution function method, we need first
to find the distribution function of 𝑌. Let 𝐺𝑌 (𝑦) be the distribution function of
𝑌 then,
𝐺𝑌 (𝑦) = 𝑃(𝑌 ≤ 𝑦), ∀ 𝑦 ∈ (−∞, ∞)
= 𝑃(2𝑋 + 1 ≤ 𝑦)
𝑦−1
= 𝑃 (𝑋 ≤ )
2
0 , 𝑦<1
𝑦−1 2
= ( ) , 1≤𝑦<3
2
{ 1 , 𝑦≥3
Now, the 𝑝𝑑𝑓 of 𝑌 can be obtained by deriving 𝐺𝑌 (𝑦) with respect to 𝑦. The
𝑝𝑑𝑓 of 𝑌 is,
𝑑𝐺𝑌 (𝑦)
𝑔𝑌 (𝑦) = = 𝐺𝑌′ (𝑦)
𝑑𝑦
𝑦−1
={ 2 , 1<𝑦<3
0 𝑜. 𝑤
6. 𝑌 = 1 − 2𝑋. If 0 < 𝑥 < 1 then −1 < 𝑦 < 1
Again, if 𝑥 ∈ (−∞, ∞) then 𝑦 ∈ (−∞, ∞).
Let 𝐺𝑌 (𝑦) be the distribution function of 𝑌 then,
𝐺𝑌 (𝑦) = 𝑃(𝑌 ≤ 𝑦), ∀ 𝑦 ∈ (−∞, ∞)
= 𝑃(1 − 2𝑋 ≤ 𝑦)
1−𝑦
= 𝑃 (𝑋 ≥ )
2
3
0 , 𝑦 < −1
1
= ∫1−𝑦2𝑥𝑑𝑥 , −1 ≤ 𝑦 < 1
2
{ 1 , 𝑦≥1
0 , 𝑦 < −1
1−𝑦 2
= 1−( ) , −1 ≤ 𝑦 < 1
2
{ 1 , 𝑦≥1
The 𝑝𝑑𝑓 of 𝑌 is,
𝑑𝐺𝑌 (𝑦)
𝑔𝑌 (𝑦) = = 𝐺𝑌′ (𝑦)
𝑑𝑦
1−𝑦
= { 2 , −1 < 𝑦 < 1
0 , 𝑜. 𝑤
Example 2: Let 𝑋 be a continuous random variable with 𝑝𝑑𝑓 𝑓𝑋 (𝑥) and
distribution function 𝐹𝑋 (𝑥). Find the 𝑝𝑑𝑓 of 𝑌 = 𝑋 2 in terms of 𝑓𝑋 by using the
distribution function method.
Solution: Let 𝐺𝑌 (𝑦) be the distribution function of 𝑌 then,
𝐺𝑌 (𝑦) = 𝑃(𝑌 ≤ 𝑦)
= 𝑃(𝑋 2 ≤ 𝑦)
= 𝑃(−√𝑦 ≤ 𝑋 ≤ √𝑦)
= 𝑃(𝑋 ≤ √𝑦) − 𝑃(𝑋 ≤ −√𝑦)
= 𝐹𝑋 (√𝑦) − 𝐹𝑋 (−√𝑦)
The 𝑝𝑑𝑓 of 𝑌 is,
𝑔𝑌 (𝑦) = 𝐺𝑌′ (𝑦)
1 −1
= 𝑓𝑋 (√𝑦) − 𝑓𝑋 (−√𝑦)
2√𝑦 2 √𝑦
1
= (𝑓𝑋 (√𝑦) + 𝑓𝑋 (−√𝑦))
2 √𝑦
4
Example 3: Let 𝑋 be a random variable with 𝑝𝑑𝑓
1
𝑓𝑋 (𝑥) = {2 , −1 < 𝑥 < 1
0 , 𝑜. 𝑤
Find the 𝑝𝑑𝑓 of 𝑌 = 𝑋 2 .
Solution: If −1 < 𝑥 < 1 then 0 < 𝑦 < 1.
Note that: 𝑥 ∈ (−1,1) = (−1,0) ∪ (0,1). If 𝑥 ∈ (−1,0) then 𝑦 ∈ (0,1) and if
𝑥 ∈ (0,1) then 𝑦 ∈ (0,1).
Let 𝑔𝑌 (𝑦) be the 𝑝𝑑𝑓 of 𝑌, then (by using the result of the last example)
1
𝑔𝑌 (𝑦) = (𝑓𝑋 (√𝑦) + 𝑓𝑋 (−√𝑦)) , 0<𝑦<1
2 √𝑦
1 1 1
= ( + )
2 √𝑦 2 2
1
=
2 √𝑦
Therefore,
1
, 0<𝑦<1
𝑔𝑌 (𝑦) = {2√𝑦
0 , 𝑜. 𝑤
Example 4: Let 𝑋 be a random variable with 𝑝𝑑𝑓
𝑒 −𝑥 , 𝑥 > 0
𝑓𝑋 (𝑥) = { . Note that: 𝑋~exp(1)
0 , 𝑜. 𝑤
Find the 𝑝𝑑𝑓 of 𝑌 = 𝑋 2 .
Solution: If 𝑥 > 0 then 𝑦 > 0.
Let 𝑔𝑌 (𝑦) be the 𝑝𝑑𝑓 of 𝑌, then
5
1
𝑔𝑌 (𝑦) = (𝑓𝑋 (√𝑦) + 𝑓𝑋 (−√𝑦)) , 𝑦>0
2 √𝑦
1
= (𝑒 −√𝑦 + 0)
2 √𝑦
1
= 𝑒 −√𝑦
2 √𝑦
Therefore,
1
𝑒 −√𝑦 , 𝑦 > 0
𝑔𝑌 (𝑦) = {2√𝑦
0 , 𝑜. 𝑤
Example 5: Let 𝑋 be a random variable with 𝑝𝑑𝑓
𝑥2
𝑓𝑋 (𝑥) = { 3 , −1 < 𝑥 < 2
0 , 𝑜. 𝑤
Find the 𝑝𝑑𝑓 of 𝑌 = 𝑋 2 .
Solution: If −1 < 𝑥 < 2 then 0 < 𝑦 < 4.
Note (1): 𝑥 ∈ (−1,2) = (−1,0) ∪ (0,2). If 𝑥 ∈ (−1,0) then 𝑦 ∈ (0,1) and if
𝑥 ∈ (0,2) then 𝑦 ∈ (0,4). Therefore, if 𝑥 ∈ (−1,2) = (−1,0) ∪
(0,2) then 𝑦 ∈ (0,1) ∪ (0,4) = (0,4)
Let 𝑔𝑌 (𝑦) be the 𝑝𝑑𝑓 of 𝑌, then
1
𝑔𝑌 (𝑦) = (𝑓𝑋 (√𝑦) + 𝑓𝑋 (−√𝑦)) , 0<𝑦<4
2 √𝑦
Note (2): If 0 < 𝑦 < 4 then 0 < √𝑦 < 2 and −2 < −√𝑦 < 0.
(√𝑦)2
Note (3): If 0 < √𝑦 < 2 then 𝑓𝑋 (√𝑦) = .
3
6
0, −2 < −√𝑦 < −1
Note (4): If −2 < −√𝑦 < 0 then 𝑓𝑋 (−√𝑦) = {(−√𝑦)2
, −1 < −√𝑦 < 0
3
Therefore, we need to divide the range of 𝑦 and the 𝑝𝑑𝑓 of 𝑌 is given as
follows:
2 2
1 (√𝑦) (−√𝑦)
( + ), 0 < 𝑦 < 1
2 √𝑦 3 3
𝑔𝑌 (𝑦) = 2
1 (√𝑦)
( + 0) , 1<𝑦<4
2 √𝑦 3
{ 0 , 𝑜. 𝑤
√𝑦
, 0<𝑦<1
3
= √𝑦
, 1<𝑦<4
6
{0 , 𝑜. 𝑤
Example 6: Let 𝑋1 , 𝑋2 be a random sample (𝑋1 , 𝑋2 is a random sample means
𝑋1 , 𝑋2 are independent and identically distributed (iid)) from 𝑒𝑥𝑝(1).
1. Find 𝑃(𝑋1 + 𝑋2 ≤ 2)
2. Use the distribution function method to find the 𝑝𝑑𝑓 of 𝑌1 = 𝑋1 + 𝑋2 .
3. Find 𝑃(𝑋1 − 𝑋2 ≤ −3)
4. Find 𝑃(𝑋1 − 𝑋2 ≤ 4)
5. Use the distribution function method to find the 𝑝𝑑𝑓 of 𝑌2 = 𝑋1 − 𝑋2
Solution: You need to remember that the joint 𝑝𝑑𝑓 of the two random variables
𝑋1 , 𝑋2 (refer to STAT 211) is,
𝑓(𝑥1 , 𝑥2 ) = 𝑓(𝑥1 )𝑓(𝑥2 )
= 𝑒 −𝑥1 𝑒 −𝑥2
= 𝑒 −(𝑥1+𝑥2) , 𝑥1 > 0, 𝑥2 > 0
7
1. 𝒙𝟐
2 X1+X2 = 2
X1+X2≤ 2
2 𝒙𝟏
𝑃(𝑋1 + 𝑋2 ≤ 2) = ∫ ∫ 𝑓(𝑥1 , 𝑥2 )𝑑𝑥1 𝑑𝑥2
𝑥1 +𝑥2 ≤2
2 2−𝑥2
=∫ ∫ 𝑒 −(𝑥1 +𝑥2) 𝑑𝑥1 𝑑𝑥2
0 0
3
=1− = 0.593994
ⅇ2
2. 𝑦1 = 𝑥1 + 𝑥2 . Because 𝑥1 > 0 and 𝑥2 > 0 then 𝑦1 > 0. Let 𝐺𝑌1 (𝑦1 ) be
the distribution function of 𝑌1 , then
. 𝒙𝟐
y1 X1+X2 = y1, y1 > 0
X1+X2≤ y1
y1 𝒙𝟏
8
𝐺𝑌1 (𝑦1 ) = 𝑃(𝑌1 ≤ 𝑦1 ),
= 𝑃(𝑋1 + 𝑋2 ≤ 𝑦1 )
= ∫∫ 𝑓(𝑥1 , 𝑥2 )𝑑𝑥1 𝑑𝑥2
𝑥1 +𝑥2 ≤𝑦1
𝑦1 𝑦1 −𝑥2
=∫ ∫ 𝑒 −(𝑥1+𝑥2) 𝑑𝑥1 𝑑𝑥2
0 0
= 𝑒−𝑦1 (−1 − 𝑦1 + 𝑒𝑦1 ) , 𝑦1 > 0 .
The 𝑝𝑑𝑓 of 𝑌1 is,
𝑑𝐺𝑌1 (𝑦1 )
𝑔𝑌1 (𝑦1 ) =
𝑑𝑦1
𝑦 𝑒−𝑦1 , 𝑦1 > 0
={ 1
0 , 𝑜. 𝑤
Note that: 𝑌1 ~ Γ(2, 1)
3. 𝒙𝟐
X1-X2 = -3
-3 𝒙𝟏
𝑃(𝑋1 − 𝑋2 ≤ −3) = ∫ ∫ 𝑓(𝑥1 , 𝑥2 )𝑑𝑥1 𝑑𝑥2
𝑥1 −𝑥2 ≤−3
∞ −3+𝑥2
=∫ ∫ 𝑒 −(𝑥1 +𝑥2 ) 𝑑𝑥1 𝑑𝑥2
3 0
1
= = 0.0248935
2ⅇ 3
9
4. 𝒙𝟐 X1 = 4
X1-X2 = 4
𝒙𝟐 = 𝟎
4 𝒙𝟏
-4
𝒙𝟏 = 0
𝑃(𝑋1 − 𝑋2 ≤ 4) = ∫ ∫ 𝑓(𝑥1 , 𝑥2 )𝑑𝑥1 𝑑𝑥2
𝑥1 −𝑥2 ≤4
∞ 4 ∞ 4+𝑥2
−(𝑥1 +𝑥2 )
=∫ ∫ 𝑒 𝑑𝑥1 𝑑𝑥2 + ∫ ∫ 𝑒 −(𝑥1+𝑥2) 𝑑𝑥1 𝑑𝑥2
0 0 0 4
1
=1− = 0.990842
2ⅇ 4
5. 𝑦2 = 𝑥1 − 𝑥2 . Because 𝑥1 > 0 and 𝑥2 > 0 then −∞ < 𝑦2 < ∞. Let 𝐺𝑌2 (𝑦2 )
be the distribution function of 𝑌2 , then (Refer to Parts 3 and 4 of this example
to further understand the steps below).
10
𝒙𝟐
X1-X2 = y1, y1<0
-y1 X1-X2 = y1, y1>0
y1 y1 𝒙𝟏
- y1
𝐺𝑌2 (𝑦2 ) = 𝑃(𝑌2 ≤ 𝑦2 ),
= 𝑃(𝑋1 − 𝑋2 ≤ 𝑦2 )
= ∫ ∫𝑥 𝑓(𝑥1 , 𝑥2 )𝑑𝑥1 𝑑𝑥2 , −∞ < 𝑦2 < ∞.
1 −𝑥2 ≤𝑦2
∞ 𝑦2 +𝑥2
∫ ∫ 𝑒 −(𝑥1+𝑥2) 𝑑𝑥1 𝑑𝑥2 , 𝑦2 < 0
−𝑦2 0
= ∞ 𝑦2 ∞ 𝑦2 +𝑥2
−(𝑥1 +𝑥2 )
∫ ∫ 𝑒 𝑑𝑥1 𝑑𝑥2 + ∫ ∫ 𝑒 −(𝑥1 +𝑥2 ) 𝑑𝑥1 𝑑𝑥2 , 𝑦2 > 0
{ 0 0 0 𝑦2
𝑦2
𝑒
, 𝑦2 < 0
2
={ −𝑦 .
𝑒 2
1− , 𝑦2 > 0
2
The 𝑝𝑑𝑓 of 𝑌2 is,
𝑑𝐺𝑌1 (𝑦1 )
𝑔𝑌1 (𝑦1 ) =
𝑑𝑦1
𝑦
𝑒 2
, 𝑦2 < 0
= { −𝑦22
𝑒
, 𝑦2 > 0
2
|𝑦 |
𝑒 2
= , −∞ < 𝑦2 < ∞
2
11
Questions
Q1: Let 𝑋 be a random variable with 𝑝𝑑𝑓 𝑁(0,1). Find the 𝑝𝑑𝑓 of 𝑌 = 𝑋 2 .
Q2: Let 𝑋1 , 𝑋2 be a random sample from 𝑈(0,1).
1. Find 𝑃(𝑋1 + 𝑋2 ≤ 2) 2. Find 𝑃(𝑋1 + 𝑋2 ≤ 0)
3. Find 𝑃(𝑋1 + 𝑋2 ≤ 0.5) 4. Find 𝑃(𝑋1 + 𝑋2 ≤ 1.5)
5. Use the distribution function method to find the 𝑝𝑑𝑓 of 𝑌1 = 𝑋1 + 𝑋2 .
6. Find 𝑃(𝑋1 − 𝑋2 ≤ −0.5) 7. Find 𝑃(𝑋1 − 𝑋2 ≤ 0)
8. Find 𝑃(𝑋1 − 𝑋2 ≤ 0.4)
9. Use the distribution function method to find the 𝑝𝑑𝑓 of 𝑌2 = 𝑋1 − 𝑋2
10. Use the distribution function method to find the 𝑝𝑑𝑓 of 𝑌3 = 𝑋1 𝑋2
Q3: The joint 𝑝𝑑𝑓 of 𝑋1 , 𝑋2 is
0.5 , 0 < 𝑥1 < 1, 0 < 𝑥2 < 2
𝑓(𝑥) = {
0 , 𝑜. 𝑤
Use the distribution function method to find the 𝑝𝑑𝑓 of 𝑌1 = 𝑋1 + 𝑋2 .
12