Topic 3_Expected Value and Variance of a Random Variable
Topic 3_Expected Value and Variance of a Random Variable
• Consider a university having 15,000 students and let X = the number of courses for
which a randomly selected student is registered.
• The pmf of X is given by:
x 1 2 3 4 5 6 7
• Since the total number of students is given and the probabilities are given, we can
calculate the absolute number of students registered for different number of courses.
x 1 2 3 4 5 6 7
1
1
Average number of courses per student = (On an average, what is the number of
courses a student has registered for?)
• The average or mean value of X is then a weighted average of the possible values of
the random variable where the weights are the probabilities of those values.
4
4
Expected Value of a Random Variable
5
5
Expected Value of a Random Variable: Numericals
Q1. Calculate the Expected Value of X:
x 1 2 3 4 5 6 7
• Notice that the expected value here is not 4, the ordinary average of 1, . . . , 7, because
the distribution puts more weight on 4, 5, and 6 than on other X values.
• Further, the expected value of 4.57 is not a possible value of X. The word expected
should be interpreted with caution because one would not expect to see an X value of
4.57 when a single student is selected. It is a long-run observed value of X when an
experiment is performed repeatedly.
6
6
Expected Value of a Random Variable
7
7
Expected Value of a Random Variable: Numericals
8
8
Expected Value of a Random Variable: Numericals
9
9
Expected Value of a Random Variable: Numericals
10
10
11
11
Expected Value of a Random Variable: Numericals
Q2. Just after birth, each newborn child is rated on a scale called the Apgar scale. The
possible ratings are 0, 1, . . . , 10, with the child’s rating determined by colour, muscle
tone, respiratory effort, heartbeat, and reflex irritability (the best possible score
is 10). Let X be the Apgar score of a randomly selected child born at a certain hospital
during the next year, and suppose that the pmf of X is
12
12
Expected Value of a Random Variable: Numericals
• Notice again here that 7.15 is not a possible value of the variable X.
13
13
Expected Value of a Random Variable: Numericals
14
14
Expected Value of a Random Variable: Numericals
𝑝, 𝑖𝑓 𝑥 = 1
𝑝 𝑥 =𝑓 𝑥 =ቊ
1 − 𝑝, 𝑖𝑓 𝑥 = 0
15
15
Expected Value of a Random Variable: Numericals
Q4. Starting at a fixed time, we observe the gender of each newborn child at a certain
hospital until a boy (B) is born. Let p=P(B), assume that successive births are independent,
and define the rv X by x= number of births observed. Find the expected value of X.
16
16
Expected Value of a Random Variable: Numericals
We need to first find out the pmf of the random variable X. X can take the values 1, 2, 3,
…
𝑝 1 =𝑓 1 =𝑃 𝑋=1 =𝑃 𝐵 =𝑝
𝑝 2 = 𝑓 2 = 𝑃 𝑋 = 2 = 𝑃 𝐺𝐵 = 1 − 𝑝 𝑝
𝑝 3 = 𝑓 3 = 𝑃 𝑋 = 3 = 𝑃 𝐺𝐺𝐵 = 1 − 𝑝 1 − 𝑝 𝑝 = (1 − 𝑝)2 𝑝
…..
Hence, a general formula emerges
(1 − 𝑝)𝑥−1 𝑝, 𝑖𝑓 𝑥 = 1,2,3 …
𝑝 𝑥 =𝑓 𝑥 =ቊ
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
17
17
∞ ∞
∞
−𝑑
=𝑝 (1 − 𝑝) 𝑥
𝑑𝑝
𝑥=1
∞
𝑑 𝑥
𝑑 1−𝑝 𝑑 1−𝑝
= −𝑝 1−𝑝 = −𝑝 = −𝑝 ( )
𝑑𝑝 𝑑𝑝 1 − 1 − 𝑝 𝑑𝑝 𝑝
𝑥=1
𝑑 1 −1 1
= −𝑝 − 1 = −𝑝 2 =
𝑑𝑝 𝑝 𝑝 𝑝
If p is near 1, we expect to see a boy very soon, whereas if p is near 0, we expect many
births before the first boy.
18
18
Expected Value of a Function of a Random Variable
• The cost of a certain vehicle diagnostic test depends on the number of cylinders X inthe
vehicle’s engine. Suppose the cost function is given by ℎ 𝑋 = 20 + 3𝑋 + 0.5𝑋 2 . Since
X is a random variable, so is 𝑌 = ℎ(𝑋). The pmf of X is as follows:
x 4 6 8
19
19
Expected Value of a Function of a Random Variable
• The cost of a certain vehicle diagnostic test depends on the number of cylinders X inthe
vehicle’s engine. Suppose the cost function is given by ℎ 𝑋 = 20 + 3𝑋 + 0.5𝑋 2 . Since
X is a random variable, so is 𝑌 = ℎ(𝑋). The pmf of X is as follows:
x 4 6 8
20
20
Expected Value of a Function of a Random Variable
21
21
Expected Value of a Function of a Random Variable:
Numericals
Q. A computer store has purchased three computers of a certain type at $500 apiece. It will
sell them for $1000 apiece. The manufacturer has agreed to repurchase any computers still
unsold after a specified period at $200 apiece. Let X denote the number of computers sold,
and suppose that p(0)=0.1, p(1)=0.2, p(2)=0.3 and p(3)=0.4. Find the expected profit of
the computer store.
22
22
Expected Value of a Function of a Random Variable:
Numericals
23
23
Rules of Expected Value
24
24
Rules of Expected Value
𝐸 𝑎𝑋 + 𝑏 = 𝑎𝐸 𝑋 + 𝑏
Proof:
𝐸 𝑎𝑋 + 𝑏 = 𝑎𝑥 + 𝑏 𝑝 𝑥 = 𝑎 𝑥𝑝 𝑥 + 𝑏 𝑝 𝑥 = 𝑎𝐸 𝑋 + 𝑏
25
25
Variance of a Random Variable
Let the random variable X have pmf p(x) and expected value 𝜇.
26
26
Variance of a Random Variable
• If most of the probability distribution or pmf is close to 𝜇, then 𝜎 2 will be relatively
small.
• However, if there are x values far away from 𝜇, then variance will be quite large.
• Although both distributions pictured in Figure 3.7 have the same center 𝜇, the
distribution of Figure 3.7(b) has greater spread or variability or dispersion than does
that of Figure 3.7(a).
27
27
Alternative Formula for Calculating Variance
𝜎 2 = 𝑥 − 𝜇 2 𝑝 𝑥 = 𝑥 2 + 𝜇2 − 2𝜇𝑥 𝑝(𝑥)
= 𝑥 2 𝑝 𝑥 + 𝜇2 𝑝 𝑥 − 2𝜇 𝑥𝑝(𝑥)
= 𝐸 𝑋 2 + 𝜇2 − 2𝜇2 = 𝐸 𝑋 2 − 𝜇2 = 𝐸 𝑋 2 − (𝐸(𝑋))2
28
28
Variance of a Random Variable: Numericals
Q. Find the mean, variance and standard deviation of the Random Variable X whose pmf is
given by:
29
29
Variance of a Random Variable: Numericals
Expected Value = E(X)=(1)(0.30)+(2)(0.25)+…+(6)(0.15) = 2.85
30
30
Variance of a Function of Random Variable
ℎ 𝑋 = 𝑎𝑋 + 𝑏
𝑉 ℎ 𝑋 = 𝐸[ℎ 𝑋 − 𝐸(ℎ 𝑋 ]2 = 𝐸[ 𝑎𝑋 + 𝑏 − 𝐸 𝑎𝑋 + 𝑏 ]2
2
Therefore, 𝑉 𝑎𝑋 + 𝑏 = 𝜎𝑎𝑋+𝑏 = 𝑎2 𝜎𝑋2
Q. A computer store has purchased three computers of a certain type at $500 apiece. It will
sell them for $1000 apiece. The manufacturer has agreed to repurchase any computers still
unsold after a specified period at $200 apiece. Let X denote the number of computers sold,
and suppose that p(0)=0.1, p(1)=0.2, p(2)=0.3 and p(3)=0.4. Find the variance of the profit
of the computer store.
32
32
Variance of a Function of a Random Variable:
Numericals
2
𝑉 𝑋 = 𝐸(𝑋)2 − 𝐸 𝑋
33
33