Random variable slides
Random variable slides
VARIABLE
• A random variable is a function that associates a real number with each element in
the sample space. •
• We use a capital letter such as X to denote the random variable. •
• We use the small letter such as x for one of its values.
DISCRETE RANDOM VARIABLE
• X takes the value 0 only for the outcome HH, so the probability
that X = 0 is 1/4.
• X takes the value 1 for outcomes HT OR TH. By the addition
principle, the probability that X = 1 is 1/4 + 1/4 = 1/2.
• Finally, X takes the value 2 only for the outcome TT, so the
probability that X = 2 is 1/4.
𝑃 𝑋 = 𝑥 = 𝑓 𝑥 is known as probability mass function for
discrete random variable X.
1
𝑃 𝑋=0 =𝑓 0 =
4
2
𝑃 𝑋=1 =𝑓 1 =
4
1
𝑃 𝑋=2 =𝑓 2 =
4
Any probability distribution of a discrete random
variable must satisfy:
Chapter 3 Page 93
Spade card = S
X= 0, 1, 2, 3
X = no of Spades 𝑃(𝑋 = 𝑥)
1 S S S 3 1716 132600
2 S S N 2
3 S N S 2 6084/132600
4 S N N 1
5 N S S 2
6 N S N 1 19266/13260
0
7 N N S 1
8 N N N 0 54834/13260
0
𝑃 𝑋 = 3 = 13 52 × 12 51 × 11 50 = 1716 132600
𝑃 𝑋 = 2 = 13 52 × 12 51 × 39 50 = (3 × 6084) 132600
= 18252/132600
𝑃 𝑋 = 1 = 13 52 × 39 51 × 38 50
= (3 × 19266) 132600 = 57798/132600
𝑃 𝑋 = 0 = 39 52 × 38 51 × 37 50 = 54834 132600
x 0 1 2 3
𝑃 −2 < 𝑋 < 4 = 𝑃 𝑋 = −1 + 𝑃 𝑋 = 0
𝑃 −2 < 𝑋 ≤ 0 = 𝑃 𝑋 = −1 + 𝑃 𝑋 = 0
𝑃 −2 ≤ 𝑋 ≤ 0 = 𝑃 𝑋 = −2 + 𝑃 𝑋 = −1 + 𝑃 𝑋 = 0
𝑃 −2 ≤ 𝑋 < 0 = 𝑃 𝑋 = −2 + 𝑃 𝑋 = −1
January 1, 2017 14 /26
CUMULATIVE DISTRIBUTION
FUNCTION
The cumulative distribution function F(x) of a discrete random variable X
with probability distribution f(x) is
130884 1716
𝐹 3 =𝑓 0 +𝑓 1 +𝑓 2 +𝑓 3 = +
132600 132600
132600
= =1
132600
CONCEPT QUESTION: CDF AND PMF
X a random variable.
values of X : 1 3 5 7
cdf F (x): 0.5 0.75 0.9 1
1. What is P ( X ≤ 3)?
(a) 0.15 (b) 0.25 (c) 0.5 (d) 0.75
2. What is P ( X = 3)
(a) 0.15 (b) 0.25 (c) 0.5 (d) 0.75
1. answer: (d) 0.75. P ( X ≤ 3) = F (3) = 0.75.
2. answer: (b) P ( X = 3) = F (3) − F (1) = 0.75 − 0.5 = 0.25.
January 1, 2017 17 /26
EXAMPLE: CHANGING
MAJORS
A random sample of graduating seniors was surveyed just before
graduation. One question that was asked is:
How many times did you change majors?
The results are displayed in a probability distribution.
x 0 1 2 3 4 5
𝑃 𝑋=𝑥 0.28 0.37 0.23 0.09 0.02 0.01
= 𝑓(𝑥)
Answer 2:
This can be written as P(X > 1).
Answer 2:
𝑃 𝑋 ≥ 2 = 1−𝑃 𝑋 < 2
= 1 − 𝑃 𝑋 ≤ 1 = 1 − 𝐹 1 = 1 − 0.65 = 0.35
0 + 1 2 3 4 5
=1
P(X ≥ 2) = 0.35.
So, 35% of the time a student changes majors 2 or more times.
This means that it is not unusual to do so.
Question 3: What is the probability of changing majors only once given
at least one change in major.
Answer 3:
A: At least one change 𝑃(𝑋 ≥ 1)
B: only once change 𝑃 𝑋=1
𝑃(𝐴 ∩ 𝐵)
𝑃 𝐵𝐴 =
𝑃(𝐴)
[since the only outcome that satisfies both X = 1 and X ≥ 1 is X = 1]
𝑃(𝑋 = 1 ∩ 𝑋 ≥ 1) 𝑃(𝑋 = 1)
𝑃 𝑋=1 𝑋≥1 = =
𝑃(𝑋 ≥ 1) 𝑃(𝑋 ≥ 1)
Using CDF
0.65 − 0.28 0.37
= = = 0.5139
1 − 0.28 0.72
Using PMF
0.37 0.37
= = 0.5139
0.37 + 0.23 + 0.09 + 0.02 + 0.01 0.72
So, among students who change at least 1 major, 51% of these
students will only change majors one time.
CONTINUOUS PROBABILITY DISTRIBUTION
a. Find the probability that more than 1/4 but fewer than 1/2 of the
people contacted will respond to this type of solicitation.
0.5
2 𝑥+2
𝑃 0.25 < 𝑋 < 0.5 = 𝑑𝑥
0.25 5
b. Show that the area under the curve is equal to 1.
1
2 𝑥+2
𝑑𝑥 = 1
0 5
CUMULATIVE DISTRIBUTION
FUNCTION FOR CONTINUOUS
RANDOM VARIABLE
𝑥
𝐹 𝑥 =𝑃 𝑋≤𝑥 = 𝑓 𝑥 𝑑𝑥 𝑓𝑜𝑟 − ∞ < 𝑥 < ∞
−∞
3.21 Consider the density function
(a) Evaluate k.
1
𝑘 𝑥 𝑑𝑥 = 1
0
3
𝑘=
2
(b) Find F(x) and use it to evaluate P(0.3 < X < 0.6).
𝑥
3 3
𝐹 𝑥 = 𝑥 𝑑𝑥 = 𝑥 2
0 2
3 3
𝑃 0.3 < 𝑋 < 0.6 = 𝐹 0.6 − 𝐹 0.3 = 0.62 − 0.32
𝑂𝑅
0.6
3
𝑃 0.3 < 𝑋 < 0.6 = 𝑥𝑑𝑥
0.3 2
3.6, 3.7, 3.9, 3.14, 3.17, 3.18,
3.19, 3.20, 3.27, 3.28, 3.29,
3.30, 3.31, 3.36,
EXPECTED VALUE
𝑥 × 𝑓(𝑥)
𝑖=1
Continuous Random Variable
∞
E X = 𝑥 × 𝑓(𝑥)
−∞
• It is a weightedaverage.
• It is a measure of centraltendency.
MEANING OF EXPECTEDVALUE
What is the expected average of one roll of a die?
answer: Suppose we roll it 5 times and get (3, 1, 6, 1, 2). To find the average
we add up these numbers and divide by 5: ave = 2.6. With so few rolls we don’t
expect this to be representative of what would usually happen. So let’s think
about what we’d expect from a large number of rolls. To be specific, let’s
(pretend to) roll the die 600 times.
We expect that each number will come up roughly 1/6 of the time. Let’s
suppose this is exactly what happens and compute the average.
value: 1 2 3 4 5 6
expected counts: 100 100 100 100 100 100
The average of these 600 values (100 ones, 100 twos, etc.) is then
100 · 1 + 100 · 2 + 100 · 3 + 100 · 4 + 100 · 5 + 100 · 6
average = 600
= 1 · 1 + 1 · 2 + 1 · 3 + 1 · 4 + 1 · 5 + 1 · 6= 3.5.
6 6 6 6 6 6
This is the ‘expected average’. We will call it the expectedvalue January 1, 2017 29 /26
Properties of E (X )
1. E(a)=a
2. E (X + Y ) = E (X ) + E (Y )
3. E (aX + b) = aE (X ) + b
4. 𝐿𝑒𝑡 ℎ 𝑥 = 𝑥 − 2 2 = 𝑥2 + 22 − 4𝑥
𝐸 ℎ 𝑥 = 𝐸 𝑥−2 2
2
= 𝑥−2 ×𝑃 𝑋 = 𝑥
𝑂𝑅
𝐸 𝑥 + 4 − 4𝑥 = 𝐸 𝑥2 + 𝐸 4 − 4𝐸(𝑥)
2
Example 1. Find E X , 𝐸 (𝑋 2 +1)
X: 3 4 5 6
𝑃 𝑋 = 𝑥 = 𝑓(𝑥): 1/4 1/2 1/8 1/8
1 1 1 1
E (X ) = 3 × + 4 × + 5 × + 6 ×
4 2 8 8
E(X) = 3/4 + 4/2 + 5/8 + 6/8 = 33/8
To find 𝐸 (𝑋 2 +1)
𝑿𝟐 + 𝟏 (𝟑𝟐 +𝟏) = 𝟏𝟎 (𝟒𝟐 +𝟏) = 𝟏𝟕 (𝟓𝟐 +𝟏) = 𝟐𝟔 (𝟔𝟐 +𝟏) = 𝟑𝟕
𝑓(𝑥) 1 4 1 2 1 8 1 8
1 1 1 1 151
𝐸(𝑋 2 + 1) = 1 0 × + 17 × + 26 × + 37 × =
4 2 8 8 8
January 1, 2017 19 / 26
OR
To find 𝐸 (𝑋 2 +1) = 𝐸 𝑋 2 + 1
𝑿𝟐 𝟑𝟐 = 𝟗 𝟒𝟐 = 𝟏𝟔 𝟓𝟐 = 𝟐𝟓 𝟔𝟐 = 𝟑𝟔
𝑓(𝑥) 1 4 1 2 1 8 1 8
1 1 1 1 143
𝐸(𝑋 2 ) = 9 × + 16 × + 25 × + 36 × =
4 2 8 8 8
𝐸 (𝑋 2 +1) = 𝐸 𝑋 2 + 1
143 151
= +1=
8 8
QUESTION: INTERPRETING EXPECTATION
(a)Would you accept a gamble that offers a 10% chance to win $95 and a
90% chance of losing $5?
= 9.5 − 4.5 = $5
In this situation your expected gain will be only $5.
𝐸 𝑋 = 𝑥(𝑥) 𝑑𝑥 + 𝑥 2 − 𝑥 𝑑𝑥
0 1
4.20 A continuous random variable X has the density function
𝑒 −𝑥 𝑥>0
𝑓 𝑥 =
0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
2𝑥
Find the expected value of 𝑔 𝑥 = 𝑒 3
∞
2𝑥
𝐸 𝑔(𝑥) = 𝑔 𝑥 × 𝑓 𝑥 𝑑𝑥 = 𝑒 3 × 𝑒 −𝑥 𝑑𝑥
0
∞ ∞
2𝑥−3𝑥 −𝑥 −𝑥
= 𝑒 3 𝑑𝑥 = 𝑒3 𝑑𝑥 = −3𝑒 3
0 0
Variance and Standard Deviation
Let X be a random variable with probability distribution f(x) and
mean μ. The variance of X is
𝜎 2 = 𝐸 𝑋 − 𝜇 2 = 𝑥 − 𝜇)2 𝑓(𝑥 For Discrete r.v
𝜎 2 = 𝐸 𝑋 − 𝜇 2 = 𝑥 − 𝜇)2 𝑓(𝑥 𝑑𝑥 For Continuous r.v
Short Method
𝐸 𝑋 =𝜇= 𝑥𝑓(𝑥)
𝐸 𝑋 = 𝑥𝑓 𝑥 𝑑𝑥
4.34 Let X be a random variable with the following probability
distribution:
X -2 3 5
𝑿𝟐 (−𝟐)𝟐 = 𝟒 𝟑𝟐 = 𝟗 𝟓𝟐 = 𝟐𝟓
𝐸(𝑋 2 ) = 4 × 0 . 3 + 9 × 0 . 2 + 2 5 × 0 . 5 =15.5
E (X ) = − 2 × 0 . 3 + 3 × 0 . 2 + 5 × 0 . 5 = 2 . 5
𝐸 𝑋2 = 15.5 𝐸 𝑋 = 2.5
𝜎2 = 𝐸 𝑋2 − 𝐸 𝑋 2
𝑆. 𝐷 = 𝜎 = 9.25
4.38 Find the variance of X if X has the density function
2(𝑥 + 2)
𝑓 𝑥 = 0<𝑥<1
5
0 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
𝜎2 = 𝐸 𝑋2 − 𝐸 𝑋 2
1
2 𝑥 +2
𝐸 𝑋2 = 𝑥2 × 𝑑𝑥
5
0
1
2(𝑥 + 2)
𝐸 𝑋 = 𝑥 × 𝑑𝑥
5
0
4.20 A continuous random variable X has the density
function