AE 248: AI and Data Science: Prabhu Ramachandran 2024-01-01
AE 248: AI and Data Science: Prabhu Ramachandran 2024-01-01
AE 248: AI and Data Science: Prabhu Ramachandran 2024-01-01
Random Variables
Prabhu Ramachandran
2024-01-01
Random Variable
Examples
1. Consider the game of tossing a coin and heads you pay the opponent Rs.10 and tails you
get paid Rs.10. Let 𝑋 be the total earnings of a player in 10 coin tosses.
2. Let 𝑋 denote the sum of two fair dice.
3. Let 𝑋 denote the lifetime of a battery.
Random Variables
Examples
1
Random Variables
CDF
Example
Example
2
Continuous RV
𝑃 {𝑋 ∈ 𝐵} = ∫ 𝑓(𝑥)𝑑𝑥
𝐵
𝑏
𝑃 {𝑎 < 𝑋 ≤ 𝑏} = ∫ 𝑓(𝑥)𝑑𝑥
𝑎
• Note that 𝑃 {𝑋 = 𝑎} = 0
• and 𝑓(𝑎) ≠ 0
Continous RV
𝑎
𝐹 (𝑎) = ∫ 𝑓(𝑥)𝑑𝑥
−∞
𝑑
𝐹 (𝑎) = 𝑓(𝑎)
𝑑𝑎
Question
A) Yes
B) No
C) Don’t know
Question
A) Yes
B) No
C) Don’t know
3
Question
A) 0
B) 1
C) 2
D) 3
Recap of terms/notation
Example
𝑒−𝑥 𝑥 ≥ 0
𝑓(𝑥) = {
0 𝑥<0
Relationship to histograms
• Multiple RVs
• 𝐹 (𝑥, 𝑦) = 𝑃 {𝑋 ≤ 𝑥, 𝑌 ≤ 𝑦}
• 𝐹𝑋 (𝑥) = 𝑃 {𝑋 ≤ 𝑥} = 𝑃 {𝑋 ≤ 𝑥, 𝑌 ≤ ∞} = 𝐹 (𝑥, ∞)
4
Joint PMF
• 𝑝(𝑥𝑖 , 𝑦𝑗 ) = 𝑃 {𝑋 = 𝑥𝑖 , 𝑌 = 𝑦𝑗 }
• Can compute 𝑝𝑋 and 𝑝𝑌 from above.
Example
From textbook:
Suppose that 15 percent of the families in a certain community have no children, 20 percent
have 1, 35 percent have 2, and 30 percent have 3 children; suppose further that each child is
equally likely (and independently) to be a boy or a girl. If a family is chosen at random from
this community, if B is the number of boys, and G, the number of girls, in this family, find the
joint probability mass function.
Joint CDF/PDF
𝑎 𝑏
• 𝐹 (𝑎, 𝑏) = ∫−∞ ∫−∞ 𝑓(𝑥, 𝑦)𝑑𝑥𝑑𝑦
• 𝑓(𝑎, 𝑏) = 𝜕𝑎𝜕𝑏
2
𝜕
𝐹 (𝑎, 𝑏)
∞
• 𝑓𝑋 (𝑥) = ∫−∞ 𝑓(𝑥, 𝑦)𝑑𝑦
Question
A) 1.0
B) 𝑒−1 (1 − 𝑒−2 )
C) 𝑒−1 (1 − 𝑒−3 )
D) 𝑒−2 (1 − 𝑒−1 )
Question
Find 𝑃 {𝑋 < 𝑎}
A) 1/2
5
B) 1 − 𝑒−𝑎
C) 1 − 𝑒−2𝑎
D) 1 − 𝑒−𝑎
2
Question
Find 𝑃 {𝑋 < 𝑌 },
A) 1.0
B) 1/2
C) 1/3
D) 1/4
Independent RVs
Example
𝑒−𝑥 𝑥 ≥ 0
𝑓(𝑥) = {
0 𝑥<0
Answer
6
Multiple independent RV's
Conditional Distributions
𝑓(𝑥, 𝑦)
𝑓𝑋|𝑌 (𝑥|𝑦) =
𝑓𝑌 (𝑦)
Expectation
Clarifications on notation
• 𝑋 vs 𝑥
• 𝑃 {𝑋 < 𝑥}
• 𝐹 (𝑥) vs 𝐹𝑋 (𝑥)?
• 𝐸[𝑋] why not 𝐸(𝑥)?
Question
Consider a fair die. Let 𝑋 be the random variable corresponding to the number facing up.
What is 𝐸[𝑋]?
A) 3
B) 3.5
C) 2.5
D) None of the above
7
AE 248: AI and Data science
Random Variables
Prabhu Ramachandran
2024-01-01
Random Variable
Examples
1. Consider the game of tossing a coin and heads you pay the opponent Rs.10 and tails you
get paid Rs.10. Let 𝑋 be the total earnings of a player in 10 coin tosses.
2. Let 𝑋 denote the sum of two fair dice.
3. Let 𝑋 denote the lifetime of a battery.
Random Variables
Examples
1
Random Variables
CDF F(x)
Example
Example
2
Continuous RV
𝑃 {𝑋 ∈ 𝐵} = ∫ 𝑓(𝑥)𝑑𝑥
𝐵
𝑏
𝑃 {𝑎 < 𝑋 ≤ 𝑏} = ∫ 𝑓(𝑥)𝑑𝑥
𝑎
• Note that 𝑃 {𝑋 = 𝑎} = 0
• and 𝑓(𝑎) ≠ 0
Continous RV
𝑎
𝐹 (𝑎) = ∫ 𝑓(𝑥)𝑑𝑥
−∞
𝑑
𝐹 (𝑎) = 𝑓(𝑎)
𝑑𝑎
Question
A) Yes
B) No
C) Don’t know
Question
A) Yes
B) No
C) Don’t know
3
Question
A) 0
B) 1
C) 2
D) 3
Recap of terms/notation
Example
𝑒−𝑥 𝑥 ≥ 0
𝑓(𝑥) = {
0 𝑥<0
Relationship to histograms
• Multiple RVs
• 𝐹 (𝑥, 𝑦) = 𝑃 {𝑋 ≤ 𝑥, 𝑌 ≤ 𝑦}
• 𝐹𝑋 (𝑥) = 𝑃 {𝑋 ≤ 𝑥} = 𝑃 {𝑋 ≤ 𝑥, 𝑌 ≤ ∞} = 𝐹 (𝑥, ∞)
4
Joint PMF
• 𝑝(𝑥𝑖 , 𝑦𝑗 ) = 𝑃 {𝑋 = 𝑥𝑖 , 𝑌 = 𝑦𝑗 }
• Can compute 𝑝𝑋 and 𝑝𝑌 from above.
Example
From textbook:
Suppose that 15 percent of the families in a certain community have no children, 20 percent
have 1, 35 percent have 2, and 30 percent have 3 children; suppose further that each child is
equally likely (and independently) to be a boy or a girl. If a family is chosen at random from
this community, if B is the number of boys, and G, the number of girls, in this family, find the
joint probability mass function.
Joint CDF/PDF
𝑎 𝑏
• 𝐹 (𝑎, 𝑏) = ∫−∞ ∫−∞ 𝑓(𝑥, 𝑦)𝑑𝑥𝑑𝑦
• 𝑓(𝑎, 𝑏) = 𝜕𝑎𝜕𝑏
2
𝜕
𝐹 (𝑎, 𝑏)
∞
• 𝑓𝑋 (𝑥) = ∫−∞ 𝑓(𝑥, 𝑦)𝑑𝑦
Question
A) 1.0
B) 𝑒−1 (1 − 𝑒−2 )
C) 𝑒−1 (1 − 𝑒−3 )
D) 𝑒−2 (1 − 𝑒−1 )
Question
Find 𝑃 {𝑋 < 𝑎}
A) 1/2